2012-10-30 128 views
1

我編寫了一個簡單的Eclipse插件,編輯器擴展爲.myfile。 當我運行它時,我收到以下錯誤消息:無法打開編輯器錯誤

無法打開無法打開編輯器:編輯器類無法實例化。這通常表示缺少無參數構造函數,或者編輯器的類名稱在plugin.xml中輸入錯誤。

plugin.xml有這樣的聲明:

<plugin> 
    <extension point="org.eclipse.ui.editors"> 
     <editor  
      class="com.intel.editor.MyyEditor" 
      extensions="myfile" 
      icon="icons\sample.gif" 
      id="com.intel.editor.MyyEditor" 
      name="MyEditor"> 
     </editor> 
    </extension> 
</plugin> 

當我有public class MyyEditor extends EditorPart,我在日誌中看到的錯誤是:

java.lang.ClassNotFoundException: com.dal.editor.DalManifestEditor 
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513) 
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429) 
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417) 
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107) 
    at java.lang.ClassLoader.loadClass(Unknown Source) 
    at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:345) 
    at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:229) 
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1207) 
    at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:174) 
    at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:905) 
    at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243) 
    at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55) 
    at org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:260) 
    at org.eclipse.ui.internal.registry.EditorDescriptor.createEditor(EditorDescriptor.java:235) 
    at org.eclipse.ui.internal.EditorManager.createPart(EditorManager.java:875) 
    at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:609) 
    at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:465) 
    at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595) 
    at org.eclipse.ui.internal.EditorReference.getEditor(EditorReference.java:289) 
    at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2945) 
    at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2850) 
    at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2842) 
    at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2793) 
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) 
    at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2789) 
    at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2773) 
    at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2764) 
    at org.eclipse.ui.ide.IDE.openEditor(IDE.java:651) 
    at org.eclipse.ui.ide.IDE.openEditor(IDE.java:610) 
    at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:355) 
    at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:164) 
    at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:249) 
    at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:228) 
    at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:275) 
    at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:251) 
    at org.eclipse.jdt.internal.ui.packageview.PackageExplorerActionGroup.handleOpen(PackageExplorerActionGroup.java:376) 
    at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$4.open(PackageExplorerPart.java:538) 
    at org.eclipse.ui.OpenAndLinkWithEditorHelper$InternalListener.open(OpenAndLinkWithEditorHelper.java:48) 
    at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:866) 
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) 
    at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49) 
    at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175) 
    at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:864) 
    at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1152) 
    at org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1256) 
    at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:275) 
    at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:269) 
    at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:309) 
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) 
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053) 
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165) 
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754) 
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696) 
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660) 
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494) 
    at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674) 
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) 
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667) 
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) 
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123) 
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) 
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) 
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) 
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344) 
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
    at java.lang.reflect.Method.invoke(Unknown Source) 
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622) 
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577) 
    at org.eclipse.equinox.launcher.Main.run(Main.java:1410) 
    at org.eclipse.equinox.launcher.Main.main(Main.java:1386) 
+0

已經解決了問題? –

回答

0

檢查兩件事情:

  • 你shuold有一個默認的構造函數在MyyEditor班。
  • 你有沒有在日誌中的錯誤?用戶界面中的錯誤消息後是否有「詳細信息」按鈕?單擊時是否顯示堆棧跟蹤?
+0

我有這樣的顧問 – user758795

相關問題