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

yList paramTabbedPropertyList, Composite parent)
  {
    super(parent, 524288);this$0 = paramTabbedPropertyList;
    addPaintListener(new TabbedPropertyList.7(this));
    
    addMouseListener(new TabbedPropertyList.8(this));
  }
  
  private void paint(PaintEvent e)
  {
    gc.setBackground(TabbedPropertyList.access$19(this$0));
    gc.setForeground(TabbedPropertyList.access$9(this$0));
    Rectangle bounds = getBounds();
    if (TabbedPropertyList.access$20(this$0).length != 0)
    {
      gc.fillRectangle(0, 0, width, height);
      gc.setForeground(TabbedPropertyList.access$1(this$0));
      gc.drawLine(width - 1, 0, width - 1, 
        height - 1);
      gc.drawLine(0, 0, width - 1, 0);
      
      gc.setForeground(TabbedPropertyList.access$24(this$0));
      gc.drawLine(0, 1, width - 2, 1);
      gc.setForeground(TabbedPropertyList.access$25(this$0));
      gc.drawLine(0, 2, width - 2, 2);
    }
    else
    {
      gc.setBackground(TabbedPropertyList.access$2(this$0));
      gc.fillRectangle(0, 0, width, height);
    }
    if (TabbedPropertyList.access$23(this$0))
    {
      gc.setForeground(TabbedPropertyList.access$21(this$0));
      int middle = width / 2;
      int bottom = height - 3;
      gc.drawLine(middle + 1, bottom, middle + 5, bottom - 4);
      gc.drawLine(middle, bottom, middle - 4, bottom - 4);
      gc.drawLine(middle - 3, bottom - 4, middle + 4, bottom - 4);
      
      gc.setForeground(TabbedPropertyList.access$2(this$0));
      gc.drawLine(middle, bottom - 1, middle + 1, bottom - 1);
      gc.drawLine(middle - 1, bottom - 2, middle + 2, bottom - 2);
      gc.drawLine(middle - 2, bottom - 3, middle + 3, bottom - 3);
      
      gc.setForeground(TabbedPropertyList.access$1(this$0));
      gc.drawLine(0, bottom - 7, width - 2, bottom - 7);
      gc.setForeground(TabbedPropertyList.access$22(this$0));
      gc.drawLine(0, bottom + 2, width - 2, bottom + 2);
      gc.drawLine(0, bottom - 6, width - 2, bottom - 6);
    }
  }
}

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

import org.eclipse.jface.resource.FontRegistry;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.graphics.FontMetrics;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.views.properties.tabbed.ITabItem;

public class TabbedPropertyList$ListElement
  extends Canvas
{
  private ITabItem tab;
  private int index;
  private boolean selected;
  private boolean hover;
  final TabbedPropertyList this$0;
  
  public TabbedPropertyList$ListElement(TabbedPropertyList paramTabbedPropertyList, Composite parent, ITabItem tab, int index)
  {
    super(parent, 524288);this$0 = paramTabbedPropertyList;
    this.tab = tab;
    hover = false;
    selected = false;
    this.index = index;
    
    addPaintListener(new TabbedPropertyList.1(this));
    
    addMouseListener(new TabbedPropertyList.2(this));
    
    addMouseMoveListener(new TabbedPropertyList.3(this));
    
    addMouseTrackListener(new TabbedPropertyList.4(this));
  }
  
  public void setSelected(boolean selected)
  {
    this.selected = selected;
    redraw();
  }
  
  private void paint(PaintEvent e)
  {
    Rectangle bounds = getBounds();
    gc.setForeground(TabbedPropertyList.access$1(this$0));
    gc.drawLine(0, 0, width - 1, 0);
    gc.setForeground(TabbedPropertyList.access$2(this$0));
    gc.drawLine(0, 1, width - 1, 1);
    if (selected)
    {
      gc.setBackground(TabbedPropertyList.access$2(this$0));
      gc.fillRectangle(0, 2, width, height - 1);
    }
    else if ((hover) && (tab.isIndented()))
    {
      gc.setBackground(TabbedPropertyList.access$3(this$0));
      gc.fillRectangle(0, 2, width - 1, height - 1);
    }
    else if (hover)
    {
      gc.setForeground(TabbedPropertyList.access$4(this$0));
      gc.setBackground(TabbedPropertyList.access$5(this$0));
      gc.fillGradientRectangle(0, 2, width - 1, 
        height - 1, true);
    }
    else if (tab.isIndented())
    {
      gc.setBackground(TabbedPropertyList.access$6(this$0));
      gc.fillRectangle(0, 2, width - 1, height - 1);
    }
    else
    {
      gc.setForeground(TabbedPropertyList.access$7(this$0));
      gc.setBackground(TabbedPropertyList.access$8(this$0));
      gc.fillGradientRectangle(0, 2, width - 1, 
        height - 1, true);
    }
    if (!selected)
    {
      gc.setForeground(TabbedPropertyList.access$1(this$0));
      gc.drawLine(width - 1, 1, width - 1, 
        height + 1);
    }
    int textIndent = 7;
    FontMetrics fm = gc.getFontMetrics();
    int height = fm.getHeight();
    int textMiddle = (height - height) / 2;
    if ((selected) && (tab.getImage() != null) && 
      (!tab.getImage().isDisposed()))
    {
      if (tab.isIndented()) {
        textIndent += 7;
      } else {
        textIndent -= 3;
      }
      gc.drawImage(tab.getImage(), textIndent, textMiddle - 1);
      textIndent = textIndent + 16 + 5;
    }
    else if (tab.isIndented())
    {
      textIndent += 7;
    }
    gc.setForeground(TabbedPropertyList.access$9(this$0));
    if (selected) {
      gc.setFont(JFaceResources.getFontRegistry().getBold(
        "org.eclipse.jface.defaultfont"));
    }
    gc.drawText(tab.getText(), textIndent, textMiddle, true);
    if ((TabbedPropertyList.access$10((TabbedPropertyList)getParent())) && (selected))
    {
      Point point = gc.textExtent(tab.getText());
      gc.drawLine(textIndent, height - 4, textIndent + 
        x, height - 4);
    }
    if (!hover)
    {
      gc.setForeground(TabbedPropertyList.access$2(this$0));
      gc.drawLine(0, height - 1, width - 2, 
        height - 1);
    }
  }
  
  public ITabItem getTabItem()
  {
    return tab;
  }
  
  public String toString()
  {
    return tab.getText();
  }
}

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

import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.graphics.FontMetrics;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.internal.views.properties.tabbed.l10n.TabbedPropertyMessages;

public class TabbedPropertyList$TopNavigationElement
  extends Canvas
{
  final TabbedPropertyList this$0;
  
  public TabbedPropertyList$TopNavigationElement(TabbedPropertyList paramTabbedPropertyList, Composite parent)
  {
    super(parent, 524288);this$0 = paramTabbedPropertyList;
    addPaintListener(new TabbedPropertyList.5(this));
    
    addMouseListener(new TabbedPropertyList.6(this));
  }
  
  private void paint(PaintEvent e)
  {
    gc.setBackground(TabbedPropertyList.access$19(this$0));
    gc.setForeground(TabbedPropertyList.access$9(this$0));
    Rectangle bounds = getBounds();
    if (TabbedPropertyList.access$20(this$0).length != 0)
    {
      gc.fillRectangle(0, 0, width, height);
      gc.setForeground(TabbedPropertyList.access$1(this$0));
      gc.drawLine(width - 1, 0, width - 1, 
        height - 1);
    }
    else
    {
      gc.setBackground(TabbedPropertyList.access$2(this$0));
      gc.fillRectangle(0, 0, width, height);
      int textIndent = 7;
      FontMetrics fm = gc.getFontMetrics();
      int height = fm.getHeight();
      int textMiddle = (height - height) / 2;
      gc.setForeground(TabbedPropertyList.access$9(this$0));
      String properties_not_available = TabbedPropertyMessages.TabbedPropertyList_properties_not_available;
      gc.drawText(properties_not_available, textIndent, textMiddle);
    }
    if (TabbedPropertyList.access$11(this$0))
    {
      gc.setForeground(TabbedPropertyList.access$21(this$0));
      int middle = width / 2;
      gc.drawLine(middle + 1, 3, middle + 5, 7);
      gc.drawLine(middle, 3, middle - 4, 7);
      gc.drawLine(middle - 3, 7, middle + 4, 7);
      
      gc.setForeground(TabbedPropertyList.access$2(this$0));
      gc.drawLine(middle, 4, middle + 1, 4);
      gc.drawLine(middle - 1, 5, middle + 2, 5);
      gc.drawLine(middle - 2, 6, middle + 3, 6);
      
      gc.setForeground(TabbedPropertyList.access$1(this$0));
      gc.drawLine(0, 0, width - 2, 0);
      gc.setForeground(TabbedPropertyList.access$22(this$0));
      gc.drawLine(0, 1, width - 2, 1);
      gc.drawLine(0, height - 1, width - 2, 
        height - 1);
    }
  }
}

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

import org.eclipse.jface.resource.FontRegistry;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.swt.accessibility.Accessible;
import org.eclipse.swt.accessibility.AccessibleAdapter;
import org.eclipse.swt.accessibility.AccessibleControlAdapter;
import org.eclipse.swt.accessibility.AccessibleControlEvent;
import org.eclipse.swt.accessibility.AccessibleEvent;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.TraverseEvent;
import org.eclipse.swt.events.TraverseListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.FontMetrics;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.graphics.Resource;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Widget;
import org.eclipse.ui.forms.FormColors;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.internal.views.properties.tabbed.l10n.TabbedPropertyMessages;
import org.eclipse.ui.views.properties.tabbed.ITabItem;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;

public class TabbedPropertyList
  extends Composite
{
  private static final ListElement[] ELEMENTS_EMPTY = new ListElement[0];
  protected static final int NONE = -1;
  protected static final int INDENT = 7;
  private boolean focus = false;
  private ListElement[] elements;
  private int selectedElementIndex = -1;
  private int topVisibleIndex = -1;
  private int bottomVisibleIndex = -1;
  private TopNavigationElement topNavigationElement;
  private BottomNavigationElement bottomNavigationElement;
  private int widestLabelIndex = -1;
  private int tabsThatFitInComposite = -1;
  private Color widgetForeground;
  private Color widgetBackground;
  private Color widgetNormalShadow;
  private Color widgetDarkShadow;
  private Color listBackground;
  private Color hoverGradientStart;
  private Color hoverGradientEnd;
  private Color defaultGradientStart;
  private Color defaultGradientEnd;
  private Color indentedDefaultBackground;
  private Color indentedHoverBackground;
  private Color navigationElementShadowStroke;
  private Color bottomNavigationElementShadowStroke1;
  private Color bottomNavigationElementShadowStroke2;
  private TabbedPropertySheetWidgetFactory factory;
  
  public class ListElement
    extends Canvas
  {
    private ITabItem tab;
    private int index;
    private boolean selected;
    private boolean hover;
    
    public ListElement(Composite parent, ITabItem tab, int index)
    {
      super(524288);
      this.tab = tab;
      hover = false;
      selected = false;
      this.index = index;
      
      addPaintListener(new TabbedPropertyList.1(this));
      
      addMouseListener(new TabbedPropertyList.2(this));
      
      addMouseMoveListener(new TabbedPropertyList.3(this));
      
      addMouseTrackListener(new TabbedPropertyList.4(this));
    }
    
    public void setSelected(boolean selected)
    {
      this.selected = selected;
      redraw();
    }
    
    private void paint(PaintEvent e)
    {
      Rectangle bounds = getBounds();
      gc.setForeground(widgetNormalShadow);
      gc.drawLine(0, 0, width - 1, 0);
      gc.setForeground(listBackground);
      gc.drawLine(0, 1, width - 1, 1);
      if (selected)
      {
        gc.setBackground(listBackground);
        gc.fillRectangle(0, 2, width, height - 1);
      }
      else if ((hover) && (tab.isIndented()))
      {
        gc.setBackground(indentedHoverBackground);
        gc.fillRectangle(0, 2, width - 1, height - 1);
      }
      else if (hover)
      {
        gc.setForeground(hoverGradientStart);
        gc.setBackground(hoverGradientEnd);
        gc.fillGradientRectangle(0, 2, width - 1, 
          height - 1, true);
      }
      else if (tab.isIndented())
      {
        gc.setBackground(indentedDefaultBackground);
        gc.fillRectangle(0, 2, width - 1, height - 1);
      }
      else
      {
        gc.setForeground(defaultGradientStart);
        gc.setBackground(defaultGradientEnd);
        gc.fillGradientRectangle(0, 2, width - 1, 
          height - 1, true);
      }
      if (!selected)
      {
        gc.setForeground(widgetNormalShadow);
        gc.drawLine(width - 1, 1, width - 1, 
          height + 1);
      }
      int textIndent = 7;
      FontMetrics fm = gc.getFontMetrics();
      int height = fm.getHeight();
      int textMiddle = (height - height) / 2;
      if ((selected) && (tab.getImage() != null) && 
        (!tab.getImage().isDisposed()))
      {
        if (tab.isIndented()) {
          textIndent += 7;
        } else {
          textIndent -= 3;
        }
        gc.drawImage(tab.getImage(), textIndent, textMiddle - 1);
        textIndent = textIndent + 16 + 5;
      }
      else if (tab.isIndented())
      {
        textIndent += 7;
      }
      gc.setForeground(widgetForeground);
      if (selected) {
        gc.setFont(JFaceResources.getFontRegistry().getBold(
          "org.eclipse.jface.defaultfont"));
      }
      gc.drawText(tab.getText(), textIndent, textMiddle, true);
      if ((getParentfocus) && (selected))
      {
        Point point = gc.textExtent(tab.getText());
        gc.drawLine(textIndent, height - 4, textIndent + 
          x, height - 4);
      }
      if (!hover)
      {
        gc.setForeground(listBackground);
        gc.drawLine(0, height - 1, width - 2, 
          height - 1);
      }
    }
    
    public ITabItem getTabItem()
    {
      return tab;
    }
    
    public String toString()
    {
      return tab.getText();
    }
  }
  
  public class TopNavigationElement
    extends Canvas
  {
    public TopNavigationElement(Composite parent)
    {
      super(524288);
      addPaintListener(new TabbedPropertyList.5(this));
      
      addMouseListener(new TabbedPropertyList.6(this));
    }
    
    private void paint(PaintEvent e)
    {
      gc.setBackground(widgetBackground);
      gc.setForeground(widgetForeground);
      Rectangle bounds = getBounds();
      if (elements.length != 0)
      {
        gc.fillRectangle(0, 0, width, height);
        gc.setForeground(widgetNormalShadow);
        gc.drawLine(width - 1, 0, width - 1, 
          height - 1);
      }
      else
      {
        gc.setBackground(listBackground);
        gc.fillRectangle(0, 0, width, height);
        int textIndent = 7;
        FontMetrics fm = gc.getFontMetrics();
        int height = fm.getHeight();
        int textMiddle = (height - height) / 2;
        gc.setForeground(widgetForeground);
        String properties_not_available = TabbedPropertyMessages.TabbedPropertyList_properties_not_available;
        gc.drawText(properties_not_available, textIndent, textMiddle);
      }
      if (TabbedPropertyList.this.isUpScrollRequired())
      {
        gc.setForeground(widgetDarkShadow);
        int middle = width / 2;
        gc.drawLine(middle + 1, 3, middle + 5, 7);
        gc.drawLine(middle, 3, middle - 4, 7);
        gc.drawLine(middle - 3, 7, middle + 4, 7);
        
        gc.setForeground(listBackground);
        gc.drawLine(middle, 4, middle + 1, 4);
        gc.drawLine(middle - 1, 5, middle + 2, 5);
        gc.drawLine(middle - 2, 6, middle + 3, 6);
        
        gc.setForeground(widgetNormalShadow);
        gc.drawLine(0, 0, width - 2, 0);
        gc.setForeground(navigationElementShadowStroke);
        gc.drawLine(0, 1, width - 2, 1);
        gc.drawLine(0, height - 1, width - 2, 
          height - 1);
      }
    }
  }
  
  public class BottomNavigationElement
    extends Canvas
  {
    public BottomNavigationElement(Composite parent)
    {
      super(524288);
      addPaintListener(new TabbedPropertyList.7(this));
      
      addMouseListener(new TabbedPropertyList.8(this));
    }
    
    private void paint(PaintEvent e)
    {
      gc.setBackground(widgetBackground);
      gc.setForeground(widgetForeground);
      Rectangle bounds = getBounds();
      if (elements.length != 0)
      {
        gc.fillRectangle(0, 0, width, height);
        gc.setForeground(widgetNormalShadow);
        gc.drawLine(width - 1, 0, width - 1, 
          height - 1);
        gc.drawLine(0, 0, width - 1, 0);
        
        gc.setForeground(bottomNavigationElementShadowStroke1);
        gc.drawLine(0, 1, width - 2, 1);
        gc.setForeground(bottomNavigationElementShadowStroke2);
        gc.drawLine(0, 2, width - 2, 2);
      }
      else
      {
        gc.setBackground(listBackground);
        gc.fillRectangle(0, 0, width, height);
      }
      if (TabbedPropertyList.this.isDownScrollRequired())
      {
        gc.setForeground(widgetDarkShadow);
        int middle = width / 2;
        int bottom = height - 3;
        gc.drawLine(middle + 1, bottom, middle + 5, bottom - 4);
        gc.drawLine(middle, bottom, middle - 4, bottom - 4);
        gc.drawLine(middle - 3, bottom - 4, middle + 4, bottom - 4);
        
        gc.setForeground(listBackground);
        gc.drawLine(middle, bottom - 1, middle + 1, bottom - 1);
        gc.drawLine(middle - 1, bottom - 2, middle + 2, bottom - 2);
        gc.drawLine(middle - 2, bottom - 3, middle + 3, bottom - 3);
        
        gc.setForeground(widgetNormalShadow);
        gc.drawLine(0, bottom - 7, width - 2, bottom - 7);
        gc.setForeground(navigationElementShadowStroke);
        gc.drawLine(0, bottom + 2, width - 2, bottom + 2);
        gc.drawLine(0, bottom - 6, width - 2, bottom - 6);
      }
    }
  }
  
  public TabbedPropertyList(Composite parent, TabbedPropertySheetWidgetFactory factory)
  {
    super(parent, 524288);
    this.factory = factory;
    removeAll();
    setLayout(new FormLayout());
    initColours();
    initAccessible();
    topNavigationElement = new TopNavigationElement(this);
    bottomNavigationElement = new BottomNavigationElement(this);
    
    addFocusListener(new FocusListener()
    {
      public void focusGained(FocusEvent e)
      {
        focus = true;
        int i = getSelectionIndex();
        if (i >= 0) {
          elements[i].redraw();
        }
      }
      
      public void focusLost(FocusEvent e)
      {
        focus = false;
        int i = getSelectionIndex();
        if (i >= 0) {
          elements[i].redraw();
        }
      }
    });
    addControlListener(new ControlAdapter()
    {
      public void controlResized(ControlEvent e)
      {
        TabbedPropertyList.this.computeTopAndBottomTab();
      }
    });
    addTraverseListener(new TraverseListener()
    {
      public void keyTraversed(TraverseEvent e)
      {
        if ((detail == 32) || 
          (detail == 64))
        {
          int nMax = elements.length - 1;
          int nCurrent = getSelectionIndex();
          if (detail == 32)
          {
            nCurrent--;
            nCurrent = Math.max(0, nCurrent);
          }
          else if (detail == 64)
          {
            nCurrent++;
            nCurrent = Math.min(nCurrent, nMax);
          }
          select(nCurrent);
          redraw();
        }
        else
        {
          doit = true;
        }
      }
    });
  }
  
  protected void computeTabsThatFitInComposite()
  {
    tabsThatFitInComposite = 
      Math.round((getSizey - 22) / getTabHeight());
    if (tabsThatFitInComposite <= 0) {
      tabsThatFitInComposite = 1;
    }
  }
  
  public Object getElementAt(int index)
  {
    if ((index >= 0) && (index < elements.length)) {
      return elements[index];
    }
    return null;
  }
  
  public int getSelectionIndex()
  {
    return selectedElementIndex;
  }
  
  public void removeAll()
  {
    if (elements != null) {
      for (int i = 0; i < elements.length; i++) {
        elements[i].dispose();
      }
    }
    elements = ELEMENTS_EMPTY;
    selectedElementIndex = -1;
    widestLabelIndex = -1;
    topVisibleIndex = -1;
    bottomVisibleIndex = -1;
  }
  
  public void setElements(Object[] children)
  {
    if (elements != ELEMENTS_EMPTY) {
      removeAll();
    }
    elements = new ListElement[children.length];
    if (children.length == 0)
    {
      widestLabelIndex = -1;
    }
    else
    {
      widestLabelIndex = 0;
      for (int i = 0; i < children.length; i++)
      {
        elements[i] = new ListElement(this, (ITabItem)children[i], i);
        elements[i].setVisible(false);
        elements[i].setLayoutData(null);
        if (i != widestLabelIndex)
        {
          String label = ((ITabItem)children[i]).getText();
          int width = getTextDimensionx;
          if (((ITabItem)children[i]).isIndented()) {
            width += 7;
          }
          if (width > getTextDimensionwidestLabelIndex]).getText()).x) {
            widestLabelIndex = i;
          }
        }
      }
    }
    computeTopAndBottomTab();
  }
  
  protected void select(int index)
  {
    if (getSelectionIndex() == index) {
      return;
    }
    if ((index >= 0) && (index < elements.length))
    {
      int lastSelected = getSelectionIndex();
      elements[index].setSelected(true);
      selectedElementIndex = index;
      if (lastSelected != -1)
      {
        elements[lastSelected].setSelected(false);
        if (getSelectionIndex() != elements.length - 1) {
          elements[(getSelectionIndex() + 1)].setSelected(false);
        }
      }
      topNavigationElement.redraw();
      bottomNavigationElement.redraw();
      if ((selectedElementIndex < topVisibleIndex) || 
        (selectedElementIndex > bottomVisibleIndex)) {
        computeTopAndBottomTab();
      }
    }
    notifyListeners(13, new Event());
  }
  
  public void deselectAll()
  {
    if (getSelectionIndex() != -1)
    {
      elements[getSelectionIndex()].setSelected(false);
      selectedElementIndex = -1;
    }
  }
  
  private int getIndex(ListElement element)
  {
    return index;
  }
  
  public Point computeSize(int wHint, int hHint, boolean changed)
  {
    Point result = super.computeSize(hHint, wHint, changed);
    if (widestLabelIndex == -1)
    {
      String properties_not_available = TabbedPropertyMessages.TabbedPropertyList_properties_not_available;
      x = (getTextDimensionx + 7);
    }
    else
    {
      ITabItem widestTab = elements[widestLabelIndex].getTabItem();
      int width = getTextDimensiongetTextx + 7;
      if (widestTab.getImage() != null) {
        width = width + 16 + 4;
      }
      if (widestTab.isIndented()) {
        width += 10;
      }
      x = (width + 10);
    }
    return result;
  }
  
  private Point getTextDimension(String text)
  {
    GC gc = new GC(this);
    gc.setFont(JFaceResources.getFontRegistry().getBold(
      "org.eclipse.jface.defaultfont"));
    Point point = gc.textExtent(text);
    x += 1;
    gc.dispose();
    return point;
  }
  
  private void initColours()
  {
    listBackground = Display.getCurrent().getSystemColor(
      25);
    
    widgetBackground = Display.getCurrent().getSystemColor(
      22);
    
    widgetDarkShadow = Display.getCurrent().getSystemColor(
      17);
    
    widgetForeground = Display.getCurrent().getSystemColor(
      21);
    
    widgetNormalShadow = Display.getCurrent().getSystemColor(
      18);
    
    RGB infoBackground = Display.getCurrent().getSystemColor(
      29).getRGB();
    RGB white = Display.getCurrent().getSystemColor(1)
      .getRGB();
    RGB black = Display.getCurrent().getSystemColor(2)
      .getRGB();
    
    defaultGradientStart = factory.getColors().createColor(
      "TabbedPropertyList.defaultTabGradientStart", 
      FormColors.blend(infoBackground, FormColors.blend(white, 
      widgetNormalShadow.getRGB(), 20), 60));
    defaultGradientEnd = factory.getColors().createColor(
      "TabbedPropertyList.defaultTabGradientEnd", 
      FormColors.blend(infoBackground, widgetNormalShadow.getRGB(), 
      40));
    
    navigationElementShadowStroke = factory.getColors().createColor(
      "TabbedPropertyList.shadowStroke", 
      FormColors.blend(white, widgetNormalShadow.getRGB(), 55));
    bottomNavigationElementShadowStroke1 = factory.getColors().createColor(
      "TabbedPropertyList.tabShadowStroke1", 
      FormColors.blend(black, widgetBackground.getRGB(), 10));
    bottomNavigationElementShadowStroke2 = factory.getColors().createColor(
      "TabbedPropertyList.tabShadowStroke2", 
      FormColors.blend(black, widgetBackground.getRGB(), 5));
    
    hoverGradientStart = factory.getColors().createColor(
      "TabbedPropertyList.hoverBackgroundGradientStart", 
      FormColors.blend(white, widgetBackground.getRGB(), 20));
    hoverGradientEnd = factory.getColors().createColor(
      "TabbedPropertyList.hoverBackgroundGradientEnd", 
      FormColors.blend(widgetNormalShadow.getRGB(), widgetBackground
      .getRGB(), 10));
    
    indentedDefaultBackground = factory.getColors().createColor(
      "TabbedPropertyList.indentedDefaultBackground", 
      FormColors.blend(white, widgetBackground.getRGB(), 10));
    indentedHoverBackground = factory.getColors().createColor(
      "TabbedPropertyList.indentedHoverBackground", 
      FormColors.blend(white, widgetBackground.getRGB(), 75));
  }
  
  private int getTabHeight()
  {
    int tabHeight = getTextDimension""y + 7;
    if (tabsThatFitInComposite == 1)
    {
      int ret = getBoundsheight - 20;
      return 
        ret < 5 ? 5 : ret > tabHeight ? tabHeight : 
        ret;
    }
    return tabHeight;
  }
  
  private boolean isDownScrollRequired()
  {
    return (elements.length > tabsThatFitInComposite) && (bottomVisibleIndex != elements.length - 1);
  }
  
  private boolean isUpScrollRequired()
  {
    return (elements.length > tabsThatFitInComposite) && (topVisibleIndex != 0);
  }
  
  private void computeTopAndBottomTab()
  {
    computeTabsThatFitInComposite();
    if (elements.length == 0)
    {
      topVisibleIndex = 0;
      bottomVisibleIndex = 0;
    }
    else if (tabsThatFitInComposite >= elements.length)
    {
      topVisibleIndex = 0;
      bottomVisibleIndex = (elements.length - 1);
    }
    else if (getSelectionIndex() == -1)
    {
      topVisibleIndex = 0;
      bottomVisibleIndex = (tabsThatFitInComposite - 1);
    }
    else if (getSelectionIndex() + tabsThatFitInComposite > elements.length)
    {
      bottomVisibleIndex = (elements.length - 1);
      topVisibleIndex = (bottomVisibleIndex - tabsThatFitInComposite + 1);
    }
    else
    {
      topVisibleIndex = selectedElementIndex;
      bottomVisibleIndex = 
        (selectedElementIndex + tabsThatFitInComposite - 1);
    }
    layoutTabs();
  }
  
  private void layoutTabs()
  {
    if ((tabsThatFitInComposite == -1) || (elements.length == 0))
    {
      FormData formData = new FormData();
      left = new FormAttachment(0, 0);
      right = new FormAttachment(100, 0);
      top = new FormAttachment(0, 0);
      height = getTabHeight();
      topNavigationElement.setLayoutData(formData);
      
      formData = new FormData();
      left = new FormAttachment(0, 0);
      right = new FormAttachment(100, 0);
      top = new FormAttachment(topNavigationElement, 0);
      bottom = new FormAttachment(100, 0);
      bottomNavigationElement.setLayoutData(formData);
    }
    else
    {
      FormData formData = new FormData();
      left = new FormAttachment(0, 0);
      right = new FormAttachment(100, 0);
      top = new FormAttachment(0, 0);
      height = 10;
      topNavigationElement.setLayoutData(formData);
      
      Canvas nextElement = topNavigationElement;
      for (int i = 0; i < elements.length; i++) {
        if ((i < topVisibleIndex) || (i > bottomVisibleIndex))
        {
          elements[i].setLayoutData(null);
          elements[i].setVisible(false);
        }
        else
        {
          formData = new FormData();
          height = getTabHeight();
          left = new FormAttachment(0, 0);
          right = new FormAttachment(100, 0);
          top = new FormAttachment(nextElement, 0);
          nextElement = elements[i];
          elements[i].setLayoutData(formData);
          elements[i].setVisible(true);
        }
      }
      formData = new FormData();
      left = new FormAttachment(0, 0);
      right = new FormAttachment(100, 0);
      top = new FormAttachment(nextElement, 0);
      bottom = new FormAttachment(100, 0);
      height = 10;
      bottomNavigationElement.setLayoutData(formData);
    }
    Composite grandparent = getParent().getParent();
    grandparent.layout(true);
    layout(true);
  }
  
  private void initAccessible()
  {
    Accessible accessible = getAccessible();
    accessible.addAccessibleListener(new AccessibleAdapter()
    {
      public void getName(AccessibleEvent e)
      {
        if (getSelectionIndex() != -1) {
          result = elements[getSelectionIndex()].getTabItem()
            .getText();
        }
      }
      
      public void getHelp(AccessibleEvent e)
      {
        if (getSelectionIndex() != -1) {
          result = elements[getSelectionIndex()].getTabItem()
            .getText();
        }
      }
    });
    accessible.addAccessibleControlListener(new AccessibleControlAdapter()
    {
      public void getChildAtPoint(AccessibleControlEvent e)
      {
        Point pt = toControl(new Point(x, y));
        childID = (getBounds().contains(pt) ? -1 : 
          -2);
      }
      
      public void getLocation(AccessibleControlEvent e)
      {
        if (getSelectionIndex() != -1)
        {
          Rectangle location = elements[getSelectionIndex()]
            .getBounds();
          Point pt = toDisplay(new Point(x, y));
          x = x;
          y = y;
          width = width;
          height = height;
        }
      }
      
      public void getChildCount(AccessibleControlEvent e)
      {
        detail = 0;
      }
      
      public void getRole(AccessibleControlEvent e)
      {
        detail = 37;
      }
      
      public void getState(AccessibleControlEvent e)
      {
        detail = 3145734;
      }
    });
    addListener(13, new Listener()
    {
      private final Accessible val$accessible;
      
      public void handleEvent(Event event)
      {
        if (isFocusControl()) {
          val$accessible.setFocus(-1);
        }
      }
    });
    addListener(15, new Listener()
    {
      private final Accessible val$accessible;
      
      public void handleEvent(Event event)
      {
        val$accessible.setFocus(-1);
      }
    });
  }
}

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

import java.util.Comparator;
import java.util.List;

class TabbedPropertyRegistry$1
  implements Comparator
{
  final TabbedPropertyRegistry this$0;
  
  TabbedPropertyRegistry$1(TabbedPropertyRegistry paramTabbedPropertyRegistry)
  {
    this$0 = paramTabbedPropertyRegistry;
  }
  
  public int compare(Object arg0, Object arg1)
  {
    TabDescriptor one = (TabDescriptor)arg0;
    TabDescriptor two = (TabDescriptor)arg1;
    String categoryOne = one.getCategory();
    String categoryTwo = two.getCategory();
    int categoryOnePosition = TabbedPropertyRegistry.access$0(this$0, 
      this$0.propertyCategories.toArray(), categoryOne);
    int categoryTwoPosition = TabbedPropertyRegistry.access$0(this$0, 
      this$0.propertyCategories.toArray(), categoryTwo);
    return categoryOnePosition - categoryTwoPosition;
  }
}

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

import java.util.Comparator;

class TabbedPropertyRegistry$2
  implements Comparator
{
  final TabbedPropertyRegistry this$0;
  
  TabbedPropertyRegistry$2(TabbedPropertyRegistry paramTabbedPropertyRegistry)
  {
    this$0 = paramTabbedPropertyRegistry;
  }
  
  public int compare(Object arg0, Object arg1)
  {
    TabDescriptor one = (TabDescriptor)arg0;
    TabDescriptor two = (TabDescriptor)arg1;
    if (two.getAfterTab().equals(one.getId())) {
      return -1;
    }
    if (one.getAfterTab().equals(two.getId())) {
      return 1;
    }
    return 0;
  }
}

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

import com.ibm.icu.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.viewers.IBaseLabelProvider;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.internal.views.properties.tabbed.TabbedPropertyViewPlugin;
import org.eclipse.ui.internal.views.properties.tabbed.l10n.TabbedPropertyMessages;
import org.eclipse.ui.views.properties.tabbed.AbstractTabDescriptor;
import org.eclipse.ui.views.properties.tabbed.IActionProvider;
import org.eclipse.ui.views.properties.tabbed.ISectionDescriptor;
import org.eclipse.ui.views.properties.tabbed.ISectionDescriptorProvider;
import org.eclipse.ui.views.properties.tabbed.ITabDescriptor;
import org.eclipse.ui.views.properties.tabbed.ITabDescriptorProvider;
import org.eclipse.ui.views.properties.tabbed.ITypeMapper;
import org.osgi.framework.Bundle;

public class TabbedPropertyRegistry
{
  private static final String NO_TAB_ERROR = TabbedPropertyMessages.TabbedPropertyRegistry_Non_existing_tab;
  private static final String CONTRIBUTOR_ERROR = TabbedPropertyMessages.TabbedPropertyRegistry_contributor_error;
  private static final String TAB_ERROR = TabbedPropertyMessages.TabDescriptor_Tab_unknown_category;
  private static final String EXTPT_CONTRIBUTOR = "propertyContributor";
  private static final String EXTPT_TABS = "propertyTabs";
  private static final String EXTPT_SECTIONS = "propertySections";
  private static final String ELEMENT_TAB = "propertyTab";
  private static final String ELEMENT_SECTION = "propertySection";
  private static final String ELEMENT_PROPERTY_CATEGORY = "propertyCategory";
  private static final String ATT_CATEGORY = "category";
  private static final String ATT_CONTRIBUTOR_ID = "contributorId";
  private static final String ATT_TYPE_MAPPER = "typeMapper";
  private static final String ATT_LABEL_PROVIDER = "labelProvider";
  private static final String ATT_ACTION_PROVIDER = "actionProvider";
  private static final String ATT_SECTION_DESCRIPTOR_PROVIDER = "sectionDescriptorProvider";
  private static final String ATT_TAB_DESCRIPTOR_PROVIDER = "tabDescriptorProvider";
  private static final String ATT_OVERRIDABLE_TAB_LIST_CONTENT_PROVIDER = "overridableTabListContentProvider";
  private static final String TOP = "top";
  protected String contributorId;
  protected IConfigurationElement contributorConfigurationElement;
  protected List propertyCategories;
  protected ILabelProvider labelProvider;
  protected IActionProvider actionProvider;
  protected ITypeMapper typeMapper;
  protected ISectionDescriptorProvider sectionDescriptorProvider;
  protected ITabDescriptorProvider tabDescriptorProvider;
  protected ITabDescriptor[] tabDescriptors;
  protected static final AbstractTabDescriptor[] EMPTY_DESCRIPTOR_ARRAY = new TabDescriptor[0];
  protected boolean overridableTabListContentProvider = false;
  
  protected TabbedPropertyRegistry(String id)
  {
    contributorId = id;
    propertyCategories = new ArrayList();
    IConfigurationElement[] extensions = getConfigurationElements("propertyContributor");
    for (int i = 0; i < extensions.length; i++)
    {
      IConfigurationElement configurationElement = extensions[i];
      String contributor = configurationElement
        .getAttribute("contributorId");
      if ((contributor != null) && (id.equals(contributor)))
      {
        contributorConfigurationElement = configurationElement;
        try
        {
          if (configurationElement.getAttribute("labelProvider") != null) {
            labelProvider = 
              ((ILabelProvider)configurationElement.createExecutableExtension("labelProvider"));
          }
          if (configurationElement.getAttribute("actionProvider") != null) {
            actionProvider = 
              ((IActionProvider)configurationElement.createExecutableExtension("actionProvider"));
          }
          if (configurationElement.getAttribute("typeMapper") != null) {
            typeMapper = 
              ((ITypeMapper)configurationElement.createExecutableExtension("typeMapper"));
          }
          if (configurationElement
            .getAttribute("sectionDescriptorProvider") != null) {
            sectionDescriptorProvider = 
              ((ISectionDescriptorProvider)configurationElement.createExecutableExtension("sectionDescriptorProvider"));
          }
          if (configurationElement
            .getAttribute("tabDescriptorProvider") != null) {
            tabDescriptorProvider = 
              ((ITabDescriptorProvider)configurationElement.createExecutableExtension("tabDescriptorProvider"));
          }
          if (configurationElement
            .getAttribute("overridableTabListContentProvider") != null)
          {
            String attributeBoolean = configurationElement
              .getAttribute("overridableTabListContentProvider");
            overridableTabListContentProvider = attributeBoolean
              .equals("true");
          }
        }
        catch (CoreExce
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