- This topic has 8 replies, 3 voices, and was last updated 19 years, 10 months ago by David Biesack.
-
AuthorPosts
-
David BiesackMemberI’ve written an Eclipse Plugin which works in the Java editor, XML editor, and other text editors. This plugin adds new menuitems to the context menu. But it does not work in the MyEclipse JSP editor. Does anyone know what viewerContribution context I need to use to make this plugin work here?
Note: I tried to copy what the IBM Snippet plugin does when it registers the Add to Snippets… action against org.eclipse.ui.popupMenus, but this does not work and I don’t know why. For example, I added viewerContributions to the following contexts:
-
targetID=”#TextEditorContext”
targetID=”#StructuredTextEditorContext”
targetID=”#CompilationUnitEditorContext”
targetID=”#QEVJavaEditorContext”but apparently none of these match the MyEclipse JSP editor.
See also https://bugs.eclipse.org/bugs/show_bug.cgi?id=36968
Riyad KallaMemberDavid,
I will ask one of our devs to have a look at this, hang in there.
Scott AndersonParticipantDavid,
You should be able to add context menu actions to all our editors with something like the following:
<extension point="com.ibm.sse.editor.extendedEditorActions"> <editorContribution targetID="com.ibm.sse.editor.StructuredTextEditor" id="your-id"> <action popupmenuPath="group.add" class="your-class" id="your-action-id"> </action> </editorContribution> </extension>
David BiesackMemberI tried this and my extension still does not show up in any of the MyEclipse editors (JSP, XML, TLD, etc.), only in the Java editor or plain text editors.
Here are some extracts from my plugin.xml, the first showing the plian text editor context that works, the second the com.ibm.sse.editor.extendedEditorActions extension as suggested by Scott :
<extension point="org.eclipse.ui.popupMenus"> <viewerContribution targetID="#TextEditorContext" <!-- other contexts also; see original post --> id="com.sas.tools.eclipse.editor.popup.actions.editor1"> <action label="Filter" tooltip="Run a filter over the selected text, replacing text with the filter output" class="com.sas.tools.eclipse.editor.enhancements.popup.actions.FilterAction" icon="icons/filter.gif" menubarPath="group.add" id="com.sas.tools.eclipse.editor.enhancements.popup.actions.FilterAction"> </action> </viewerContribution> </extension> <extension point="com.ibm.sse.editor.extendedEditorActions"> <editorContribution targetID="com.ibm.sse.editor.StructuredTextEditor" id="com.sas.tools.eclipse.editor.popup.actions.editor1"> <action label="Filter" tooltip="Run a filter over the selected text, replacing text with the filter output" class="com.sas.tools.eclipse.editor.enhancements.popup.actions.FilterAction" icon="icons/filter.gif" popupmenuPath="group.add" id="com.sas.tools.eclipse.editor.enhancements.popup.actions.FilterAction"> </action> </editorContribution> </extension>
Any other ideas? Any pointers to some source that
Scott AndersonParticipantDavid,
I opened the plugin.xml file we ship in the com.ibm.sse.editor plugin and found the area where the extension that adds the Preferences… item for the editor context menu is contributed. For a test, I duplicated the extension contribution and gave it new IDs and a new label like this:
<extension point="com.ibm.sse.editor.extendedEditorActions"> <editorContribution targetID="com.ibm.sse.editor.StructuredTextEditor" id="com.ibm.sse.editor.extendedActions2"> <action popupmenuPath="group.add" label="Preferences2" class="com.ibm.sse.editor.preferences.ui.EditStructuredTextEditorPreferencesAction" id="com.ibm.sse.editor.preferences.ui.EditStructuredTextEditorPreferencesAction2"> </action> </editorContribution> </extension>
When I ran the workbench, I had two preference menus, one labeled Preferences2, as expected. You didn’t mention if you’re running in the PDE or standalone, but in either case I’d recommend clearing the configuration area before testing again, just to be sure that Eclipse isn’t caching anything on you.
David BiesackMemberThanks. I was able to resolve my problem. I added the above Preferences2 to my plugin.xml and it was not showing up, so I was able to track down why my plugins were not being loaded correctly; my dependencies were incomplete and I added the sse plugin to my plugin’s dependencies.
Scott AndersonParticipantDavid,
That’s certainly good news. Of course, you might want to add the dependency as optional in case someone wants to use your plugins without MyEclipse installed also. If you don’t, MyEclipse will be a “hard” prerequisite and that might not be what you want.
Riyad KallaMemberIf you don’t, MyEclipse will be a “hard” prerequisite and that might not be what you want.
Why not? I think it is a good idea, be sure to include a link to our “Buy” page 😛
David BiesackMemberAs followup, the root of my problem was that the IBM com.ibm.sse.editor structured source editor is not compatible
with the default Eclipse text editor. I had followed a tutorial for writing a plugin that I found the eclipse site; it won’t
work for SSE. It uses a class that implements org.eclipse.ui.IEditorActionDelegate. For SSE, one must implement
a class that extends org.eclipse.jface.action.Action and implements com.ibm.sse.editor.extension.IExtendedEditorActionUnfortunately, SSE does not throw an exception when a plugin.xml defines an extension that does not implement
the necessary interface. I’ll submit an Eclipse Web Tools bug for this. -
AuthorPosts