org.eclipse.linuxtools.dataviewers_4.0.0.201310101546

16:46:05.559 INFO  jd.cli.Main - Decompiling org.eclipse.linuxtools.dataviewers_4.0.0.201310101546.jar
package org.eclipse.linuxtools.dataviewers;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;

public class STDataViewersActivator
  extends AbstractUIPlugin
{
  public static final String PLUGIN_ID = "org.eclipse.linuxtools.dataviewers";
  private static STDataViewersActivator plugin;
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
    plugin = this;
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    plugin = null;
    super.stop(context);
  }
  
  public static STDataViewersActivator getDefault()
  {
    return plugin;
  }
  
  public static String getUniqueIdentifier()
  {
    return "org.eclipse.linuxtools.dataviewers";
  }
  
  public static ImageDescriptor getImageDescriptor(String path)
  {
    return imageDescriptorFromPlugin("org.eclipse.linuxtools.dataviewers", path);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.dataviewers.STDataViewersActivator
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.dataviewers.abstractview;

import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.viewers.ColumnViewer;
import org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTViewer;

class AbstractSTDataView$1
  implements IMenuListener
{
  AbstractSTDataView$1(AbstractSTDataView paramAbstractSTDataView) {}
  
  public void menuAboutToShow(IMenuManager mgr)
  {
    this$0.getSTViewer().getViewer().cancelEditing();
    this$0.fillContextMenu(mgr);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.dataviewers.abstractview.AbstractSTDataView.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.dataviewers.abstractview;

import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.viewers.ColumnViewer;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTTreeViewer;
import org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTViewer;
import org.eclipse.linuxtools.dataviewers.abstractviewers.ISTDataViewersField;
import org.eclipse.linuxtools.dataviewers.actions.STCollapseAllTreeAction;
import org.eclipse.linuxtools.dataviewers.actions.STCollapseSelectionAction;
import org.eclipse.linuxtools.dataviewers.actions.STCopyAction;
import org.eclipse.linuxtools.dataviewers.actions.STDataViewersSortAction;
import org.eclipse.linuxtools.dataviewers.actions.STExpandAllTreeAction;
import org.eclipse.linuxtools.dataviewers.actions.STExpandSelectionAction;
import org.eclipse.linuxtools.dataviewers.actions.STExportToCSVAction;
import org.eclipse.linuxtools.dataviewers.actions.STHideShowColAction;
import org.eclipse.linuxtools.dataviewers.findreplace.ISTFindReplaceTarget;
import org.eclipse.linuxtools.dataviewers.findreplace.STFindReplaceAction;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.ViewPart;
import org.eclipse.ui.preferences.ViewPreferencesAction;
import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
import org.eclipse.ui.texteditor.ITextEditorActionConstants;

public abstract class AbstractSTDataView
  extends ViewPart
{
  private AbstractSTViewer stViewer = null;
  private IAction sortAction = null;
  private IAction preferencesAction = null;
  private IAction hideShowColAction = null;
  private IAction expandAllAction = null;
  private IAction collapseAllAction = null;
  private IAction expandSelectionAction = null;
  private IAction collapseSelectionAction = null;
  private IAction exportToCSVAction = null;
  private IAction copyToAction = null;
  private ISTFindReplaceTarget fTarget = null;
  
  public void init(IViewSite site, IMemento memento)
    throws PartInitException
  {
    super.init(site, memento);
  }
  
  protected void createTitle(Composite parent) {}
  
  public void createPartControl(Composite parent)
  {
    GridLayout gridLayout = new GridLayout(1, true);
    parent.setLayout(gridLayout);
    createTitle(parent);
    stViewer = createAbstractSTViewer(parent);
    
    createActions();
    
    MenuManager mgr = initContextMenu();
    Menu menu = mgr.createContextMenu(parent);
    stViewer.getViewer().getControl().setMenu(menu);
    
    getSite().registerContextMenu(mgr, getSelectionProvider());
    
    getSite().setSelectionProvider(getSelectionProvider());
    
    IActionBars actionBars = getViewSite().getActionBars();
    
    initMenu(actionBars.getMenuManager());
    initToolBar(actionBars.getToolBarManager());
    
    registerGlobalActions(getViewSite().getActionBars());
  }
  
  protected void createActions()
  {
    expandAllAction = createExpandAllAction();
    collapseAllAction = createCollapseAllAction();
    
    sortAction = createSortAction();
    
    hideShowColAction = createHideShowColumnAction();
    
    exportToCSVAction = createExportToCSVAction();
    
    expandSelectionAction = createExpandSelectionAction();
    collapseSelectionAction = createCollapseSelectionAction();
    copyToAction = createCopyToAction();
  }
  
  protected IAction createCopyToAction()
  {
    return new STCopyAction(getSTViewer());
  }
  
  protected IAction createExportToCSVAction()
  {
    return new STExportToCSVAction(getSTViewer());
  }
  
  protected IAction createCollapseSelectionAction()
  {
    if ((getSTViewer() instanceof AbstractSTTreeViewer))
    {
      AbstractSTTreeViewer stTreeViewer = 
        (AbstractSTTreeViewer)getSTViewer();
      return new STCollapseSelectionAction(stTreeViewer);
    }
    return null;
  }
  
  protected IAction createExpandSelectionAction()
  {
    if ((getSTViewer() instanceof AbstractSTTreeViewer))
    {
      AbstractSTTreeViewer stTreeViewer = 
        (AbstractSTTreeViewer)getSTViewer();
      return new STExpandSelectionAction(stTreeViewer);
    }
    return null;
  }
  
  protected IAction createHideShowColumnAction()
  {
    return new STHideShowColAction(getSTViewer());
  }
  
  protected IAction createSortAction()
  {
    return new STDataViewersSortAction(getSTViewer());
  }
  
  protected IAction createCollapseAllAction()
  {
    if ((getSTViewer() instanceof AbstractSTTreeViewer))
    {
      AbstractSTTreeViewer stTreeViewer = 
        (AbstractSTTreeViewer)getSTViewer();
      return new STCollapseAllTreeAction(stTreeViewer);
    }
    return null;
  }
  
  protected IAction createExpandAllAction()
  {
    if ((getSTViewer() instanceof AbstractSTTreeViewer))
    {
      AbstractSTTreeViewer stTreeViewer = 
        (AbstractSTTreeViewer)getSTViewer();
      return new STExpandAllTreeAction(stTreeViewer);
    }
    return null;
  }
  
  protected MenuManager initContextMenu()
  {
    MenuManager mgr = new MenuManager();
    mgr.setRemoveAllWhenShown(true);
    mgr.addMenuListener(new IMenuListener()
    {
      public void menuAboutToShow(IMenuManager mgr)
      {
        getSTViewer().getViewer().cancelEditing();
        fillContextMenu(mgr);
      }
    });
    return mgr;
  }
  
  protected void initToolBar(IToolBarManager manager)
  {
    if (expandAllAction != null) {
      manager.add(expandAllAction);
    }
    if (collapseAllAction != null) {
      manager.add(collapseAllAction);
    }
    if (hideShowColAction != null) {
      manager.add(hideShowColAction);
    }
    if (exportToCSVAction != null) {
      manager.add(exportToCSVAction);
    }
    if (sortAction != null) {
      manager.add(sortAction);
    }
    contributeToToolbar(manager);
    manager.update(true);
  }
  
  protected void initMenu(IMenuManager menu)
  {
    if (sortAction != null) {
      menu.add(sortAction);
    }
    if (hideShowColAction != null) {
      menu.add(hideShowColAction);
    }
    if (preferencesAction != null) {
      menu.add(preferencesAction);
    }
    if (exportToCSVAction != null) {
      menu.add(exportToCSVAction);
    }
    contributeToDropDownMenu(menu);
  }
  
  public void setFocus()
  {
    Viewer viewer = getSTViewer().getViewer();
    if ((viewer != null) && (!viewer.getControl().isDisposed())) {
      viewer.getControl().setFocus();
    }
  }
  
  public AbstractSTViewer getSTViewer()
  {
    return stViewer;
  }
  
  public Control getControl()
  {
    return stViewer.getViewer().getControl();
  }
  
  public void setInput(Object input)
  {
    stViewer.getViewer().setInput(input);
  }
  
  protected IWorkbenchSiteProgressService getProgressService()
  {
    IWorkbenchSiteProgressService service = null;
    Object siteService = getSite().getAdapter(
      IWorkbenchSiteProgressService.class);
    if (siteService != null) {
      service = (IWorkbenchSiteProgressService)siteService;
    }
    return service;
  }
  
  protected IAction getPreferencesAction()
  {
    return preferencesAction;
  }
  
  protected void setPreferencesAction(ViewPreferencesAction preferencesAction)
  {
    this.preferencesAction = preferencesAction;
  }
  
  protected ISelectionProvider getSelectionProvider()
  {
    return stViewer.getViewer();
  }
  
  public Object getViewerInput()
  {
    return stViewer.getViewer().getInput();
  }
  
  protected void setSelection(IStructuredSelection selection)
  {
    getSelectionProvider().setSelection(selection);
  }
  
  protected void fillContextMenu(IMenuManager manager)
  {
    if ((getControl() != null) && 
      ((getControl() instanceof Tree)))
    {
      Tree tree = (Tree)getControl();
      TreeItem[] selection = tree.getSelection();
      if ((selection != null) && 
        (selection.length > 0))
      {
        if (collapseSelectionAction != null) {
          manager.add(collapseSelectionAction);
        }
        if (expandSelectionAction != null) {
          manager.add(expandSelectionAction);
        }
        manager.add(new Separator("additions"));
        if (copyToAction != null) {
          manager.add(copyToAction);
        }
      }
    }
    manager.add(new Separator("additions"));
  }
  
  protected void contributeToDropDownMenu(IMenuManager menu) {}
  
  protected void contributeToToolbar(IToolBarManager manager) {}
  
  protected void registerGlobalActions(IActionBars actionBars)
  {
    fTarget = createSTFindReplaceTarget();
    if (fTarget == null) {
      return;
    }
    STFindReplaceAction action = new STFindReplaceAction(getSite().getShell(), fTarget);
    actionBars.setGlobalActionHandler(ITextEditorActionConstants.FIND, action);
  }
  
  public ISTFindReplaceTarget createSTFindReplaceTarget()
  {
    return null;
  }
  
  protected ISTDataViewersField[] getSortingFields()
  {
    return null;
  }
  
  protected abstract AbstractSTViewer createAbstractSTViewer(Composite paramComposite);
  
  public void dispose()
  {
    super.dispose();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.dataviewers.abstractview.AbstractSTDataView
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.dataviewers.abstractviewers;

import java.text.NumberFormat;
import org.eclipse.linuxtools.dataviewers.listeners.ISpecialDrawerListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Item;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeColumn;
import org.eclipse.swt.widgets.Widget;

public abstract class AbstractPercentageDrawerField
  extends AbstractSTDataViewersField
  implements ISpecialDrawerListener
{
  public ISpecialDrawerListener getSpecialDrawer(Object obj)
  {
    return this;
  }
  
  public String getValue(Object obj)
  {
    return getPercentage(obj);
  }
  
  public abstract float getPercentage(Object paramObject);
  
  public void handleEvent(Event event)
  {
    Item item = (Item)item;
    Display display = widget.getDisplay();
    int index = index;
    int widthcol = 0;
    if ((widget instanceof Tree))
    {
      Tree tree = 
        (Tree)widget;
      widthcol = 
        tree.getColumn(index).getWidth();
    }
    else
    {
      Table table = 
        (Table)widget;
      widthcol = 
        table.getColumn(index).getWidth();
    }
    float d = getPercentage(item.getData());
    int percent = (int)(d + 0.5D);
    GC gc = gc;
    Color foreground = gc.getForeground();
    Color background = gc.getBackground();
    gc.setForeground(display.getSystemColor(3));
    gc.setBackground(display.getSystemColor(7));
    int width = (widthcol - 1) * percent / 100;
    if (width > 0)
    {
      gc.fillGradientRectangle(x, y, width, height, true);
      Rectangle rect = new Rectangle(x, y, width - 1, height - 1);
      gc.drawRectangle(rect);
    }
    gc.setForeground(display.getSystemColor(24));
    String text = "%";
    text = (isSettedNumberFormat() ? getNumberFormat().format(d) : Float.valueOf(d)) + text;
    Point size = gc.textExtent(text);
    int offset = Math.max(0, (height - y) / 2);
    gc.drawText(text, x + 2, y + offset, true);
    gc.setForeground(foreground);
    gc.setBackground(background);
  }
  
  public abstract NumberFormat getNumberFormat();
  
  public abstract boolean isSettedNumberFormat();
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractPercentageDrawerField
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.dataviewers.abstractviewers;

import org.eclipse.linuxtools.dataviewers.listeners.ISpecialDrawerListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;

public abstract class AbstractSTDataViewersField
  implements ISTDataViewersField
{
  private boolean showing = true;
  
  public Image getColumnHeaderImage()
  {
    return null;
  }
  
  public int getDefaultDirection()
  {
    return 1;
  }
  
  public String getDescription()
  {
    return getColumnHeaderText();
  }
  
  public Image getDescriptionImage()
  {
    return null;
  }
  
  public Image getImage(Object obj)
  {
    return null;
  }
  
  public int getPreferredWidth()
  {
    return 100;
  }
  
  public boolean isShowing()
  {
    return showing;
  }
  
  public void setShowing(boolean showing)
  {
    this.showing = showing;
  }
  
  public ISpecialDrawerListener getSpecialDrawer(Object element)
  {
    return null;
  }
  
  public Color getBackground(Object element)
  {
    return null;
  }
  
  public Color getForeground(Object element)
  {
    return null;
  }
  
  public String getToolTipText(Object element)
  {
    return null;
  }
  
  public String getColumnHeaderTooltip()
  {
    return getColumnHeaderText();
  }
  
  public String toString()
  {
    return getColumnHeaderText();
  }
  
  public int getAlignment()
  {
    return 0;
  }
  
  public boolean isHyperLink(Object element)
  {
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTDataViewersField
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.dataviewers.abstractviewers;

import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;

class AbstractSTTableViewer$1
  extends MouseAdapter
{
  AbstractSTTableViewer$1(AbstractSTTableViewer paramAbstractSTTableViewer) {}
  
  public void mouseDoubleClick(MouseEvent e)
  {
    Table table = (Table)widget;
    TableItem item = table.getItem(new Point(x, y));
    if (item != null) {
      for (int i = 0; i < table.getColumnCount(); i++)
      {
        ISTDataViewersField field = this$0.getAllFields()[i];
        if (field.isHyperLink(item.getData()))
        {
          Rectangle bounds = item.getBounds(i);
          if (bounds.contains(x, y)) {
            this$0.handleHyperlink(field, item.getData());
          }
        }
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTTableViewer.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.dataviewers.abstractviewers;

import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;

class AbstractSTTableViewer$2
  implements MouseMoveListener
{
  AbstractSTTableViewer$2(AbstractSTTableViewer paramAbstractSTTableViewer) {}
  
  public void mouseMove(MouseEvent e)
  {
    Table table = (Table)widget;
    TableItem item = table.getItem(new Point(x, y));
    if (item == null) {
      return;
    }
    for (int i = 0; i < table.getColumnCount(); i++)
    {
      ISTDataViewersField field = this$0.getAllFields()[i];
      Cursor cursor = null;
      if (field.isHyperLink(item.getData()))
      {
        Rectangle bounds = item.getBounds(i);
        if (bounds.contains(x, y))
        {
          cursor = new Cursor(display, 21);
          table.setCursor(cursor);
          return;
        }
      }
      cursor = new Cursor(display, 0);
      table.setCursor(cursor);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTTableViewer.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.dataviewers.abstractviewers;

import org.eclipse.jface.viewers.ColumnViewer;
import org.eclipse.jface.viewers.TableLayout;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TableViewerColumn;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Item;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;

public abstract class AbstractSTTableViewer
  extends AbstractSTViewer
{
  public AbstractSTTableViewer(Composite parent)
  {
    super(parent, 68354);
  }
  
  public AbstractSTTableViewer(Composite parent, boolean init)
  {
    super(parent, 68354, init);
  }
  
  public AbstractSTTableViewer(Composite parent, int style)
  {
    super(parent, style, true);
  }
  
  public AbstractSTTableViewer(Composite parent, int style, boolean init)
  {
    super(parent, style, init);
  }
  
  protected ColumnViewer createViewer(Composite parent, int style)
  {
    return new TableViewer(
      createTable(parent, style));
  }
  
  protected Table createTable(Composite parent, int style)
  {
    Table table = new Table(parent, style);
    table.setLinesVisible(true);
    table.setHeaderVisible(true);
    
    return table;
  }
  
  protected void createColumns()
  {
    Table table = getViewer().getTable();
    TableLayout layout = new TableLayout();
    table.setLayout(layout);
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    for (int i = 0; i < getAllFields().length; i++)
    {
      ISTDataViewersField field = getAllFields()[i];
      TableColumn tc = new TableColumn(table, field.getAlignment(), i);
      tc.setText(field.getColumnHeaderText());
      tc.setToolTipText(field.getColumnHeaderTooltip());
      tc.setImage(field.getColumnHeaderImage());
      tc.setWidth(field.getPreferredWidth());
      tc.setResizable(true);
      tc.setMoveable(true);
      
      tc.addSelectionListener(createHeaderListener());
      tc.setData(field);
      
      TableViewerColumn viewerColumn = 
        new TableViewerColumn(getViewer(), tc);
      viewerColumn.setLabelProvider(createColumnLabelProvider(tc));
    }
    table.addMouseListener(new MouseAdapter()
    {
      public void mouseDoubleClick(MouseEvent e)
      {
        Table table = (Table)widget;
        TableItem item = table.getItem(new Point(x, y));
        if (item != null) {
          for (int i = 0; i < table.getColumnCount(); i++)
          {
            ISTDataViewersField field = getAllFields()[i];
            if (field.isHyperLink(item.getData()))
            {
              Rectangle bounds = item.getBounds(i);
              if (bounds.contains(x, y)) {
                handleHyperlink(field, item.getData());
              }
            }
          }
        }
      }
    });
    table.addMouseMoveListener(new MouseMoveListener()
    {
      public void mouseMove(MouseEvent e)
      {
        Table table = (Table)widget;
        TableItem item = table.getItem(new Point(x, y));
        if (item == null) {
          return;
        }
        for (int i = 0; i < table.getColumnCount(); i++)
        {
          ISTDataViewersField field = getAllFields()[i];
          Cursor cursor = null;
          if (field.isHyperLink(item.getData()))
          {
            Rectangle bounds = item.getBounds(i);
            if (bounds.contains(x, y))
            {
              cursor = new Cursor(display, 21);
              table.setCursor(cursor);
              return;
            }
          }
          cursor = new Cursor(display, 0);
          table.setCursor(cursor);
        }
      }
    });
  }
  
  public Item[] getColumns()
  {
    return getViewer().getTable().getColumns();
  }
  
  public void updateDirectionIndicator(Item column)
  {
    getViewer().getTable().setSortColumn((TableColumn)column);
    if (getTableSorter().getTopPriorityDirection() == 1) {
      getViewer().getTable().setSortDirection(128);
    } else {
      getViewer().getTable().setSortDirection(1024);
    }
  }
  
  public int[] getColumnOrder()
  {
    return getViewer().getTable().getColumnOrder();
  }
  
  protected void setColumnOrder(int[] order)
  {
    getViewer().getTable().setColumnOrder(order);
  }
  
  public int getColumnIndex(Item column)
  {
    return getViewer().getTable().indexOf((TableColumn)column);
  }
  
  public int getColumnWidth(Item column)
  {
    return ((TableColumn)column).getWidth();
  }
  
  public void setColumnResizable(Item column, boolean resizable)
  {
    ((TableColumn)column).setResizable(resizable);
  }
  
  public void setColumnWidth(Item column, int width)
  {
    ((TableColumn)column).setWidth(width);
  }
  
  public TableViewer getViewer()
  {
    return (TableViewer)super.getViewer();
  }
  
  public void handleHyperlink(ISTDataViewersField field, Object data) {}
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTTableViewer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.dataviewers.abstractviewers;

import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.widgets.Tree;

class AbstractSTTreeViewer$1
  extends TreeViewer
{
  AbstractSTTreeViewer$1(AbstractSTTreeViewer paramAbstractSTTreeViewer, Tree $anonymous0)
  {
    super($anonymous0);
  }
  
  public void refresh(Object element)
  {
    getTree().setRedraw(false);
    Object[] elements = getExpandedElements();
    super.refresh(element);
    setExpandedElements(elements);
    getTree().setRedraw(true);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTTreeViewer.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.dataviewers.abstractviewers;

import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;

class AbstractSTTreeViewer$2
  extends MouseAdapter
{
  AbstractSTTreeViewer$2(AbstractSTTreeViewer paramAbstractSTTreeViewer) {}
  
  public void mouseDoubleClick(MouseEvent e)
  {
    Tree tree = (Tree)widget;
    TreeItem item = tree.getItem(new Point(x, y));
    if (item != null) {
      for (int i = 0; i < tree.getColumnCount(); i++)
      {
        ISTDataViewersField field = this$0.getAllFields()[i];
        if (field.isHyperLink(item.getData()))
        {
          Rectangle bounds = item.getBounds(i);
          if (bounds.contains(x, y)) {
            this$0.handleHyperlink(field, item.getData());
          }
        }
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTTreeViewer.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.dataviewers.abstractviewers;

import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;

class AbstractSTTreeViewer$3
  implements MouseMoveListener
{
  AbstractSTTreeViewer$3(AbstractSTTreeViewer paramAbstractSTTreeViewer) {}
  
  public void mouseMove(MouseEvent e)
  {
    Tree tree = (Tree)widget;
    TreeItem item = tree.getItem(new Point(x, y));
    if (item == null) {
      return;
    }
    for (int i = 0; i < tree.getColumnCount(); i++)
    {
      ISTDataViewersField field = this$0.getAllFields()[i];
      Cursor cursor = null;
      if (field.isHyperLink(item.getData()))
      {
        Rectangle bounds = item.getBounds(i);
        if (bounds.contains(x, y))
        {
          cursor = new Cursor(display, 21);
          tree.setCursor(cursor);
          return;
        }
      }
      cursor = new Cursor(display, 0);
      tree.setCursor(cursor);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTTreeViewer.3
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.dataviewers.abstractviewers;

import org.eclipse.jface.viewers.ColumnViewer;
import org.eclipse.jface.viewers.TableLayout;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.TreeViewerColumn;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Item;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeColumn;
import org.eclipse.swt.widgets.TreeItem;

public abstract class AbstractSTTreeViewer
  extends AbstractSTViewer
{
  public AbstractSTTreeViewer(Composite parent)
  {
    super(parent, 68354);
  }
  
  public AbstractSTTreeViewer(Composite parent, boolean init)
  {
    super(parent, 68354, init);
  }
  
  public AbstractSTTreeViewer(Composite parent, int style)
  {
    super(parent, style, true);
  }
  
  public AbstractSTTreeViewer(Composite parent, int style, boolean init)
  {
    super(parent, style, init);
  }
  
  protected ColumnViewer createViewer(Composite parent, int style)
  {
    new TreeViewer(createTree(parent, style))
    {
      public void refresh(Object element)
      {
        getTree().setRedraw(false);
        Object[] elements = getExpandedElements();
        super.refresh(element);
        setExpandedElements(elements);
        getTree().setRedraw(true);
      }
    };
  }
  
  protected Tree createTree(Composite parent, int style)
  {
    Tree tree = new Tree(parent, style);
    tree.setLinesVisible(true);
    tree.setHeaderVisible(true);
    
    return tree;
  }
  
  protected void createColumns()
  {
    Tree tree = getViewer().getTree();
    TableLayout layout = new TableLayout();
    tree.setLayout(layout);
    tree.setHeaderVisible(true);
    tree.setLinesVisible(true);
    for (int i = 0; i < getAllFields().length; i++)
    {
      ISTDataViewersField field = getAllFields()[i];
      TreeColumn tc = new TreeColumn(tree, field.getAlignment(), i);
      tc.setText(field.getColumnHeaderText());
      tc.setToolTipText(field.getColumnHeaderTooltip());
      tc.setImage(field.getColumnHeaderImage());
      tc.setWidth(field.getPreferredWidth());
      tc.setResizable(true);
      tc.setMoveable(true);
      
      tc.addSelectionListener(createHeaderListener());
      tc.setData(field);
      
      TreeViewerColumn viewerColumn = 
        new TreeViewerColumn(getViewer(), tc);
      viewerColumn.setLabelProvider(createColumnLabelProvider(tc));
    }
    tree.addMouseListener(new MouseAdapter()
    {
      public void mouseDoubleClick(MouseEvent e)
      {
        Tree tree = (Tree)widget;
        TreeItem item = tree.getItem(new Point(x, y));
        if (item != null) {
          for (int i = 0; i < tree.getColumnCount(); i++)
          {
            ISTDataViewersField field = getAllFields()[i];
            if (field.isHyperLink(item.getData()))
            {
              Rectangle bounds = item.getBounds(i);
              if (bounds.contains(x, y)) {
                handleHyperlink(field, item.getData());
              }
            }
          }
        }
      }
    });
    tree.addMouseMoveListener(new MouseMoveListener()
    {
      public void mouseMove(MouseEvent e)
      {
        Tree tree = (Tree)widget;
        TreeItem item = tree.getItem(new Point(x, y));
        if (item == null) {
          return;
        }
        for (int i = 0; i < tree.getColumnCount(); i++)
        {
          ISTDataViewersField field = getAllFields()[i];
          Cursor cursor = null;
          if (field.isHyperLink(item.getData()))
          {
            Rectangle bounds = item.getBounds(i);
            if (bounds.contains(x, y))
            {
              cursor = new Cursor(display, 21);
              tree.setCursor(cursor);
              return;
            }
          }
          cursor = new Cursor(display, 0);
          tree.setCursor(cursor);
        }
      }
    });
  }
  
  public Item[] getColumns()
  {
    return getViewer().getTree().getColumns();
  }
  
  public void updateDirectionIndicator(Item column)
  {
    getViewer().getTree().setSortColumn((TreeColumn)column);
    if (getTableSorter().getTopPriorityDirection() == 1) {
      getViewer().getTree().setSortDirection(128);
    } else {
      getViewer().getTree().setSortDirection(1024);
    }
  }
  
  public int[] getColumnOrder()
  {
    return getViewer().getTree().getColumnOrder();
  }
  
  protected void setColumnOrder(int[] order)
  {
    getViewer().getTree().setColumnOrder(order);
  }
  
  public int getColumnIndex(Item column)
  {
    return getViewer().getTree().indexOf((TreeColumn)column);
  }
  
  public int getColumnWidth(Item column)
  {
    return ((TreeColumn)column).getWidth();
  }
  
  public void setColumnResizable(Item column, boolean resizable)
  {
    ((TreeColumn)column).setResizable(resizable);
  }
  
  public void setColumnWidth(Item column, int width)
  {
    ((TreeColumn)column).setWidth(width);
  }
  
  public TreeViewer getViewer()
  {
    return (TreeViewer)super.getViewer();
  }
  
  public void handleHyperlink(ISTDataViewersField field, Object data) {}
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTTreeViewer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.dataviewers.abstractviewers;

import org.eclipse.jface.viewers.IOpenListener;
import org.eclipse.jface.viewers.OpenEvent;

class AbstractSTViewer$1
  implements IOpenListener
{
  AbstractSTViewer$1(AbstractSTViewer paramAbstractSTViewer) {}
  
  public void open(OpenEvent event)
  {
    this$0.handleOpenEvent(event);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTViewer.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.dataviewers.abstractviewers;

import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;

class AbstractSTViewer$2
  extends KeyAdapter
{
  AbstractSTViewer$2(AbstractSTViewer paramAbstractSTViewer) {}
  
  public void keyPressed(KeyEvent e)
  {
    this$0.handleKeyPressed(e);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTViewer.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.linuxtools.dataviewers.abstractviewers;

import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.CellLabelProvider;
import org.eclipse.jface.viewers.ColumnViewer;
import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
import org.eclipse.jface.viewers.IContentProvider;
import org.eclipse.jface.viewers.IOpenListener;
import org.eclipse.jface.viewers.OpenEvent;
import org.eclipse.linuxtools.dataviewers.listeners.STDisposeListener;
import org.eclipse.linuxtools.dataviewers.listeners.STHeaderListener;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Item;
import org.eclipse.swt.widgets.ScrollBar;
import org.eclipse.swt.widgets.Scrollable;

public abstract class AbstractSTViewer
{
  private IDialogSettings viewerSettings = null;
  private ISTDataViewersField[] fields = null;
  private ColumnViewer viewer;
  private STDataViewersComparator comparator;
  private STDataViewersHideShowManager hideShowManager;
  
  public AbstractSTViewer(Composite parent)
  {
    this(parent, 68354);
  }
  
  public AbstractSTViewer(Composite parent, boolean init)
  {
    this(parent, 68354, init);
  }
  
  public AbstractSTViewer(Composite parent, int style)
  {
    this(parent, style, true);
  }
  
  public AbstractSTViewer(Composite parent, int style, boolean init)
  {
    if (init) {
      init(parent, style);
    }
  }
  
  protected void init(Composite parent, int style)
  {
    viewer = createViewer(parent, style);
    viewerSettings = createSTAbstractDataViewersSettings();
    
    fields = getAllFields();
    
    createColumns();
    restoreColumnOrder();
    
    STDataViewersHideShowManager manager = 
      buildHideShowManager();
    manager.restoreState(viewerSettings);
    setHideShowManager(manager);
    
    STDataViewersComparator comparator = buildComparator();
    comparator.restoreState(viewerSettings);
    setComparator(comparator);
    setSortIndicators();
    
    IContentProvider cp = 
      createContentProvider();
    
    viewer.setContentProvider(cp);
    
    STOwnerDrawLabelProvider.setUpOwnerDraw(viewer);
    
    viewer.setUseHashlookup(true);
    
    GridData data = new GridData(4, 4, true, true);
    viewer.getControl().setLayoutData(data);
    
    viewer.setInput(createDefaultViewerInput());
    
    ColumnViewerToolTipSupport.enableFor(viewer);
    
    Scrollable scrollable = (Scrollable)viewer.getControl();
    ScrollBar bar = scrollable.getVerticalBar();
    if (bar != null) {
      bar.setSelection(restoreVerticalScrollBarPosition());
    }
    bar = scrollable.getHorizontalBar();
    if (bar != null) {
      bar.setSelection(restoreHorizontalScrollBarPosition());
    }
    viewer.addOpenListener(new IOpenListener()
    {
      public void open(OpenEvent event)
      {
        handleOpenEvent(event);
      }
    });
    viewer.getControl().addKeyListener(new KeyAdapter()
    {
      public void keyPressed(KeyEvent e)
      {
        handleKeyPressed(e);
      }
    });
    viewer.getControl().addDisposeListener(
      createDisposeListener());
  }
  
  protected STDataViewersHideShowManager buildHideShowManager()
  {
    return new STDataViewersHideShowManager(this);
  }
  
  public void setHideShowManager(STDataViewersHideShowManager manager)
  {
    hideShowManager = manager;
    updateForNewHideShowManager(hideShowManager);
  }
  
  protected void updateForNewHideShowManager(STDataViewersHideShowManager manager)
  {
    manager.updateColumns(getColumns());
  }
  
  protected STDataViewersComparator buildComparator()
  {
    return new STDataViewersComparator(getColumns());
  }
  
  public STDataViewersComparator getTableSorter()
  {
    return comparator;
  }
  
  public void setComparator(STDataViewersComparator comparator)
  {
    this.comparator = comparator;
    viewer.setComparator(comparator);
    updateForNewComparator(comparator);
  }
  
  protected void updateForNewComparator(STDataViewersComparator comparator)
  {
    comparator.saveState(viewerSettings);
    viewer.refresh();
    setSortIndicators();
  }
  
  protected void setSortIndicators()
  {
    Item topc = getTableSorter().getTopColumn();
    updateDirectionIndicator(topc);
  }
  
  protected IDialogSettings createSTAbstractDataViewersSettings()
  {
    IDialogSettings settings = 
      getDialogSettings().getSection("viewer_state_section");
    if (settings == null) {
      settings = getDialogSettings().addNewSection("viewer_state_section");
    }
    return settings;
  }
  
  public void restoreColumnOrder()
  {
    int[] order = restoreColumnOrderSetting();
    if ((order != null) && (order.length == fields.length)) {
      setColumnOrder(order);
    }
  }
  
  public int restoreVerticalScrollBarPosition()
  {
    if (viewerSettings == null) {
      return 0;
    }
    String position = viewerSettings.get("vertical_position");
    if (position == null) {
      return 0;
    }
    try
    {
      return Integer.parseInt(position);
    }
    catch (NumberFormatException localNumberFormatException) {}
    return 0;
  }
  
  public int restoreHorizontalScrollBarPosition()
  {
    if (viewerSettings == null) {
      return 0;
    }
    String position = viewerSettings.get("horizontal_position");
    if (position == null) {
      return 0;
    }
    try
    {
      return Integer.parseInt(position);
    }
    catch (NumberFormatException localNumberFormatException) {}
    return 0;
  }
  
  public int[] restoreColumnOrderSetting()
  {
    if (viewerSettings == null) {
      return null;
    }
    String[] columnOrder = viewerSettings.getArray("column_order");
    if (columnOrder == null) {
      return null;
    }
    int n = columnOrder.length;
    if (n != getAllFields().length) {
      return null;
    }
    try
    {
      int[] values = new int[n];
      for (int i = 0; i < n; i++)
      {
        int val = Integer.parseInt(columnOrder[i]);
        values[i] = val;
      }
      return values;
    }
    catch (NumberFormatException localNumberFormatException) {}
    return null;
  }
  
  public void saveState()
  {
    if (viewerSettings == null) {
      v
1 2 3 4 5 6 7 8

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-2017. Infinite Loop Ltd