2016-05-14 17 views
1

Eclipseプラグインの開発では、CompilationUnitEditor、という名前のカスタマイズされたソースビューア、IJavaEditorTextHoverを拡張するエディタをカスタマイズします。 はplugin.xmlので、私は自分のエディタのテキストホバーを作成するEclipseプラグインの開発でエディタのテキストホバーを作成できません

plugin.xml エラーとしてorg.eclipse.jdt.ui.javaEditorTextHoverの拡張機能を作成します。

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) 

答えて

1

CompilationUnitEditor内部パッケージである、あなたはそれを拡張してはならない(Eclipse API Rules of Engagementを参照してください)。

編集者は、ソースビューアが提供しているソースビューアではなくCompilationUnitEditor.AdaptedSourceViewerであることを期待しています。 AdaptedSourceViewerはパッケージプライベート内部クラスCompilationUnitEditorであるため、これを修正することはできません。

これを修正するにはhandlePreferenceStoreChangedを上書きしても問題ありません。

+0

ありがとう、私はJavaEditorを拡張するためにエディタを改訂し、 "メッセージはJavaテキストホバー を作成できませんでした" – csytang

関連する問題