ecd-plugin / ecd

An Eclipse Plugin to integrate different Class Decompiler seamlessly into the development workflow
Eclipse Public License 1.0
262 stars 57 forks source link

Menu items are grayed greyed out or not working #62

Open mscg82 opened 5 years ago

mscg82 commented 5 years ago

Steps to reproduce the problem:

  1. Download Eclipse 2019-03 (4.11) from here https://www.eclipse.org/downloads/packages/, unzip the package and launch Eclipse;
  2. Create a new workspace;
  3. Install the ECD plugin using the marketplace and restart Eclipse;
  4. Click Window / Perspective / Customize perspective;
  5. In the "Action set availability" tab check the "Decompiler" checkbox;
  6. In the "Menu visibility" check the "Decompiler" checkbox;
  7. Click the "Apply and close" button and the ECD icon will appear on the menu toolbar;
  8. Clicking on the down arrow near the button, the sub menu that appears will have almost all the entries greyed out (only "Debug mode" and "Preferences" are active). See picture 1 below for reference;
  9. The items "Show bytecode" and "Show disassembler" under the "Decompiler" voice of the window's main menu will do nothing when selected). See picture 2 below for reference;
  10. The list of decompilers in the submenu under the "Decompiler" voice of the window's main menu has all the voices greyed out and the only way to switch decompiler is to open the preferences and change the default decompiler from here. See picture 2 below for reference.

Picture 1: ECD - menu toolbar

Picture 2: ECD - main menu

RobertZenz commented 5 years ago

That's not a bug, that's a feature. These items are disabled as long as you don't have a class file open, only then they get enabled.

I guess we could always enable them, though, I've never looked at that part of the code.

mscg82 commented 5 years ago

If I open a .class file using ECD, I can see the source code generated by the selected decompiler, but the options in the menu remain disabled and the disassebler and byte code menu item have no effect at all.

RobertZenz commented 5 years ago

I just noticed that I currently ain't got an installation with ECD being installed...curiously, but especially one with the most recent release.

Can you check whether there is something in the error log (that's a view you can enable in the perspective) which might hint why it is not working?

mscg82 commented 5 years ago

With "right click/Open With/Class decompiler viewer", the error log shows no error when opening a .class file with ECD. Moreover, checking the "Set Class Decompiler Viewer as the dafault 'Java Class File' content type editor" doesn't work. If the option is set, double clicking on a .class file opens the Eclipse default class file editor. Using the "File associations" preferences screen to force ECD to be the default editor for both .class and .class without source yields to this error:

Java Model Exception: Java Model Status [src/main/resources/com/mscg/test [in test] is not on its project's build path]
    at org.eclipse.jdt.internal.core.JavaElement.newJavaModelException(JavaElement.java:583)
    at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:256)
    at org.eclipse.jdt.internal.core.Openable.openAncestors(Openable.java:530)
    at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:250)
    at org.eclipse.jdt.internal.core.Openable.openAncestors(Openable.java:530)
    at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:250)
    at org.eclipse.jdt.internal.core.SourceRefElement.generateInfos(SourceRefElement.java:113)
    at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:596)
    at org.eclipse.jdt.internal.core.BinaryType.getElementInfo(BinaryType.java:287)
    at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:312)
    at org.sf.feeling.decompiler.editor.DecompilerSourceMapper.findSource(DecompilerSourceMapper.java:66)
    at org.sf.feeling.decompiler.editor.JavaDecompilerClassFileEditor.doOpenBuffer(JavaDecompilerClassFileEditor.java:173)
    at org.sf.feeling.decompiler.editor.JavaDecompilerClassFileEditor.doOpenBuffer(JavaDecompilerClassFileEditor.java:148)
    at org.sf.feeling.decompiler.editor.JavaDecompilerClassFileEditor.doOpenBuffer(JavaDecompilerClassFileEditor.java:140)
    at org.sf.feeling.decompiler.editor.JavaDecompilerClassFileEditor.doSetInput(JavaDecompilerClassFileEditor.java:472)
    at org.eclipse.ui.texteditor.AbstractTextEditor.lambda$1(AbstractTextEditor.java:3136)
    at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:438)
    at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:354)
    at org.eclipse.ui.internal.WorkbenchWindow.lambda$4(WorkbenchWindow.java:2249)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:72)
    at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2247)
    at org.eclipse.ui.texteditor.AbstractTextEditor.internalInit(AbstractTextEditor.java:3153)
    at org.eclipse.ui.texteditor.AbstractTextEditor.init(AbstractTextEditor.java:3178)
    at org.eclipse.ui.internal.EditorReference.initialize(EditorReference.java:365)
    at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:345)
    at sun.reflect.GeneratedMethodAccessor74.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
    at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:1001)
    at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:966)
    at org.eclipse.e4.core.internal.di.InjectorImpl.internalInject(InjectorImpl.java:139)
    at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:411)
    at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:333)
    at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:202)
    at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:91)
    at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:60)
    at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:42)
    at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:132)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:1015)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:675)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:781)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$0(PartRenderingEngine.java:752)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:746)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:730)
    at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.showTab(StackRenderer.java:1295)
    at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer.lambda$0(LazyStackRenderer.java:75)
    at org.eclipse.e4.ui.services.internal.events.UIEventHandler.lambda$0(UIEventHandler.java:38)
    at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:236)
    at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:147)
    at org.eclipse.swt.widgets.Display.syncExec(Display.java:4580)
    at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:219)
    at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:38)
    at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:205)
    at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:203)
    at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:233)
    at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:151)
    at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:132)
    at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:75)
    at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:44)
    at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:55)
    at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:63)
    at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:424)
    at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElement(ElementContainerImpl.java:177)
    at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.showElementInWindow(ModelServiceImpl.java:652)
    at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.bringToTop(ModelServiceImpl.java:616)
    at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.delegateBringToTop(PartServiceImpl.java:791)
    at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.bringToTop(PartServiceImpl.java:404)
    at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.showPart(PartServiceImpl.java:1240)
    at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:3317)
    at org.eclipse.ui.internal.WorkbenchPage.lambda$9(WorkbenchPage.java:3216)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:72)
    at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3213)
    at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3177)
    at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3167)
    at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:376)
    at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:182)
    at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:287)
    at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:252)
    at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:274)
    at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:252)
    at org.eclipse.jdt.internal.ui.navigator.OpenAndExpand.run(OpenAndExpand.java:53)
    at org.eclipse.ui.actions.RetargetAction.run(RetargetAction.java:218)
    at org.eclipse.ui.navigator.CommonNavigatorManager$1.open(CommonNavigatorManager.java:183)
    at org.eclipse.ui.OpenAndLinkWithEditorHelper$InternalListener.open(OpenAndLinkWithEditorHelper.java:49)
    at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:853)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.ui.internal.JFaceUtil.lambda$0(JFaceUtil.java:47)
    at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:176)
    at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:850)
    at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1165)
    at org.eclipse.ui.navigator.CommonViewer.handleOpen(CommonViewer.java:454)
    at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:277)
    at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:272)
    at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:312)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4131)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1055)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3944)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3547)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1173)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1062)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
    at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:566)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:155)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:661)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:597)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1476)