开发者

How to add custom command to cheatsheet in eclipse

I want to add a custom command to my cheat sheet, I had make it work well, except when open the plugin.xml with Plug-in Manifest Editor, there is an error.

Here are the steps I used to implement the function:

1: Define custom command in 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: Add command to cheat sheet item.

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

Error message:

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

Exception Stack Trace:

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:12开发者_如何学运维33)
    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)


I assume (Cheat Sheet?) editor can't find the command because the defining plugin is not part of your target platform. If you export the plugin and add to your development platform, it should work fine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜