Runtasks command not enabled in several Eclipse perspectives


(Iain Duncan) #1

Hi,

I’ve just created a new Eclipse workspace and have imported a Gradle project. When I go to the Gradle Tasks view and double click on a task I get this error in my error log:

org.eclipse.buildship.core.GradlePluginsRuntimeException: Cannot execute command ‘org.eclipse.buildship.ui.commands.runtasks’.
at org.eclipse.buildship.ui.view.task.TreeViewerDoubleClickListener.run(TreeViewerDoubleClickListener.java:60)
at org.eclipse.buildship.ui.view.task.TreeViewerDoubleClickListener.doubleClick(TreeViewerDoubleClickListener.java:45)
at org.eclipse.jface.viewers.StructuredViewer$1.run(StructuredViewer.java:832)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:50)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:173)
at org.eclipse.jface.viewers.StructuredViewer.fireDoubleClick(StructuredViewer.java:829)
at org.eclipse.jface.viewers.AbstractTreeViewer.handleDoubleSelect(AbstractTreeViewer.java:1470)
at org.eclipse.jface.viewers.StructuredViewer$4.widgetDefaultSelected(StructuredViewer.java:1263)
at org.eclipse.jface.util.OpenStrategy.fireDefaultSelectionEvent(OpenStrategy.java:252)
at org.eclipse.jface.util.OpenStrategy.access$0(OpenStrategy.java:249)
at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:311)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4362)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1113)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4180)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3769)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1127)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1018)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:156)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:654)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:598)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:139)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:507)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:669)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608)
at org.eclipse.equinox.launcher.Main.run(Main.java:1515)
at org.eclipse.equinox.launcher.Main.main(Main.java:1488)
Caused by: org.eclipse.core.commands.NotEnabledException: Trying to execute the disabled command org.eclipse.buildship.ui.commands.runtasks
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:484)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:486)
at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:210)
at org.eclipse.ui.internal.handlers.LegacyHandlerService.executeCommand(LegacyHandlerService.java:343)
at org.eclipse.ui.internal.handlers.LegacyHandlerService.executeCommand(LegacyHandlerService.java:330)
at org.eclipse.buildship.ui.view.task.TreeViewerDoubleClickListener.run(TreeViewerDoubleClickListener.java:56)
… 38 more

My colleague has observed the same but noticed that if he ran the task in the Git Eclipse perspective then it worked ok. It seems that it only fails in the Java and Java EE perspectives.

The weird thing in, is an old workspace for the same Eclipse installation it works fine.


(Donát Csikós) #2

Hi. Thanks for reporting it, we’ll look into it shortly. Could you please specify the used Eclipse and Buildship version?


(Iain Duncan) #3

The Eclipse version is:

Eclipse Java EE IDE for Web Developers.

Version: Mars Release (4.5.0)
Build id: 20150621-1200

And buildship is 1.0.1.v20150707-1402.

Cheers,

Iain


(Iain Duncan) #4

I also just upgraded to buildship 1.0.2 and see the same problem.


(Etienne Studer) #5

Thanks. We will look into it, but it will take a week or so before we get to that since we are currently preparing for the Mars 1 release. Thanks for your patience.


(Donát Csikós) #6

I was able to reproduce it locally with the following steps:

  1. started a new runtime Eclipse from my dev environment
  2. created a new Gradle project with a wizard
  3. switched to “Plug-in Development” and opened the “Gradle Tasks” view
  4. double-clicked on a task

However, when I changed to the “Java” perspective, the problem no longer occurred. Neither the problem shows up for my colleagues, for them it is OK on all major operating systems (linux, windows, osx).

After debugging, I stumbled upon a platform error: the ‘Run tasks’ command handler can’t retrieve the “Gradle Tasks” view’s reference. I reported my findings and opened a Buildship ticket for the issue.


(Jeremy Hughes) #7

I found this problem too. I’ve tried a few things and it I can consistently reproduce in different perspectives including the Java one. The way to recreate is to have the view showing in >1 perspective. e.g. add to Java EE perspective, then add to Java perspective. Works in Java EE, fails in Java perspective.


(Donát Csikós) #8

FYI we fixed the problem. If you’d like to give it a try you can install the latest snapshot from our P2 repository. Also, the fix will be part of the upcoming 1.0.6 release.


(theVoid) #9

Somehow it appears that this problem is still alive!

Versions:
Eclipse Neon.2 Release (4.6.2)
Buildhip 2.0.0v20170111-1029

calling build in the tasks view results in

Cannot execute command ‘org.eclipse.buildship.ui.commands.runtasks’.

This happens on a regular basis. Switched to a new laptop some weeks ago and it worked fine again. But since today I am again not able to call the build task from within the buildship task view :frowning:


(theVoid) #10

I finally found the solution! It was related in my case to a combination of eclipse and linux and a needed addition to the eclipse.ini:

–launcher.GTK_version
2

just before the line
-product

Thought it’s good to document it here for others as well as for myself :wink: