2016-05-14 11 views
1

in Eclipse Plugin-Entwicklung erstellen, ich customerize einen Editor, der die CompilationUnitEditor, eine angepasste Quelle Betrachter CLRJavaSourceViewer, die IJavaEditorTextHover implementiert genannt erstreckt. Im plugin.xml, erstelle ich eine Erweiterung auf org.eclipse.jdt.ui.javaEditorTextHover alsText kann nicht schweben für mein Editor in Eclipse Plugin-Entwicklung

plugin.xml Fehler in einem Text Hover für meinen eigenen Editor zu erstellen.

java.lang.ClassCastException: loongplugin.editor.viewer.CLRJavaSourceViewer cannot be cast to org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewer 
    at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.handlePreferenceStoreChanged(CompilationUnitEditor.java:1573) 
    at org.eclipse.ui.texteditor.AbstractTextEditor$PropertyChangeListener.propertyChange(AbstractTextEditor.java:715) 
    at org.eclipse.ui.texteditor.ChainedPreferenceStore.firePropertyChangeEvent(ChainedPreferenceStore.java:164) 
    at org.eclipse.ui.texteditor.ChainedPreferenceStore.handlePropertyChangeEvent(ChainedPreferenceStore.java:431) 
    at org.eclipse.ui.texteditor.ChainedPreferenceStore.access$0(ChainedPreferenceStore.java:408) 
    at org.eclipse.ui.texteditor.ChainedPreferenceStore$PropertyChangeListener.propertyChange(ChainedPreferenceStore.java:69) 
    at org.eclipse.ui.preferences.ScopedPreferenceStore$3.run(ScopedPreferenceStore.java:382) 
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) 
    at org.eclipse.ui.preferences.ScopedPreferenceStore.firePropertyChangeEvent(ScopedPreferenceStore.java:378) 
    at org.eclipse.ui.preferences.ScopedPreferenceStore$2.preferenceChange(ScopedPreferenceStore.java:197) 
    at org.eclipse.core.internal.preferences.EclipsePreferences$3.run(EclipsePreferences.java:896) 
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) 
    at org.eclipse.core.internal.preferences.EclipsePreferences.firePreferenceEvent(EclipsePreferences.java:899) 
    at org.eclipse.core.internal.preferences.EclipsePreferences.put(EclipsePreferences.java:912) 
    at org.eclipse.ui.preferences.ScopedPreferenceStore.setValue(ScopedPreferenceStore.java:824) 
    at org.eclipse.jdt.internal.ui.preferences.OverlayPreferenceStore.propagateProperty(OverlayPreferenceStore.java:139) 
    at org.eclipse.jdt.internal.ui.preferences.OverlayPreferenceStore.propagate(OverlayPreferenceStore.java:146) 
    at org.eclipse.jdt.internal.ui.preferences.AbstractConfigurationBlockPreferencePage.performOk(AbstractConfigurationBlockPreferencePage.java:98) 
    at org.eclipse.jface.preference.PreferenceDialog$12.run(PreferenceDialog.java:992) 
    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:178) 
    at org.eclipse.jface.preference.PreferenceDialog.okPressed(PreferenceDialog.java:971) 
    at org.eclipse.ui.internal.dialogs.FilteredPreferenceDialog.okPressed(FilteredPreferenceDialog.java:460) 
    at org.eclipse.ui.internal.dialogs.WorkbenchPreferenceDialog.okPressed(WorkbenchPreferenceDialog.java:174) 
    at org.eclipse.jface.preference.PreferenceDialog.buttonPressed(PreferenceDialog.java:236) 
    at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:619) 
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248) 
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) 
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4188) 
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1467) 
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1490) 
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1475) 
    at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1279) 
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4031) 
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3658) 
    at org.eclipse.jface.window.Window.runEventLoop(Window.java:832) 
    at org.eclipse.jface.window.Window.open(Window.java:808) 
    at org.eclipse.ui.internal.dialogs.WorkbenchPreferenceDialog.open(WorkbenchPreferenceDialog.java:221) 
    at org.eclipse.ui.texteditor.AbstractDecoratedTextEditor$9.run(AbstractDecoratedTextEditor.java:1259) 
    at org.eclipse.jface.action.Action.runWithEvent(Action.java:519) 
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:595) 
    at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:511) 
    at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:420) 
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) 
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4188) 
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1467) 
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1490) 
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1475) 
    at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1279) 
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4031) 
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3658) 
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151) 
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) 
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032) 
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148) 
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636) 
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) 
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579) 
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150) 
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135) 
    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:382) 
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:236) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:606) 
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648) 
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603) 
    at org.eclipse.equinox.launcher.Main.run(Main.java:1465) 
    at org.eclipse.equinox.launcher.Main.main(Main.java:1438) 

Antwort

1

CompilationUnitEditor ist in einem internen Paket, sollten Sie es nicht (siehe Eclipse API Rules of Engagement) werden erstreckt.

Der Editor erwartet, dass der Quellviewer CompilationUnitEditor.AdaptedSourceViewer nicht der Quellviewer ist, den Sie bereitstellen. Seit AdaptedSourceViewer ist ein Paket private innere Klasse von CompilationUnitEditor Sie können das nicht beheben.

Sie könnten versuchen, handlePreferenceStoreChanged zu überschreiben, dies zu beheben, aber weitere Probleme erwarten.

+0

Danke, ich überarbeite den Editor, um JavaEditor zu erweitern, dann bekam ich "MESSAGE Konnte keinen Java-Text erzeugen Hover " Fehler – csytang