/**
  * Set the currently selected tab to be that of the provided tab id.
  *
  * @param id The string id of the tab to select.
  * @since 3.5
  */
 public void setSelectedTab(final String id) {
   final List elements = tabbedPropertyViewer.getElements();
   if (elements != null && elements.size() > 0) {
     for (final Iterator i = elements.iterator(); i.hasNext(); ) {
       final ITabDescriptor tabDescriptor = (ITabDescriptor) i.next();
       if (tabDescriptor.getId() != null && tabDescriptor.getId().equals(id)) {
         tabbedPropertyViewer.setSelection(new StructuredSelection(tabDescriptor), true);
       }
     }
   }
 }
    /** Shows the tab associated with the selection. */
    public void selectionChanged(final SelectionChangedEvent event) {
      final IStructuredSelection selection = (IStructuredSelection) event.getSelection();
      TabContents tab = null;
      final ITabDescriptor descriptor = (ITabDescriptor) selection.getFirstElement();

      if (descriptor == null) {
        // pretend the tab is empty.
        hideTab(currentTab);
      } else {
        // create tab if necessary
        // can not cache based on the id - tabs may have the same id,
        // but different section depending on the selection
        tab = (TabContents) descriptorToTab.get(descriptor);

        if (tab != currentTab) {
          hideTab(currentTab);
        }

        Composite tabComposite = (Composite) tabToComposite.get(tab);
        if (tabComposite == null) {
          tabComposite = createTabComposite();
          tab.createControls(tabComposite, TabbedPropertySheetPage.this);
          // tabAreaComposite.layout(true);
          tabToComposite.put(tab, tabComposite);
        }
        // force widgets to be resized
        tab.setInput(
            tabbedPropertyViewer.getWorkbenchPart(), (ISelection) tabbedPropertyViewer.getInput());

        // store tab selection
        storeCurrentTabSelection(descriptor.getLabel());

        if (tab != currentTab) {
          showTab(tab);
        }

        tab.refresh();
      }
      tabbedPropertyComposite.getTabComposite().layout(true);
      currentTab = tab;
      resizeScrolledComposite();

      if (descriptor != null) {
        handleTabSelection(descriptor);
      }
    }
 /**
  * Create the tab contents for the provided tab descriptor.
  *
  * @param tabDescriptor the tab descriptor.
  * @return the tab contents.
  * @since 3.4
  */
 protected TabContents createTab(final ITabDescriptor tabDescriptor) {
   return tabDescriptor.createTab();
 }