Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse TEA » How to execute Clean-Up Action
How to execute Clean-Up Action [message #1782737] Wed, 28 February 2018 17:27 Go to next message
John-Paul Cunliffe is currently offline John-Paul CunliffeFriend
Messages: 2
Registered: February 2018
Junior Member
Hi there,

I am really glad you guys are working on better Eclipse Automation! I would like to simply run the Clean-Up Action (Source/Clean Up) on specific files - is this possible with TEA?

Cheers
John
Re: How to execute Clean-Up Action [message #1785392 is a reply to message #1782737] Fri, 13 April 2018 12:34 Go to previous messageGo to next message
Markus Duft is currently offline Markus DuftFriend
Messages: 30
Registered: March 2015
Member
Hey,

Sorry I missed this post for so long :|

There is nothing available out of the box for that. But we (internally) have for instance a task to run the code formater on files changed by the last GIT commit. Such things are rather straight forward, as you can access anything IDE-internal from within TEA.

From a quick glance you will have to look into JDTs AllCleanUpsAction and see where to go from there.
Re: How to execute Clean-Up Action [message #1792066 is a reply to message #1785392] Tue, 10 July 2018 16:43 Go to previous message
John-Paul Cunliffe is currently offline John-Paul CunliffeFriend
Messages: 2
Registered: February 2018
Junior Member
Hi Markus,

thanks for your reply. I am trying to get started, and followed your tutorial: https://www.eclipse.org/tea/documentation/samples/getting-started.php

I created a plugin project, added the classes you mention, added OSGI support and the dependencies (annotations.jar, org.eclipse.tea_core, javax.inject, org.eclipse.e4.core.annotations), and launched it as a eclipse application with the plugin itself activated (by default).

import javax.inject.Named;

import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.tea.core.services.TaskingLog;

@Named("MyTask")
public class CleanUpTask {

	@Execute
	public void demo(final TaskingLog log) {
		log.info("Hello World!");
	}

}


import org.eclipse.tea.core.TaskExecutionContext;
import org.eclipse.tea.core.annotations.TaskChainContextInit;
import org.eclipse.tea.core.annotations.TaskChainMenuEntry;
import org.eclipse.tea.core.services.TaskChain;
import org.eclipse.tea.core.services.TaskChain.TaskChainId;
import org.osgi.service.component.annotations.Component;

@TaskChainId(description = "TaskChain", alias = "MyChainAlias")
@TaskChainMenuEntry(path = "TEA")
@Component
public class CleanUpChain implements TaskChain {
	@TaskChainContextInit
	public void init(final TaskExecutionContext c) {
		c.addTask(CleanUpTask.class);
	}
}


When I start, I get some logs, but no "hello world", no new entry under the "TEA" top menu bar, and a outside break point on the @execute method won't stop either. Also, in the started eclipse, I can see my Plugin-Name under installations details/plug-ins.

Quote:
!SESSION 2018-07-10 18:46:09.638 -----------------------------------------------
eclipse.buildId=4.7.3.M20180301-0715
java.version=1.8.0_101
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
Framework arguments: -product org.eclipse.platform.ide
Command-line arguments: -product org.eclipse.platform.ide -data D:\ws\ipg/../runtime-EclipseApplication -dev file:D:/ws/ipg/.metadata/.plugins/org.eclipse.pde.core/Eclipse Application/dev.properties -os win32 -ws win32 -arch x86_64 -consoleLog

!ENTRY org.eclipse.ui 2 0 2018-07-10 18:46:21.210
!MESSAGE Warnings while parsing the images from the 'org.eclipse.ui.commandImages' extension point.
!SUBENTRY 1 org.eclipse.ui 2 0 2018-07-10 18:46:21.210
!MESSAGE Cannot bind to an undefined command: plug-in='org.eclipse.lsp4e', id='org.eclipse.lsp4e.togglehighlight'
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [bundleresource://1350.fwk1015658596:1/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [bundleresource://1350.fwk1015658596:2/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]

!ENTRY org.eclipse.jface 2 0 2018-07-10 18:46:29.069
!MESSAGE Keybinding conflicts occurred. They may interfere with normal accelerator operation.
!SUBENTRY 1 org.eclipse.jface 2 0 2018-07-10 18:46:29.069
!MESSAGE A conflict occurred for CTRL+SHIFT+T:
Binding(CTRL+SHIFT+T,
ParameterizedCommand(Command(org.eclipse.jdt.ui.navigate.open.type,Open Type,
Open a type in a Java editor,
Category(org.eclipse.ui.category.navigate,Navigate,null,true),
org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@5eb1fd44,
,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)
Binding(CTRL+SHIFT+T,
ParameterizedCommand(Command(org.eclipse.lsp4e.symbolinworkspace,Go to Symbol in Workspace,
,
Category(org.eclipse.lsp4e.category,Language Servers,null,true),
org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@20b42094,
,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)
log4j:WARN No appenders could be found for logger (org.springsource.ide.eclipse.commons.core.templates.TemplateProcessor).
log4j:WARN Please initialize the log4j system properly.
18:46:35.217 [Worker-8] INFO c.g.t.t.d.PublishedGradleVersions - Gradle version information cache is up-to-date. Trying to read.

!ENTRY org.eclipse.egit.ui 2 0 2018-07-10 18:46:35.466
!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git
user global configuration and to define the default location to store repositories: 'C:\Users\XXX'. If this is
not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and
EGit might behave differently since they see different configuration options.
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.
18:46:46.131 [Worker-13] DEBUG o.e.m.c.i.p.r.ProjectRegistryRefreshJob - Queued refresh request: [/RemoteSystemsTempFiles/pom.xml]
oldUrl: null
newUrl: file:///D:/ws/runtime-EclipseApplication/.metadata/.plugins/org.springsource.ide.eclipse.commons.gettingstarted/dashboard/1531241193216/index.html
18:46:49.004 [Worker-20] DEBUG o.e.a.i.i.DefaultLocalRepositoryProvider - Using manager EnhancedLocalRepositoryManager with priority 10.0 for d:\.m2\repo
18:46:49.060 [Worker-20] DEBUG o.e.a.i.i.DefaultLocalRepositoryProvider - Using manager EnhancedLocalRepositoryManager with priority 10.0 for d:\.m2\repo
18:46:49.062 [Worker-20] DEBUG o.e.m.c.i.p.r.ProjectRegistryManager - Refreshing: [L/RemoteSystemsTempFiles/pom.xml]
18:46:49.088 [Worker-20] DEBUG o.e.m.c.i.p.r.ProjectRegistryManager - Refreshed: [L/RemoteSystemsTempFiles/pom.xml]


Any suggestions?

[Updated on: Wed, 11 July 2018 12:35]

Report message to a moderator

Goto Forum:
  


Current Time: Tue Sep 25 07:50:50 GMT 2018

Powered by FUDForum. Page generated in 0.01915 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top