1

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

Tomer.Epstein
  • 269
  • 1
  • 3
  • 10

1 Answers1

2

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", 
        };
}
greg-449
  • 109,219
  • 232
  • 102
  • 145