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( "" );

} catch( PartInitException e ) {

About this entry