使用代码自动打开Project Properties WIndow(Java Build Path)

时间:2013-11-20 10:40:51

标签: java eclipse-plugin buildpath

我正在开发一个Eclipse插件,它将创建一个新的Java项目,里面只有几个类。 插件向导关闭后(在最终页面中单击完成后),我需要自动打开此特定项目的“项目属性”窗口。

我必须通过代码实现这一点,请问任何例子吗?

2 个答案:

答案 0 :(得分:3)

我得到了最终答案。这是怎么回事:

Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
MessageDialog.openInformation(shell, "Project Proeperties", "Properties window will open next");

String propertyPageId = "org.eclipse.jdt.ui.propertyPages.BuildPathsPropertyPage";
PreferenceDialog dialog = PreferencesUtil.createPropertyDialogOn(shell, iProject, propertyPageId, null, null);
    dialog.open();

答案 1 :(得分:2)

使用org.eclipse.ui.dialogs.PreferencesUtil

PreferencesUtil.createPropertyDialogOn(shell, element, null, null, null).open();

将显示完整的Properties对话框。这些参数允许您选择初始页面并过滤显示的页面。

element参数将是项目的IProject

您可以使用Eclipse Search对话框找到现有属性页面ID。选择Plug-in Search标签,然后在org.eclipse.ui.propertyPages中输入属性页扩展点ID Search string。将Search For设置为Extension Point,将Limit To设置为References,将Scope设置为WorkspaceSearch dialog

执行搜索以获取使用此扩展点的插件。打开搜索结果将在扩展点打开插件的plugin.xml。

相关问题