eclipse plugin development - right click preferences menu?

358 Views Asked by At

I'm developing eclipse plugin. When right clicking and chose 'preferences' in my editor plugin it shows the eclipse 'General' tree item with 2 sub tree items - 'Appearance' & 'Editors'. Under 'Editors' there another tree item 'Text Editors' which is selected.

How do I change the behavior to show when right clicking 'preferences' the items which I declared in the plugin.xml as extension point of "org.eclipse.ui.preferencePages" ?

Thanks, Tomer

1

There are 1 best solutions below

1
On BEST ANSWER

This depends on what class your editor is derived from. If it is derived from org.eclipse.ui.texteditor.AbstractDecoratedTextEditor or one of its many subclasses then you can override collectContextMenuPreferencePages. The default for this is:

/**
 * Returns the preference page ids of the preference pages to be shown when executing the
 * preferences action from the editor context menu. The first page will be selected.
 * <p>
 * Subclasses may extend or replace.
 * </p>
 * 
 * @return the preference page ids to show, may be empty
 */
protected String[] collectContextMenuPreferencePages() {
    return new String[] { "org.eclipse.ui.preferencePages.GeneralTextEditor",
            "org.eclipse.ui.editors.preferencePages.Annotations", 
            "org.eclipse.ui.editors.preferencePages.QuickDiff", 
            "org.eclipse.ui.editors.preferencePages.Accessibility", 
            "org.eclipse.ui.editors.preferencePages.Spelling", 
            "org.eclipse.ui.editors.preferencePages.LinkedModePreferencePage", 
            "org.eclipse.ui.preferencePages.ColorsAndFonts", 
        };
}