首页 文章

eclipse插件开发 - 右键单击首选项菜单?

提问于
浏览
1

我正在开发eclipse插件 . 右键单击并在我的编辑器插件中选择“首选项”时,它会显示带有2个子树项的日食“常规”树项 - “外观”和“编辑器” . 在“编辑器”下,选择了另一个树项“文本编辑器” .

当我在plugin.xml中声明的项目右键单击'preferences'作为“org.eclipse.ui.preferencePages”的扩展点时,如何更改要显示的行为?

谢谢,Tomer

1 回答

  • 2

    这取决于您的编辑器派生自哪个类 . 如果它是从 org.eclipse.ui.texteditor.AbstractDecoratedTextEditor 或其众多子类之一派生的,那么您可以覆盖 collectContextMenuPreferencePages . 默认值为:

    /**
     * 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", 
            };
    }
    

相关问题