Java eclipse插件开发-右键单击首选项菜单?
我正在开发eclipse插件。 当右键单击并在我的编辑器插件中选择“preferences”时,它将显示eclipse“General”树项,其中包含两个子树项-“外观”和“编辑器”。 在“编辑器”下,选择了另一个树项“文本编辑器” 当右键单击plugin.xml中声明为“org.eclipse.ui.preferencePages”扩展点的“preferences”项目时,如何更改显示的行为Java eclipse插件开发-右键单击首选项菜单?,java,eclipse,eclipse-plugin,eclipse-rcp,plugin.xml,Java,Eclipse,Eclipse Plugin,Eclipse Rcp,Plugin.xml,我正在开发eclipse插件。 当右键单击并在我的编辑器插件中选择“preferences”时,它将显示eclipse“General”树项,其中包含两个子树项-“外观”和“编辑器”。 在“编辑器”下,选择了另一个树项“文本编辑器” 当右键单击plugin.xml中声明为“org.eclipse.ui.preferencePages”扩展点的“preferences”项目时,如何更改显示的行为 谢谢,这取决于你的编辑器是从哪个类派生的。如果它派生自org.eclipse.ui.textedito
谢谢,这取决于你的编辑器是从哪个类派生的。如果它派生自
org.eclipse.ui.texteditor.AbstractDecoratedTextEditor
或其众多子类之一,则可以重写CollectContextMenuPreferencePage
。默认设置为:
/**
* 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",
};
}
/**
*返回执行时要显示的首选项页的首选项页ID
*“编辑器”上下文菜单中的“首选项”操作。将选择第一页。
*
*子类可以扩展或替换。
*
*
*@返回要显示的首选项页面ID,可能为空
*/
受保护的字符串[]collectContextMenuPreferencePages(){
返回新字符串[]{“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”,
};
}
是。它扩展了org.eclipse.ui.editors.text.TextEditor,后者扩展了AbstractDecoratedTextEditor