Select a specific tab in Eclipse tabbed properties

When developing tools in Eclipse, it often happens you have to display the properties of an element in the Eclipse properties view.

When this property view is a tabbed properties view, you may also want to select a specific tab to show some properties of the seleted element. This is how to do it.

try {
	// Show the properties page
	IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
	IViewPart view = page.showView( "org.eclipse.ui.views.PropertySheet" );

	// Display a specific tab
	TabbedPropertySheetPage tpPage = (TabbedPropertySheetPage) view.getAdapter( TabbedPropertySheetPage.class );
	if( tpPage != null )
		tpPage.setSelectedTab( "your.tab.id" );

} catch( PartInitException e ) {
	e.printStackTrace();
}

One thought on “Select a specific tab in Eclipse tabbed properties

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s