Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipse-dev] How can I extend the context menu of the Java Editor?

Hi,

I am new to Eclipse but I already love it! I would love it even more, when I
could extend the context menu of the Java Editor. I already successfully
extended the context menu of the Navigator View and I thought that the Java
Editor would be as easy to deal with. But it does not work.

Here is the plugin.xml:
....
<extension point="org.eclipse.ui.popupMenus">
    <viewerContribution
        id="de.seebergers.eclipse.jdt.jindent.viewerContribution"
        targetID="org.eclipse.jdt.ui.CompilationUnitEditor">
        <action
            id="de.seebergers.eclipse.jdt.jindent.editorAction"
            label="Jindent"
            class="de.seebergers.eclipse.jdt.jindent.JindentEditorAction"
            menubarPath="additions">
        </action>
    </viewerContribution>
    <objectContribution
        id="de.seebergers.eclipse.jdt.jindent.objectContribution"
        objectClass="org.eclipse.core.resources.IFile"
        nameFilter="*.java">
        <filter
            name="projectNature"
            value="org.eclipse.jdt.core.javanature">
        </filter>
        <action
            id="de.seebergers.eclipse.jdt.jindent.objectAction"
            label="Jindent"
            class="de.seebergers.eclipse.jdt.jindent.JindentObjectAction"
            menubarPath="additions">
        </action>
    </objectContribution>
</extension>
....

As mentioned the objectContribution works fine, but the viewerContribution
does not work. When the context menu pops up there is no "Jindent" entry as
I
would expect.

Could anyone please help me?
Thanks!

Regards
Heiko



Back to the top