如何在eclipse中向cheatsheet添加自定义命令

时间:2010-11-18 08:53:28

标签: eclipse

我想在我的备忘单中添加一个自定义命令,我已经让它运行良好,除非使用Plug-in Manifest Editor打开plugin.xml,否则会出错。

以下是我用来实现该功能的步骤:

1:在plugin.xml中定义自定义命令。

<extension
     point="org.eclipse.ui.commands">
  <category
        id="com.ting.commands.category"
        name="Custom Category">
  </category>
  <command
        categoryId="com.ting.commands.category"
        defaultHandler="com.ting.commands.ExampleCommandHandler"
        description="Example Command"
        id="com.ting.commands.exampleCommand"
        name="Custom commands">
  </command>  

2:向作弊表项添加命令。

 <item
      title="Example cheat sheet item">
   <description>
   Example item description
   </description>
   <command
         required="false"
         serialization="com.ting.commands.exampleCommand"/>
</item>

错误讯息:

Message : Failed to deserialize command: com.ting.commands.ExampleCommandHandler

异常堆栈跟踪:

org.eclipse.core.commands.common.NotDefinedException: Cannot get the parameters from an undefined command. com.ting.commands.ExampleCommandHandler
    at org.eclipse.core.commands.Command.getParameters(Command.java:759)
    at org.eclipse.core.commands.CommandManager.deserialize(CommandManager.java:464)
    at org.eclipse.ui.internal.commands.CommandService.deserialize(CommandService.java:112)
    at org.eclipse.pde.internal.ua.ui.editor.cheatsheet.simple.details.SimpleCSCommandDetails.getParameterizedCommand(SimpleCSCommandDetails.java:447)
    at org.eclipse.pde.internal.ua.ui.editor.cheatsheet.simple.details.SimpleCSCommandDetails.getParameterizedCommand(SimpleCSCommandDetails.java:469)
    at org.eclipse.pde.internal.ua.ui.editor.cheatsheet.simple.details.SimpleCSCommandDetails.updateFields(SimpleCSCommandDetails.java:286)
    at org.eclipse.pde.internal.ua.ui.editor.cheatsheet.simple.details.SimpleCSItemDetails.updateFields(SimpleCSItemDetails.java:277)
    at org.eclipse.pde.internal.ua.ui.editor.cheatsheet.simple.details.SimpleCSItemDetails.selectionChanged(SimpleCSItemDetails.java:368)
    at org.eclipse.ui.forms.DetailsPart$1.run(DetailsPart.java:274)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    at org.eclipse.ui.forms.DetailsPart.showPage(DetailsPart.java:261)
    at org.eclipse.ui.forms.DetailsPart.update(DetailsPart.java:234)
    at org.eclipse.ui.forms.DetailsPart.selectionChanged(DetailsPart.java:219)
    at org.eclipse.ui.forms.ManagedForm.fireSelectionChanged(ManagedForm.java:148)
    at org.eclipse.pde.internal.ui.editor.TreeSection$PartAdapter.selectionChanged(TreeSection.java:32)
    at org.eclipse.pde.internal.ui.parts.TreePart$1.selectionChanged(TreePart.java:45)
    at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java:162)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.runtime.Platform.run(Platform.java:888)
    at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:48)
    at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
    at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:160)
    at org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:2132)
    at org.eclipse.jface.viewers.StructuredViewer.setSelection(StructuredViewer.java:1669)
    at org.eclipse.jface.viewers.TreeViewer.setSelection(TreeViewer.java:1124)
    at org.eclipse.pde.internal.ua.ui.editor.cheatsheet.simple.SimpleCSMasterTreeSection.setFormInput(SimpleCSMasterTreeSection.java:1233)
    at org.eclipse.pde.internal.ua.ui.editor.cheatsheet.simple.SimpleCSDefinitionPage.setActive(SimpleCSDefinitionPage.java:207)
    at org.eclipse.ui.forms.editor.FormEditor.pageChange(FormEditor.java:480)
    at org.eclipse.pde.internal.ui.editor.PDEFormEditor.pageChange(PDEFormEditor.java:262)
    at org.eclipse.ui.part.MultiPageEditorPart$2.widgetSelected(MultiPageEditorPart.java:291)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:228)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1176)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1200)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1185)
    at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1025)
    at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:3256)
    at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:2045)
    at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:323)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1176)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3493)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3112)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
    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:368)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:592)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1287)

1 个答案:

答案 0 :(得分:0)

我假设(Cheat Sheet?)编辑器找不到该命令,因为定义插件不是目标平台的一部分。如果您导出插件并添加到开发平台,它应该可以正常工作。