2

I am developing an Eclipse plugin which would create a new Java project and few classes inside it. Once the plugin wizard closes (after I click finish in the final page), i need the Project Properties window of this particular project to be opened automatically.

I must achieve that through code, any examples please?

uma
  • 327
  • 2
  • 19

2 Answers2

3

Use org.eclipse.ui.dialogs.PreferencesUtil

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

will display the full Properties dialog. The parameters allow you to choose the initial page and filter the pages shown.

The element parameter would be the IProject for the project.

You can find existing property page ids using the Eclipse Search dialog. Select the Plug-in Search tab and enter the property page extension point id org.eclipse.ui.propertyPages in the Search string. Set Search For to Extension Point, set Limit To to References and Scope to Workspace. Search dialog

Perform the search to get the plug-ins which use this extension point. Opening a search result will open the plugin.xml for the plugin at the extension point.

greg-449
  • 109,219
  • 232
  • 102
  • 145
  • do you have any idea of how to get this **propertyPageId** please. For example, to open the _Run/Debug settings under Project Properties_, we define `String propertyPageId = "org.eclipse.debug.ui.properties.defaultLaunchConfigurations";` Likewise what must be the propertyPageId value to open the _BuildPath_ settings. I tried to find out, but couldnt. Thanks – uma Nov 21 '13 at 05:06
  • Once I get this propertyPageId, as greg says, my code would go like, `PreferenceDialog dialog = PreferencesUtil.createPropertyDialogOn(shell, project, propertyPageId, null, null); return dialog.open();` Waiting for the answer friends. – uma Nov 21 '13 at 05:18
  • Java Build Paths property page is `org.eclipse.jdt.ui.propertyPages.BuildPathsPropertyPage` – greg-449 Nov 21 '13 at 07:51
3

I got the final answer. This is how it goes:

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();
uma
  • 327
  • 2
  • 19