org.eclipse.ui.views.properties.tabbed_3.5.200.v20110928-1505

tors(IWorkbenchPart paramIWorkbenchPart, ISelection paramISelection);
}

/* Location:
 * Qualified Name:     org.eclipse.ui.views.properties.tabbed.ITabDescriptorProvider
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.views.properties.tabbed;

import org.eclipse.swt.graphics.Image;

public abstract interface ITabItem
{
  public abstract Image getImage();
  
  public abstract String getText();
  
  public abstract boolean isSelected();
  
  public abstract boolean isIndented();
}

/* Location:
 * Qualified Name:     org.eclipse.ui.views.properties.tabbed.ITabItem
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.views.properties.tabbed;

public abstract interface ITabSelectionListener
{
  public abstract void tabSelected(ITabDescriptor paramITabDescriptor);
}

/* Location:
 * Qualified Name:     org.eclipse.ui.views.properties.tabbed.ITabSelectionListener
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.views.properties.tabbed;

public abstract interface ITabbedPropertyConstants
{
  public static final int HMARGIN = 6;
  public static final int VMARGIN = 6;
  public static final int HSPACE = 5;
  public static final int VSPACE = 4;
  public static final int CENTER_SPACE = 10;
}

/* Location:
 * Qualified Name:     org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.views.properties.tabbed;

public abstract interface ITabbedPropertySheetPageContributor
{
  public abstract String getContributorId();
}

/* Location:
 * Qualified Name:     org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.views.properties.tabbed;

public abstract interface ITypeMapper
{
  public abstract Class mapType(Object paramObject);
}

/* Location:
 * Qualified Name:     org.eclipse.ui.views.properties.tabbed.ITypeMapper
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.views.properties.tabbed;

import org.eclipse.jface.util.SafeRunnable;
import org.eclipse.swt.widgets.Composite;

class TabContents$1
  extends SafeRunnable
{
  final TabContents this$0;
  private final ISection val$section;
  private final Composite val$sectionComposite;
  private final TabbedPropertySheetPage val$page;
  
  TabContents$1(TabContents paramTabContents, ISection paramISection, Composite paramComposite, TabbedPropertySheetPage paramTabbedPropertySheetPage)
  {
    this$0 = paramTabContents;val$section = paramISection;val$sectionComposite = paramComposite;val$page = paramTabbedPropertySheetPage;
  }
  
  public void run()
    throws Exception
  {
    val$section.createControls(val$sectionComposite, val$page);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.views.properties.tabbed.TabContents.1
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.views.properties.tabbed;

import org.eclipse.jface.util.SafeRunnable;

class TabContents$2
  extends SafeRunnable
{
  final TabContents this$0;
  private final ISection val$section;
  
  TabContents$2(TabContents paramTabContents, ISection paramISection)
  {
    this$0 = paramTabContents;val$section = paramISection;
  }
  
  public void run()
    throws Exception
  {
    val$section.dispose();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.views.properties.tabbed.TabContents.2
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.views.properties.tabbed;

import org.eclipse.jface.util.SafeRunnable;

class TabContents$3
  extends SafeRunnable
{
  final TabContents this$0;
  private final ISection val$section;
  
  TabContents$3(TabContents paramTabContents, ISection paramISection)
  {
    this$0 = paramTabContents;val$section = paramISection;
  }
  
  public void run()
    throws Exception
  {
    val$section.aboutToBeShown();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.views.properties.tabbed.TabContents.3
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.views.properties.tabbed;

import org.eclipse.jface.util.SafeRunnable;

class TabContents$4
  extends SafeRunnable
{
  final TabContents this$0;
  private final ISection val$section;
  
  TabContents$4(TabContents paramTabContents, ISection paramISection)
  {
    this$0 = paramTabContents;val$section = paramISection;
  }
  
  public void run()
    throws Exception
  {
    val$section.aboutToBeHidden();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.views.properties.tabbed.TabContents.4
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.views.properties.tabbed;

import org.eclipse.jface.util.SafeRunnable;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IWorkbenchPart;

class TabContents$5
  extends SafeRunnable
{
  final TabContents this$0;
  private final ISection val$section;
  private final IWorkbenchPart val$part;
  private final ISelection val$selection;
  
  TabContents$5(TabContents paramTabContents, ISection paramISection, IWorkbenchPart paramIWorkbenchPart, ISelection paramISelection)
  {
    this$0 = paramTabContents;val$section = paramISection;val$part = paramIWorkbenchPart;val$selection = paramISelection;
  }
  
  public void run()
    throws Exception
  {
    val$section.setInput(val$part, val$selection);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.views.properties.tabbed.TabContents.5
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.views.properties.tabbed;

import org.eclipse.jface.util.SafeRunnable;

class TabContents$6
  extends SafeRunnable
{
  final TabContents this$0;
  private final ISection val$section;
  
  TabContents$6(TabContents paramTabContents, ISection paramISection)
  {
    this$0 = paramTabContents;val$section = paramISection;
  }
  
  public void run()
    throws Exception
  {
    val$section.refresh();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.views.properties.tabbed.TabContents.6
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.views.properties.tabbed;

import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.jface.util.SafeRunnable;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IWorkbenchPart;

public final class TabContents
{
  private ISection[] sections;
  private boolean controlsCreated;
  
  public TabContents()
  {
    controlsCreated = false;
  }
  
  public int getSectionIndex(ISection section)
  {
    for (int i = 0; i < sections.length; i++) {
      if (section == sections[i]) {
        return i;
      }
    }
    return -1;
  }
  
  public ISection getSectionAtIndex(int i)
  {
    if ((i >= 0) && (i < sections.length)) {
      return sections[i];
    }
    return null;
  }
  
  public ISection[] getSections()
  {
    return sections;
  }
  
  public void createControls(Composite parent, TabbedPropertySheetPage page)
  {
    Composite pageComposite = page.getWidgetFactory().createComposite(
      parent, 524288);
    GridLayout layout = new GridLayout();
    marginWidth = 0;
    marginHeight = 0;
    verticalSpacing = 0;
    pageComposite.setLayout(layout);
    for (int i = 0; i < sections.length; i++)
    {
      ISection section = sections[i];
      Composite sectionComposite = page.getWidgetFactory()
        .createComposite(pageComposite, 524288);
      sectionComposite.setLayout(new FillLayout());
      int style = section.shouldUseExtraSpace() ? 1808 : 
        768;
      GridData data = new GridData(style);
      heightHint = section.getMinimumHeight();
      sectionComposite.setLayoutData(data);
      
      ISafeRunnable runnable = new SafeRunnable()
      {
        private final ISection val$section;
        private final Composite val$sectionComposite;
        private final TabbedPropertySheetPage val$page;
        
        public void run()
          throws Exception
        {
          val$section.createControls(val$sectionComposite, val$page);
        }
      };
      SafeRunnable.run(runnable);
    }
    controlsCreated = true;
  }
  
  public void dispose()
  {
    for (int i = 0; i < sections.length; i++)
    {
      ISection section = sections[i];
      ISafeRunnable runnable = new SafeRunnable()
      {
        private final ISection val$section;
        
        public void run()
          throws Exception
        {
          val$section.dispose();
        }
      };
      SafeRunnable.run(runnable);
    }
  }
  
  public void aboutToBeShown()
  {
    for (int i = 0; i < sections.length; i++)
    {
      ISection section = sections[i];
      ISafeRunnable runnable = new SafeRunnable()
      {
        private final ISection val$section;
        
        public void run()
          throws Exception
        {
          val$section.aboutToBeShown();
        }
      };
      SafeRunnable.run(runnable);
    }
  }
  
  public void aboutToBeHidden()
  {
    for (int i = 0; i < sections.length; i++)
    {
      ISection section = sections[i];
      ISafeRunnable runnable = new SafeRunnable()
      {
        private final ISection val$section;
        
        public void run()
          throws Exception
        {
          val$section.aboutToBeHidden();
        }
      };
      SafeRunnable.run(runnable);
    }
  }
  
  public void setInput(IWorkbenchPart part, ISelection selection)
  {
    for (int i = 0; i < sections.length; i++)
    {
      ISection section = sections[i];
      ISafeRunnable runnable = new SafeRunnable()
      {
        private final ISection val$section;
        private final IWorkbenchPart val$part;
        private final ISelection val$selection;
        
        public void run()
          throws Exception
        {
          val$section.setInput(val$part, val$selection);
        }
      };
      SafeRunnable.run(runnable);
    }
  }
  
  public void setSections(ISection[] sections)
  {
    this.sections = sections;
  }
  
  public boolean controlsHaveBeenCreated()
  {
    return controlsCreated;
  }
  
  public void refresh()
  {
    if (controlsCreated) {
      for (int i = 0; i < sections.length; i++)
      {
        ISection section = sections[i];
        ISafeRunnable runnable = new SafeRunnable()
        {
          private final ISection val$section;
          
          public void run()
            throws Exception
          {
            val$section.refresh();
          }
        };
        SafeRunnable.run(runnable);
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.views.properties.tabbed.TabContents
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.views.properties.tabbed;

import org.eclipse.ui.IPartListener;
import org.eclipse.ui.IWorkbenchPart;

class TabbedPropertySheetPage$1
  implements IPartListener
{
  final TabbedPropertySheetPage this$0;
  
  TabbedPropertySheetPage$1(TabbedPropertySheetPage paramTabbedPropertySheetPage)
  {
    this$0 = paramTabbedPropertySheetPage;
  }
  
  public void partActivated(IWorkbenchPart part)
  {
    this$0.handlePartActivated(part);
  }
  
  public void partBroughtToTop(IWorkbenchPart part) {}
  
  public void partClosed(IWorkbenchPart part) {}
  
  public void partDeactivated(IWorkbenchPart part) {}
  
  public void partOpened(IWorkbenchPart part) {}
}

/* Location:
 * Qualified Name:     org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage.1
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.views.properties.tabbed;

import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;

class TabbedPropertySheetPage$2
  extends ControlAdapter
{
  final TabbedPropertySheetPage this$0;
  
  TabbedPropertySheetPage$2(TabbedPropertySheetPage paramTabbedPropertySheetPage)
  {
    this$0 = paramTabbedPropertySheetPage;
  }
  
  public void controlResized(ControlEvent e)
  {
    this$0.resizeScrolledComposite();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage.2
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.views.properties.tabbed;

import java.util.Map;
import org.eclipse.jface.viewers.ContentViewer;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyComposite;
import org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyViewer;

class TabbedPropertySheetPage$SelectionChangedListener
  implements ISelectionChangedListener
{
  final TabbedPropertySheetPage this$0;
  
  TabbedPropertySheetPage$SelectionChangedListener(TabbedPropertySheetPage paramTabbedPropertySheetPage)
  {
    this$0 = paramTabbedPropertySheetPage;
  }
  
  public void selectionChanged(SelectionChangedEvent event)
  {
    IStructuredSelection selection = (IStructuredSelection)event
      .getSelection();
    TabContents tab = null;
    ITabDescriptor descriptor = (ITabDescriptor)selection
      .getFirstElement();
    if (descriptor == null)
    {
      hideTab(TabbedPropertySheetPage.access$0(this$0));
    }
    else
    {
      tab = (TabContents)TabbedPropertySheetPage.access$1(this$0).get(descriptor);
      if (tab != TabbedPropertySheetPage.access$0(this$0)) {
        hideTab(TabbedPropertySheetPage.access$0(this$0));
      }
      Composite tabComposite = (Composite)TabbedPropertySheetPage.access$2(this$0).get(tab);
      if (tabComposite == null)
      {
        tabComposite = TabbedPropertySheetPage.access$3(this$0);
        tab.createControls(tabComposite, 
          this$0);
        
        TabbedPropertySheetPage.access$2(this$0).put(tab, tabComposite);
      }
      tab.setInput(TabbedPropertySheetPage.access$4(this$0).getWorkbenchPart(), 
        (ISelection)TabbedPropertySheetPage.access$4(this$0).getInput());
      
      TabbedPropertySheetPage.access$5(this$0, descriptor.getLabel());
      if (tab != TabbedPropertySheetPage.access$0(this$0)) {
        showTab(tab);
      }
      tab.refresh();
    }
    TabbedPropertySheetPage.access$6(this$0).getTabComposite().layout(true);
    TabbedPropertySheetPage.access$7(this$0, tab);
    this$0.resizeScrolledComposite();
    if (descriptor != null) {
      TabbedPropertySheetPage.access$8(this$0, descriptor);
    }
  }
  
  private void showTab(TabContents target)
  {
    if (target != null)
    {
      Composite tabComposite = (Composite)TabbedPropertySheetPage.access$2(this$0).get(target);
      if (tabComposite != null)
      {
        tabComposite.moveAbove(null);
        target.aboutToBeShown();
        tabComposite.setVisible(true);
      }
    }
  }
  
  private void hideTab(TabContents target)
  {
    if (target != null)
    {
      Composite tabComposite = (Composite)TabbedPropertySheetPage.access$2(this$0).get(target);
      if (tabComposite != null)
      {
        target.aboutToBeHidden();
        tabComposite.setVisible(false);
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage.SelectionChangedListener
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.views.properties.tabbed;

class TabbedPropertySheetPage$TabbedPropertySheetPageContributorFromSelection
  implements ITabbedPropertySheetPageContributor
{
  private String contributorId;
  final TabbedPropertySheetPage this$0;
  
  public TabbedPropertySheetPage$TabbedPropertySheetPageContributorFromSelection(TabbedPropertySheetPage paramTabbedPropertySheetPage, String contributorId)
  {
    this$0 = paramTabbedPropertySheetPage;
    this.contributorId = contributorId;
  }
  
  public String getContributorId()
  {
    return contributorId;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage.TabbedPropertySheetPageContributorFromSelection
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.views.properties.tabbed;

import org.eclipse.jface.viewers.LabelProvider;

class TabbedPropertySheetPage$TabbedPropertySheetPageLabelProvider
  extends LabelProvider
{
  final TabbedPropertySheetPage this$0;
  
  TabbedPropertySheetPage$TabbedPropertySheetPageLabelProvider(TabbedPropertySheetPage paramTabbedPropertySheetPage)
  {
    this$0 = paramTabbedPropertySheetPage;
  }
  
  public String getText(Object element)
  {
    if ((element instanceof ITabDescriptor)) {
      return ((ITabDescriptor)element).getLabel();
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage.TabbedPropertySheetPageLabelProvider
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.views.properties.tabbed;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IAdapterManager;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ContentViewer;
import org.eclipse.jface.viewers.IBaseLabelProvider;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.LabelProviderChangedEvent;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.ScrollBar;
import org.eclipse.swt.widgets.Scrollable;
import org.eclipse.swt.widgets.Widget;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.IPartListener;
import org.eclipse.ui.IPartService;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.IWorkbenchSite;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyComposite;
import org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyRegistry;
import org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyRegistryFactory;
import org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyTitle;
import org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyViewer;
import org.eclipse.ui.part.IContributedContentsView;
import org.eclipse.ui.part.IPageSite;
import org.eclipse.ui.part.Page;
import org.eclipse.ui.part.PageBookView;
import org.eclipse.ui.views.properties.IPropertySheetPage;
import org.eclipse.ui.views.properties.PropertySheet;

public class TabbedPropertySheetPage
  extends Page
  implements IPropertySheetPage, ILabelProviderListener
{
  private TabbedPropertyComposite tabbedPropertyComposite;
  private TabbedPropertySheetWidgetFactory widgetFactory;
  private ITabbedPropertySheetPageContributor contributor;
  private TabbedPropertyRegistry registry;
  private ITabbedPropertySheetPageContributor selectionContributor = null;
  private String currentContributorId;
  protected IStructuredContentProvider tabListContentProvider;
  private ISelection currentSelection;
  private boolean activePropertySheet;
  private TabbedPropertyViewer tabbedPropertyViewer;
  private TabContents currentTab;
  private Map descriptorToTab;
  private Map tabToComposite;
  private List selectionQueue;
  private boolean selectionQueueLocked;
  private List tabSelectionListeners;
  private IWorkbenchWindow cachedWorkbenchWindow;
  private boolean hasTitleBar;
  private IPartListener partActivationListener = new IPartListener()
  {
    public void partActivated(IWorkbenchPart part)
    {
      handlePartActivated(part);
    }
    
    public void partBroughtToTop(IWorkbenchPart part) {}
    
    public void partClosed(IWorkbenchPart part) {}
    
    public void partDeactivated(IWorkbenchPart part) {}
    
    public void partOpened(IWorkbenchPart part) {}
  };
  
  private class TabbedPropertySheetPageContributorFromSelection
    implements ITabbedPropertySheetPageContributor
  {
    private String contributorId;
    
    public TabbedPropertySheetPageContributorFromSelection(String contributorId)
    {
      this.contributorId = contributorId;
    }
    
    public String getContributorId()
    {
      return contributorId;
    }
  }
  
  class TabbedPropertySheetPageLabelProvider
    extends LabelProvider
  {
    TabbedPropertySheetPageLabelProvider() {}
    
    public String getText(Object element)
    {
      if ((element instanceof ITabDescriptor)) {
        return ((ITabDescriptor)element).getLabel();
      }
      return null;
    }
  }
  
  class SelectionChangedListener
    implements ISelectionChangedListener
  {
    SelectionChangedListener() {}
    
    public void selectionChanged(SelectionChangedEvent event)
    {
      IStructuredSelection selection = (IStructuredSelection)event
        .getSelection();
      TabContents tab = null;
      ITabDescriptor descriptor = (ITabDescriptor)selection
        .getFirstElement();
      if (descriptor == null)
      {
        hideTab(currentTab);
      }
      else
      {
        tab = (TabContents)descriptorToTab.get(descriptor);
        if (tab != currentTab) {
          hideTab(currentTab);
        }
        Composite tabComposite = (Composite)tabToComposite.get(tab);
        if (tabComposite == null)
        {
          tabComposite = TabbedPropertySheetPage.this.createTabComposite();
          tab.createControls(tabComposite, 
            TabbedPropertySheetPage.this);
          
          tabToComposite.put(tab, tabComposite);
        }
        tab.setInput(tabbedPropertyViewer.getWorkbenchPart(), 
          (ISelection)tabbedPropertyViewer.getInput());
        
        TabbedPropertySheetPage.this.storeCurrentTabSelection(descriptor.getLabel());
        if (tab != currentTab) {
          showTab(tab);
        }
        tab.refresh();
      }
      tabbedPropertyComposite.getTabComposite().layout(true);
      currentTab = tab;
      resizeScrolledComposite();
      if (descriptor != null) {
        TabbedPropertySheetPage.this.handleTabSelection(descriptor);
      }
    }
    
    private void showTab(TabContents target)
    {
      if (target != null)
      {
        Composite tabComposite = (Composite)tabToComposite.get(target);
        if (tabComposite != null)
        {
          tabComposite.moveAbove(null);
          target.aboutToBeShown();
          tabComposite.setVisible(true);
        }
      }
    }
    
    private void hideTab(TabContents target)
    {
      if (target != null)
      {
        Composite tabComposite = (Composite)tabToComposite.get(target);
        if (tabComposite != null)
        {
          target.aboutToBeHidden();
          tabComposite.setVisible(false);
        }
      }
    }
  }
  
  public TabbedPropertySheetPage(ITabbedPropertySheetPageContributor tabbedPropertySheetPageContributor)
  {
    this(tabbedPropertySheetPageContributor, true);
  }
  
  public TabbedPropertySheetPage(ITabbedPropertySheetPageContributor tabbedPropertySheetPageContributor, boolean showTitleBar)
  {
    hasTitleBar = showTitleBar;
    contributor = tabbedPropertySheetPageContributor;
    tabToComposite = new HashMap();
    selectionQueue = new ArrayList(10);
    tabSelectionListeners = new ArrayList();
    initContributor(contributor.getContributorId());
  }
  
  protected void handlePartActivated(IWorkbenchPart part)
  {
    boolean thisActivated = ((part instanceof PropertySheet)) && 
      (((PropertySheet)part).getCurrentPage() == this);
    if ((!thisActivated) && (!part.equals(contributor)) && 
      (!part.getSite().getId().equals(contributor.getContributorId())))
    {
      IContributedContentsView view = (IContributedContentsView)part
        .getAdapter(IContributedContentsView.class);
      if ((view == null) || (
        (view.getContributingPart() != null) && 
        (!view.getContributingPart().equals(contributor))))
      {
        if (activePropertySheet)
        {
          if (currentTab != null) {
            currentTab.aboutToBeHidden();
          }
          activePropertySheet = false;
        }
        return;
      }
    }
    if ((!activePropertySheet) && (currentTab != null))
    {
      currentTab.aboutToBeShown();
      currentTab.refresh();
    }
    activePropertySheet = true;
  }
  
  public void createControl(Composite parent)
  {
    widgetFactory = new TabbedPropertySheetWidgetFactory();
    tabbedPropertyComposite = new TabbedPropertyComposite(parent, 
      widgetFactory, hasTitleBar);
    widgetFactory.paintBordersFor(tabbedPropertyComposite);
    tabbedPropertyComposite.setLayout(new FormLayout());
    FormData formData = new FormData();
    left = new FormAttachment(0, 0);
    right = new FormAttachment(100, 0);
    top = new FormAttachment(0, 0);
    bottom = new FormAttachment(100, 0);
    tabbedPropertyComposite.setLayoutData(formData);
    
    tabbedPropertyViewer = new TabbedPropertyViewer(tabbedPropertyComposite
      .getList());
    tabbedPropertyViewer.setContentProvider(tabListContentProvider);
    tabbedPropertyViewer
      .setLabelProvider(new TabbedPropertySheetPageLabelProvider());
    tabbedPropertyViewer
      .addSelectionChangedListener(new SelectionChangedListener());
    
    tabbedPropertyComposite.getScrolledComposite().addControlListener(
      new ControlAdapter()
      {
        public void controlResized(ControlEvent e)
        {
          resizeScrolledComposite();
        }
      });
    cachedWorkbenchWindow = getSite().getWorkbenchWindow();
    cachedWorkbenchWindow.getPartService().addPartListener(
      partActivationListener);
    if (hasTitleBar) {
      registry.getLabelProvider().addListener(this);
    }
  }
  
  private void initContributor(String contributorId)
  {
    descriptorToTab = new HashMap();
    if (contributor.getContributorId().equals(contributorId))
    {
      registry = TabbedPropertyRegistryFactory.getInstance()
        .createRegistry(contributor);
    }
    else
    {
      selectionContributor = new TabbedPropertySheetPageContributorFromSelection(
        contributorId);
      registry = TabbedPropertyRegistryFactory.getInstance()
        .createRegistry(selectionContributor);
    }
    currentContributorId = contributorId;
    tabListContentProvider = getTabListContentProvider();
    hasTitleBar = ((hasTitleBar) && (registry.getLabelProvider() != null));
    if (tabbedPropertyViewer != null) {
      tabbedPropertyViewer.setContentProvider(tabListContentProvider);
    }
    if (hasTitleBar) {
      registry.getLabelProvider().addListener(this);
    }
  }
  
  protected IStructuredContentProvider getTabListContentProvider()
  {
    return registry.getTabListContentProvider();
  }
  
  private void disposeContributor()
  {
    if (currentTab != null)
    {
      currentTab.aboutToBeHidden();
      currentTab = null;
    }
    disposeTabs(descriptorToTab.values());
    descriptorToTab = new HashMap();
    if ((hasTitleBar) && (registry != null)) {
      registry.getLabelProvider().removeListener(this);
    }
    if (selectionContributor != null)
    {
      TabbedPropertyRegistryFactory.getInstance().disposeRegistry(
        selectionContributor);
      selectionContributor = null;
    }
  }
  
  public void dispose()
  {
    disposeContributor();
    if (widgetFactory != null)
    {
      widgetFactory.dispose();
      widgetFactory = null;
    }
    if (cachedWorkbenchWindow != null)
    {
      cachedWorkbenchWindow.getPartService().removePartListener(
        partActivationListener);
      cachedWorkbenchWindow = null;
    }
    if (registry != null)
    {
      TabbedPropertyRegistryFactory.getInstance().disposeRegistry(
        contributor);
      registry = null;
    }
    contributor = null;
    currentSelection = null;
  }
  
  public Control getControl()
  {
    return tabbedPropertyComposite;
  }
  
  public void setActionBars(IActionBars actionBars)
  {
    IActionBars partActionBars = null;
    if ((contributor instanceof IEditorPart))
    {
      IEditorPart editorPart = (IEditorPart)contributor;
      partActionBars = editorPart.getEditorSite().getActionBars();
    }
    else if ((contributor instanceof IViewPart))
    {
      IViewPart viewPart = (IViewPart)contributor;
      partActionBars = viewPart.getViewSite().getActionBars();
    }
    if (partActionBars != null)
    {
      IAction action = partActionBars.getGlobalActionHandler(ActionFactory.UNDO
        .getId());
      if (action != null) {
        actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), action);
      }
      action = partActionBars.getGlobalActionHandler(ActionFactory.REDO
        .getId());
      if (action != null) {
        actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), action);
      }
    }
  }
  
  public void setFocus()
  {
    getControl().setFocus();
  }
  
  public void selectionChanged(IWorkbenchPart part, ISelection selection)
  {
    setInput(part, selection);
  }
  
  private void storeCurrentTabSelection(String label)
  {
    if (!selectionQueueLocked)
    {
      selectionQueue.remove(label);
      selectionQueue.add(0, label);
    }
  }
  
  public void resizeScrolledComposite()
  {
    Point currentTabSize = new Point(0, 0);
    if (currentTab != null)
    {
      Composite sizeReference = (Composite)tabToComposite
        .get(currentTab);
      if (sizeReference != null) {
        currentTabSize = sizeReference.computeSize(-1, -1);
      }
    }
    tabbedPropertyComposite.getScrolledComposite().setMinSize(
      currentTabSize);
    
    ScrollBar verticalScrollBar = tabbedPropertyComposite
      .getScrolledComposite().getVerticalBar();
    if (verticalScrollBar != null)
    {
      Rectangle clientArea = tabbedPropertyComposite
        .getScrolledComposite().getClientArea();
      int increment = height - 5;
      verticalScrollBar.setPageIncrement(increment);
    }
    ScrollBar horizontalScrollBar = tabbedPropertyComposite
      .getScrolledComposite().getHorizontalBar();
    if (horizontalScrollBar != null)
    {
      Rectangle clientArea = tabbedPropertyComposite
        .getScrolledComposite().getClientArea();
      int increment = width - 5;
      horizontalScrollBar.setPageIncrement(increment);
    }
  }
  
  private void disposeTabs(Collection tabs)
  {
    for (Iterator iter = tabs.iterator(); iter.hasNext();)
    {
      TabContents tab = (TabContents)iter.next();
      Composite composite = (Composite)tabToComposite.remove(tab);
      tab.dispose();
      if (composite != null) {
        composite.dispose();
      }
    }
  }
  
  private int getLastTabSelection(IWorkbenchPart part, ISelection input)
  {
    ITabDescriptor[] descriptors = registry.getTabDescriptors(part, input);
    if (descriptors.length != 0)
    {
      int i;
      for (Iterator iter = selectionQueue.iterator(); iter.hasNext(); i < descriptors.length)
      {
        String text = (String)iter.next();
        i = 0; continue;
        if (text.equals(descriptors[i].getLabel())) {
          return i;
        }
        i++;
      }
    }
    return 0;
  }
  
  protected void updateTabs(ITabDescriptor[] descriptors)
  {
    Map newTabs = new HashMap(descriptors.length * 2);
    boolean disposingCurrentTab = currentTab != null;
    for (int i = 0; i < descriptors.length; i++)
    {
      TabContents tab = (TabContents)descriptorToTab
        .remove(descriptors[i]);
      if ((tab != null) && (tab.controlsHaveBeenCreated()))
      {
        if (tab == currentTab) {
          disposingCurrentTab = false;
        }
      }
      else {
        tab = createTab(descriptors[i]);
      }
      newTabs.put(descriptors[i], tab);
    }
    if (disposingCurrentTab)
    {
      currentTab.aboutToBeHidden();
      currentTab = null;
    }
    disposeTabs(descriptorToTab.values());
    descriptorToTab = newTabs;
  }
  
  protected TabContents createTab(ITabDescriptor tabDescriptor)
  {
    return tabDescriptor.createTab();
  }
  
  private Composite createTabComposite()
  {
    Composite result = widgetFactory.createComposite(
      tabbedPropertyComposite.getTabComposite(), 524288);
    result.setVisible(false);
    result.setLayout(new FillLayout());
    FormData data = new FormData();
    if (hasTitleBar) {
      top = new FormAttachment(tabbedPropertyComposite.getTitle(), 0);
    } else {
      top = new FormAttachment(0, 0);
    }
    bottom = new FormAttachment(100, 0);
    left = new FormAttachment(0, 0);
    right = new FormAttachment(100, 0);
    result.setLayoutData(data);
    return result;
  }
  
  /* Error */
  private void setInput(IWorkbenchPart part, ISelection selection)
  {
    // Byte code:
    //   0: aload_2
    //   1: aload_0
    //   2: getfield 638	org/eclipse/ui/views/properties/tabbed/TabbedPropertySheetPage:currentSelection	Lorg/eclipse/jface/viewers/ISelection;
    //   5: invokevirtual 652	java/lang/Object:equals	(Ljava/lang/Object;)Z
    //   8: ifeq +4 -> 12
    //   11: return
    //   12: aload_0
    //   13: aload_2
    //   14: putfield 638	org/eclipse/ui/views/properties/tabbed/TabbedPropertySheetPage:currentSelection	Lorg/eclipse/jface/viewers/ISelection;
    //   17: aload_0
    //   18: aload_2
    //   19: invokespecial 718	org/eclipse/ui/views/properties/tabbed/TabbedPropertySheetPage:validateRegistry	(Lorg/eclipse/jface/viewers/ISelection;)V
    //   22: aload_0
    //   23: getfield 643	org/eclipse/ui/views/properties/tabbed/TabbedPropertySheetPage:registry	Lorg/eclipse/ui/internal/views/properties/tabbed/view/TabbedPropertyRegistry;
    //   26: aload_1
    //   27: aload_0
    //   28: getfield 638	org/eclipse/ui/views/properties/tabbed/TabbedPropertySheetPage:currentSelection	Lorg/eclipse/jface/viewers/ISelection;
    //   31: invokevirtual 694	org/eclipse/ui/internal/views/properties/tabbed/view/TabbedPropertyRegistry:getTabDescriptors	(Lorg/eclipse/ui/IWorkbenchPart;Lorg/eclipse/jface/viewers/ISelection;)[Lorg/eclipse/ui/views/properties/tabbed/ITabDescriptor;
    //   34: astore_3
    //   35: aload_3
    //   36: arraylength
    //   37: ifle +8 -> 45
    //   40: aload_0
    //   41: aload_3
    //   42: invokevirtual 723	org/eclipse/ui/views/properties/tabbed/TabbedPropertySheetPage:updateTabs	([Lorg/eclipse/ui/views/properties/tabbed/ITabDescriptor;)V
    //   45: aload_0
    //   46: getfield 644	org/eclipse/ui/views/properties/tabbed/TabbedPropertySheetPage:tabbedPropertyViewer	Lorg/eclipse/ui/internal/views/properties/tabbed/view/TabbedPropertyViewer;
    //   49: aload_1
    //   50: aload_0
    //   51: getfield 638	org/eclipse/ui/views/properties/tabbed/TabbedPropertySheetPage:currentSelection	Lorg/eclipse/jface/viewers/ISelection;
    //   54: invokevirtual 703	org/eclipse/ui/internal/views/properties/tabbed/view/TabbedPropertyViewer:setInput	(Lorg/eclipse/ui/IWorkbenchPart;Lorg/eclipse/jface/viewers/ISelection;)V
    //   57: aload_0
    //   58: aload_1
    //   59: aload_0
    //   60: getfield 638	org/eclipse/ui/views/properties/tabbed/TabbedPropertySheetPage:currentSelection	Lorg/eclipse/jface/viewers/ISelection;
    //   63: invokespecial 725	org/eclipse/ui/views/properties/tabbed/TabbedPropertySheetPage:getLastTabSelection	(Lorg/eclipse/ui/IWorkbenchPart;Lorg/eclipse/jface/viewers/ISelection;)I
    //   66: istore 4
    //   68: aload_0
    //   69: getfield 644	org/eclipse/ui/views/properties/tabbed/TabbedPropertySheetPage:tabbedPropertyViewer	Lorg/eclipse/ui/internal/views/properties/tabbed/view/TabbedPropertyViewer;
    //   72: iload 4
    //   74: invokevirtual 700	org/eclipse/ui/internal/views/properties/tabbed/view/TabbedPropertyViewer:getElementAt	(I)Ljava/lang/Object;
    //   77: astore 5
    //   79: aload_0
    //   80: iconst_1
    //   81: putfield 630	org/eclipse/ui/views/properties/tabbed/TabbedPropertySheetPage:selectionQueueLocked	Z
    //   84: aload 5
    //   86: ifnonnull +14 -> 100
    //   89: aload_0
    //   90: getfield 644	org/eclipse/ui/views/properties/tabbed/TabbedPropertySheetPage:tabbedPropertyViewer	Lorg/eclipse/ui/internal/views/properties/tabbed/view/TabbedPropertyViewer;
    //   93: aconst_null
    //   94: invokevirtual 664	org/eclipse/jface/viewers/Viewer:setSelection	(Lorg/eclipse/jface/viewers/ISelection;)V
    //   97: goto +32 -> 129
    //   100: aload_0
    //   101: getfield 644	org/eclipse/ui/views/properties/tabbed/TabbedPropertySheetPage:tabbedPropertyViewer	Lorg/eclipse/ui/internal/views/properties/tabbed/view/TabbedPropertyViewer;
    //   104: new 302	org/eclipse/jface/viewers/StructuredSelection
    //   107: dup
    //   108: aload 5
    //   110: invokespecial 660	org/eclipse/jface/viewers/StructuredSelection:<init>	(Ljava/lang/Object;)V
    //   113: invokevirtual 664	org/eclipse/jface/viewers/Viewer:setSelection	(Lorg/eclipse/jface/viewers/ISelection;)V
    //   116: goto +13 -> 129
    //   119: astore 6
    //   121: aload_0
    //   122: iconst_0
    //   123: putfield 630	org/eclipse/ui/views/properties/tabbed/TabbedPropertySheetPage:selectionQueueLocked	Z
    //   126: aload 6
    //   128: athrow
    //   129: aload_0
    //   130: iconst_0
    //   131: putfield 630	org/eclipse/ui/views/properties/tabbed/TabbedPropertySheetPage:selectionQueueLocked	Z
    //   134: aload_0
    //   135: invokespecial 714	org/eclipse/ui/views/properties/tabbed/TabbedPropertySheetPage:refreshTitleBar	()V
    //   138: return
    // Line number table:
    //   Java source line #710	-> byte code offset #0
    //   Java source line #711	-> byte code offset #11
    //   Java source line #714	-> byte code offset #12
    //   Java source line #717	-> byte code offset #17
    //   Java source line #718	-> byte code offset #22
    //   Java source line #719	-> byte code offset #27
    //   Java source line #718	-> byte code offset #31
    //   Java source line #723	-> byte code offset #35
    //   Java source line #724	-> byte code offset #40
    //   Java source line #727	-> byte code offset #45
    //   Java source line #728	-> byte code offset #57
    //   Java source line #729	-> byte code offset #68
    //   Java source line #730	-> byte code offset #72
    //   Java source line #729	-> byte code offset #77
    //   Java sourc
1 2 3 4 5

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd