org.eclipse.e4.ui.workbench.renderers.swt_0.10.3.v20130124-170312

16:43:02.791 INFO  jd.cli.Main - Decompiling org.eclipse.e4.ui.workbench.renderers.swt_0.10.3.v20130124-170312.jar
package org.eclipse.e4.ui.internal.workbench.renderers.swt;

import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Text;

class AbstractTableInformationControl$1
  implements KeyListener
{
  AbstractTableInformationControl$1(AbstractTableInformationControl paramAbstractTableInformationControl, Table paramTable) {}
  
  public void keyPressed(KeyEvent e)
  {
    switch (keyCode)
    {
    case 27: 
      this$0.dispose();
      break;
    case 127: 
      this$0.removeSelectedItems();
      character = '\000';
      doit = false;
      break;
    case 16777217: 
      if (val$table.getSelectionIndex() == 0) {
        AbstractTableInformationControl.access$1(this$0).setFocus();
      }
      break;
    case 16777218: 
      if (val$table.getSelectionIndex() == val$table.getItemCount() - 1) {
        AbstractTableInformationControl.access$1(this$0).setFocus();
      }
      break;
    }
  }
  
  public void keyReleased(KeyEvent e) {}
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.internal.workbench.renderers.swt.AbstractTableInformationControl.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.internal.workbench.renderers.swt;

import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;

class AbstractTableInformationControl$2
  implements SelectionListener
{
  AbstractTableInformationControl$2(AbstractTableInformationControl paramAbstractTableInformationControl) {}
  
  public void widgetSelected(SelectionEvent e) {}
  
  public void widgetDefaultSelected(SelectionEvent e)
  {
    this$0.gotoSelectedElement();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.internal.workbench.renderers.swt.AbstractTableInformationControl.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.internal.workbench.renderers.swt;

import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Item;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;

class AbstractTableInformationControl$3
  implements MouseMoveListener
{
  TableItem fLastItem;
  int lastY;
  int itemHeightdiv4;
  int tableHeight;
  Point tableLoc;
  int divCount;
  
  AbstractTableInformationControl$3(AbstractTableInformationControl paramAbstractTableInformationControl, Table paramTable, int paramInt)
  {
    fLastItem = null;
    lastY = 0;
    itemHeightdiv4 = (paramTable.getItemHeight() / 4);
    tableHeight = getBoundsheight;
    tableLoc = paramTable.toDisplay(0, 0);
    divCount = 0;
  }
  
  public void mouseMove(MouseEvent e)
  {
    if (divCount == val$ignoreEventCount) {
      divCount = 0;
    }
    if ((val$table.equals(e.getSource()) & ++divCount == val$ignoreEventCount))
    {
      Object o = val$table.getItem(new Point(x, y));
      if (((fLastItem == null ? 1 : 0) ^ (o == null ? 1 : 0)) != 0) {
        val$table.setCursor(o == null ? null : val$table.getDisplay()
          .getSystemCursor(21));
      }
      if (((o instanceof TableItem)) && (lastY != y))
      {
        lastY = y;
        if (!o.equals(fLastItem))
        {
          fLastItem = ((TableItem)o);
          val$table.setSelection(new TableItem[] { fLastItem });
        }
        else if (y < itemHeightdiv4)
        {
          Item item = AbstractTableInformationControl.access$2(this$0).scrollUp(x + tableLoc.x, 
            y + tableLoc.y);
          if ((item instanceof TableItem))
          {
            fLastItem = ((TableItem)item);
            val$table.setSelection(new TableItem[] { fLastItem });
          }
        }
        else if (y > tableHeight - itemHeightdiv4)
        {
          Item item = AbstractTableInformationControl.access$2(this$0).scrollDown(x + 
            tableLoc.x, y + tableLoc.y);
          if ((item instanceof TableItem))
          {
            fLastItem = ((TableItem)item);
            val$table.setSelection(new TableItem[] { fLastItem });
          }
        }
      }
      else if (o == null)
      {
        fLastItem = null;
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.internal.workbench.renderers.swt.AbstractTableInformationControl.3
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.internal.workbench.renderers.swt;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class AbstractTableInformationControl$4$1
  extends SelectionAdapter
{
  AbstractTableInformationControl$4$1(AbstractTableInformationControl.4 param4) {}
  
  public void widgetSelected(SelectionEvent selectionEvent)
  {
    AbstractTableInformationControl.4.access$0(this$1).removeSelectedItems();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.internal.workbench.renderers.swt.AbstractTableInformationControl.4.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.internal.workbench.renderers.swt;

import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;

class AbstractTableInformationControl$4
  extends MouseAdapter
{
  AbstractTableInformationControl$4(AbstractTableInformationControl paramAbstractTableInformationControl, Table paramTable) {}
  
  public void mouseUp(MouseEvent e)
  {
    if (val$table.getSelectionCount() < 1) {
      return;
    }
    if ((button == 1) && 
      (val$table.equals(e.getSource())))
    {
      Object o = val$table.getItem(new Point(x, y));
      TableItem selection = val$table.getSelection()[0];
      if (selection.equals(o)) {
        this$0.gotoSelectedElement();
      }
    }
    if (button == 3)
    {
      TableItem tItem = AbstractTableInformationControl.access$2(this$0).getTable().getItem(
        new Point(x, y));
      if (tItem != null)
      {
        Menu menu = new Menu(AbstractTableInformationControl.access$2(this$0).getTable());
        MenuItem mItem = new MenuItem(menu, 0);
        mItem.setText(SWTRenderersMessages.menuClose);
        mItem.addSelectionListener(new SelectionAdapter()
        {
          public void widgetSelected(SelectionEvent selectionEvent)
          {
            this$0.removeSelectedItems();
          }
        });
        menu.setVisible(true);
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.internal.workbench.renderers.swt.AbstractTableInformationControl.4
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.internal.workbench.renderers.swt;

import org.eclipse.swt.events.TraverseEvent;
import org.eclipse.swt.events.TraverseListener;
import org.eclipse.swt.widgets.Table;

class AbstractTableInformationControl$5
  implements TraverseListener
{
  AbstractTableInformationControl$5(AbstractTableInformationControl paramAbstractTableInformationControl, Table paramTable) {}
  
  public void keyTraversed(TraverseEvent e)
  {
    switch (detail)
    {
    case 512: 
      detail = 0;
      doit = true;
      
      int n = val$table.getItemCount();
      if (n == 0) {
        return;
      }
      int i = val$table.getSelectionIndex() + 1;
      if (i >= n) {
        i = 0;
      }
      val$table.setSelection(i);
      
      break;
    case 256: 
      detail = 0;
      doit = true;
      
      int n = val$table.getItemCount();
      if (n == 0) {
        return;
      }
      int i = val$table.getSelectionIndex() - 1;
      if (i < 0) {
        i = n - 1;
      }
      val$table.setSelection(i);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.internal.workbench.renderers.swt.AbstractTableInformationControl.5
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.internal.workbench.renderers.swt;

import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.widgets.Table;

class AbstractTableInformationControl$6
  implements KeyListener
{
  AbstractTableInformationControl$6(AbstractTableInformationControl paramAbstractTableInformationControl) {}
  
  public void keyPressed(KeyEvent e)
  {
    switch (keyCode)
    {
    case 13: 
    case 16777296: 
      this$0.gotoSelectedElement();
      break;
    case 16777218: 
      AbstractTableInformationControl.access$2(this$0).getTable().setFocus();
      AbstractTableInformationControl.access$2(this$0).getTable().setSelection(0);
      break;
    case 16777217: 
      AbstractTableInformationControl.access$2(this$0).getTable().setFocus();
      AbstractTableInformationControl.access$2(this$0).getTable().setSelection(
        AbstractTableInformationControl.access$2(this$0).getTable().getItemCount() - 1);
      break;
    case 27: 
      this$0.dispose();
    }
  }
  
  public void keyReleased(KeyEvent e) {}
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.internal.workbench.renderers.swt.AbstractTableInformationControl.6
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.internal.workbench.renderers.swt;

import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.widgets.Text;

class AbstractTableInformationControl$7
  implements ModifyListener
{
  AbstractTableInformationControl$7(AbstractTableInformationControl paramAbstractTableInformationControl) {}
  
  public void modifyText(ModifyEvent e)
  {
    String text = ((Text)widget).getText();
    int length = text.length();
    if ((length > 0) && (text.charAt(length - 1) != '*')) {
      text = text + '*';
    }
    AbstractTableInformationControl.access$3(this$0, text);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.internal.workbench.renderers.swt.AbstractTableInformationControl.7
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.internal.workbench.renderers.swt;

import org.eclipse.e4.ui.workbench.swt.internal.copy.StringMatcher;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;

public class AbstractTableInformationControl$NamePatternFilter
  extends ViewerFilter
{
  protected AbstractTableInformationControl$NamePatternFilter(AbstractTableInformationControl paramAbstractTableInformationControl) {}
  
  public boolean select(Viewer viewer, Object parentElement, Object element)
  {
    StringMatcher matcher = AbstractTableInformationControl.access$0(this$0);
    if ((matcher == null) || (!(viewer instanceof TableViewer))) {
      return true;
    }
    TableViewer tableViewer = (TableViewer)viewer;
    
    String matchName = ((ILabelProvider)tableViewer.getLabelProvider())
      .getText(element);
    if (matchName == null) {
      return false;
    }
    if (matchName.startsWith("*")) {
      matchName = matchName.substring(1);
    }
    return matcher.match(matchName);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.internal.workbench.renderers.swt.AbstractTableInformationControl.NamePatternFilter
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.internal.workbench.renderers.swt;

import org.eclipse.e4.ui.workbench.swt.internal.copy.StringMatcher;
import org.eclipse.e4.ui.workbench.swt.internal.copy.WorkbenchSWTMessages;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.util.Util;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
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.Point;
import org.eclipse.swt.graphics.Rectangle;
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.swt.widgets.Display;
import org.eclipse.swt.widgets.Item;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;

public abstract class AbstractTableInformationControl
{
  private Shell fShell;
  private Composite fComposite;
  private Text fFilterText;
  private TableViewer fTableViewer;
  private StringMatcher fStringMatcher;
  
  protected class NamePatternFilter
    extends ViewerFilter
  {
    protected NamePatternFilter() {}
    
    public boolean select(Viewer viewer, Object parentElement, Object element)
    {
      StringMatcher matcher = AbstractTableInformationControl.this.getMatcher();
      if ((matcher == null) || (!(viewer instanceof TableViewer))) {
        return true;
      }
      TableViewer tableViewer = (TableViewer)viewer;
      
      String matchName = ((ILabelProvider)tableViewer.getLabelProvider())
        .getText(element);
      if (matchName == null) {
        return false;
      }
      if (matchName.startsWith("*")) {
        matchName = matchName.substring(1);
      }
      return matcher.match(matchName);
    }
  }
  
  public AbstractTableInformationControl(Shell parent, int shellStyle, int controlStyle)
  {
    fShell = new Shell(parent, shellStyle);
    fShell.setLayout(new FillLayout());
    
    fComposite = new Composite(fShell, 16);
    GridLayout layout = new GridLayout(1, false);
    fComposite.setLayout(layout);
    createFilterText(fComposite);
    
    fTableViewer = createTableViewer(fComposite, controlStyle);
    
    final Table table = fTableViewer.getTable();
    table.addKeyListener(new KeyListener()
    {
      public void keyPressed(KeyEvent e)
      {
        switch (keyCode)
        {
        case 27: 
          dispose();
          break;
        case 127: 
          removeSelectedItems();
          character = '\000';
          doit = false;
          break;
        case 16777217: 
          if (table.getSelectionIndex() == 0) {
            fFilterText.setFocus();
          }
          break;
        case 16777218: 
          if (table.getSelectionIndex() == table.getItemCount() - 1) {
            fFilterText.setFocus();
          }
          break;
        }
      }
      
      public void keyReleased(KeyEvent e) {}
    });
    table.addSelectionListener(new SelectionListener()
    {
      public void widgetSelected(SelectionEvent e) {}
      
      public void widgetDefaultSelected(SelectionEvent e)
      {
        gotoSelectedElement();
      }
    });
    final int ignoreEventCount = Util.isGtk() ? 4 : 1;
    
    table.addMouseMoveListener(new MouseMoveListener()
    {
      TableItem fLastItem;
      int lastY;
      int itemHeightdiv4;
      int tableHeight;
      Point tableLoc;
      int divCount;
      
      public void mouseMove(MouseEvent e)
      {
        if (divCount == ignoreEventCount) {
          divCount = 0;
        }
        if ((table.equals(e.getSource()) & ++divCount == ignoreEventCount))
        {
          Object o = table.getItem(new Point(x, y));
          if (((fLastItem == null ? 1 : 0) ^ (o == null ? 1 : 0)) != 0) {
            table.setCursor(o == null ? null : table.getDisplay()
              .getSystemCursor(21));
          }
          if (((o instanceof TableItem)) && (lastY != y))
          {
            lastY = y;
            if (!o.equals(fLastItem))
            {
              fLastItem = ((TableItem)o);
              table.setSelection(new TableItem[] { fLastItem });
            }
            else if (y < itemHeightdiv4)
            {
              Item item = fTableViewer.scrollUp(x + tableLoc.x, 
                y + tableLoc.y);
              if ((item instanceof TableItem))
              {
                fLastItem = ((TableItem)item);
                table.setSelection(new TableItem[] { fLastItem });
              }
            }
            else if (y > tableHeight - itemHeightdiv4)
            {
              Item item = fTableViewer.scrollDown(x + 
                tableLoc.x, y + tableLoc.y);
              if ((item instanceof TableItem))
              {
                fLastItem = ((TableItem)item);
                table.setSelection(new TableItem[] { fLastItem });
              }
            }
          }
          else if (o == null)
          {
            fLastItem = null;
          }
        }
      }
    });
    table.addMouseListener(new MouseAdapter()
    {
      public void mouseUp(MouseEvent e)
      {
        if (table.getSelectionCount() < 1) {
          return;
        }
        if ((button == 1) && 
          (table.equals(e.getSource())))
        {
          Object o = table.getItem(new Point(x, y));
          TableItem selection = table.getSelection()[0];
          if (selection.equals(o)) {
            gotoSelectedElement();
          }
        }
        if (button == 3)
        {
          TableItem tItem = fTableViewer.getTable().getItem(
            new Point(x, y));
          if (tItem != null)
          {
            Menu menu = new Menu(fTableViewer.getTable());
            MenuItem mItem = new MenuItem(menu, 0);
            mItem.setText(SWTRenderersMessages.menuClose);
            mItem.addSelectionListener(new SelectionAdapter()
            {
              public void widgetSelected(SelectionEvent selectionEvent)
              {
                removeSelectedItems();
              }
            });
            menu.setVisible(true);
          }
        }
      }
    });
    fShell.addTraverseListener(new TraverseListener()
    {
      public void keyTraversed(TraverseEvent e)
      {
        switch (detail)
        {
        case 512: 
          detail = 0;
          doit = true;
          
          int n = table.getItemCount();
          if (n == 0) {
            return;
          }
          int i = table.getSelectionIndex() + 1;
          if (i >= n) {
            i = 0;
          }
          table.setSelection(i);
          
          break;
        case 256: 
          detail = 0;
          doit = true;
          
          int n = table.getItemCount();
          if (n == 0) {
            return;
          }
          int i = table.getSelectionIndex() - 1;
          if (i < 0) {
            i = n - 1;
          }
          table.setSelection(i);
        }
      }
    });
    setInfoSystemColor();
    installFilter();
  }
  
  protected void removeSelectedItems()
  {
    int selInd = fTableViewer.getTable().getSelectionIndex();
    if (deleteSelectedElements()) {
      return;
    }
    fTableViewer.refresh();
    if (selInd >= fTableViewer.getTable().getItemCount()) {
      selInd = fTableViewer.getTable().getItemCount() - 1;
    }
    if (selInd >= 0) {
      fTableViewer.getTable().setSelection(selInd);
    }
  }
  
  protected abstract TableViewer createTableViewer(Composite paramComposite, int paramInt);
  
  public TableViewer getTableViewer()
  {
    return fTableViewer;
  }
  
  protected Text createFilterText(Composite parent)
  {
    fFilterText = new Text(parent, 0);
    
    GridData data = new GridData();
    GC gc = new GC(parent);
    gc.setFont(parent.getFont());
    FontMetrics fontMetrics = gc.getFontMetrics();
    gc.dispose();
    
    heightHint = 
      Dialog.convertHeightInCharsToPixels(fontMetrics, 1);
    horizontalAlignment = 4;
    verticalAlignment = 1;
    fFilterText.setLayoutData(data);
    
    fFilterText.addKeyListener(new KeyListener()
    {
      public void keyPressed(KeyEvent e)
      {
        switch (keyCode)
        {
        case 13: 
        case 16777296: 
          gotoSelectedElement();
          break;
        case 16777218: 
          fTableViewer.getTable().setFocus();
          fTableViewer.getTable().setSelection(0);
          break;
        case 16777217: 
          fTableViewer.getTable().setFocus();
          fTableViewer.getTable().setSelection(
            fTableViewer.getTable().getItemCount() - 1);
          break;
        case 27: 
          dispose();
        }
      }
      
      public void keyReleased(KeyEvent e) {}
    });
    Label separator = new Label(parent, 258);
    separator.setLayoutData(new GridData(768));
    
    return fFilterText;
  }
  
  private void setInfoSystemColor()
  {
    Display display = fShell.getDisplay();
    setForegroundColor(display.getSystemColor(28));
    setBackgroundColor(display.getSystemColor(29));
  }
  
  private void installFilter()
  {
    fFilterText.setMessage(WorkbenchSWTMessages.FilteredTree_FilterMessage);
    fFilterText.setText("");
    
    fFilterText.addModifyListener(new ModifyListener()
    {
      public void modifyText(ModifyEvent e)
      {
        String text = ((Text)widget).getText();
        int length = text.length();
        if ((length > 0) && (text.charAt(length - 1) != '*')) {
          text = text + '*';
        }
        AbstractTableInformationControl.this.setMatcherString(text);
      }
    });
  }
  
  private void stringMatcherUpdated()
  {
    fTableViewer.getControl().setRedraw(false);
    fTableViewer.refresh();
    selectFirstMatch();
    fTableViewer.getControl().setRedraw(true);
  }
  
  private void setMatcherString(String pattern)
  {
    if (pattern.length() == 0)
    {
      fStringMatcher = null;
    }
    else
    {
      boolean ignoreCase = pattern.toLowerCase().equals(pattern);
      fStringMatcher = new StringMatcher(pattern, ignoreCase, false);
    }
    stringMatcherUpdated();
  }
  
  private StringMatcher getMatcher()
  {
    return fStringMatcher;
  }
  
  protected Object getSelectedElement()
  {
    return 
      ((IStructuredSelection)fTableViewer.getSelection()).getFirstElement();
  }
  
  protected abstract void gotoSelectedElement();
  
  protected abstract boolean deleteSelectedElements();
  
  protected void selectFirstMatch()
  {
    Table table = fTableViewer.getTable();
    Object element = findElement(table.getItems());
    if (element != null) {
      fTableViewer.setSelection(new StructuredSelection(element), true);
    } else {
      fTableViewer.setSelection(StructuredSelection.EMPTY);
    }
  }
  
  private Object findElement(TableItem[] items)
  {
    ILabelProvider labelProvider = (ILabelProvider)fTableViewer
      .getLabelProvider();
    for (int i = 0; i < items.length; i++)
    {
      Object element = items[i].getData();
      if (fStringMatcher == null) {
        return element;
      }
      if (element != null)
      {
        String label = labelProvider.getText(element);
        if (label == null) {
          return null;
        }
        if (label.startsWith("*")) {
          label = label.substring(1);
        }
        if (fStringMatcher.match(label)) {
          return element;
        }
      }
    }
    return null;
  }
  
  public void setVisible(boolean visible)
  {
    fShell.setVisible(visible);
  }
  
  public void dispose()
  {
    if (fShell != null)
    {
      if (!fShell.isDisposed()) {
        fShell.dispose();
      }
      fShell = null;
      fTableViewer = null;
      fComposite = null;
      fFilterText = null;
    }
  }
  
  public Point computeSizeHint()
  {
    Table viewerTable = fTableViewer.getTable();
    Point tableSize = viewerTable.computeSize(-1, -1);
    int tableMaxHeight = fComposite.getDisplay().getBounds().height / 2;
    
    int tableHeight = y <= tableMaxHeight ? y - 
      viewerTable.getItemHeight() - viewerTable.getItemHeight() / 2 : 
      tableMaxHeight;
    getLayoutDataheightHint = tableHeight;
    Point fCompSize = fComposite.computeSize(-1, -1);
    fComposite.setSize(fCompSize);
    return fCompSize;
  }
  
  public void setLocation(Point location)
  {
    Rectangle trim = fShell.computeTrim(0, 0, 0, 0);
    Point textLocation = fComposite.getLocation();
    x += x - x;
    y += y - y;
    fShell.setLocation(location);
  }
  
  public void setSize(int width, int height)
  {
    fShell.setSize(width, height);
  }
  
  public Shell getShell()
  {
    return fShell;
  }
  
  private void setForegroundColor(Color foreground)
  {
    fTableViewer.getTable().setForeground(foreground);
    fFilterText.setForeground(foreground);
    fComposite.setForeground(foreground);
  }
  
  private void setBackgroundColor(Color background)
  {
    fTableViewer.getTable().setBackground(background);
    fFilterText.setBackground(background);
    fComposite.setBackground(background);
  }
  
  public void setFocus()
  {
    fShell.forceFocus();
    fFilterText.setFocus();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.internal.workbench.renderers.swt.AbstractTableInformationControl
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.internal.workbench.renderers.swt;

import java.util.Map;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

class BasicPartList$1
  implements Listener
{
  BasicPartList$1(BasicPartList paramBasicPartList) {}
  
  public void handleEvent(Event event)
  {
    for (Image image : BasicPartList.access$1(this$0).values()) {
      image.dispose();
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.internal.workbench.renderers.swt.BasicPartList.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.internal.workbench.renderers.swt;

import org.eclipse.e4.ui.model.application.ui.MDirtyable;
import org.eclipse.e4.ui.model.application.ui.MUILabel;
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.swt.graphics.Image;

class BasicPartList$BasicStackListLabelProvider
  extends ColumnLabelProvider
{
  private BasicPartList$BasicStackListLabelProvider(BasicPartList paramBasicPartList) {}
  
  public String getText(Object element)
  {
    if (((element instanceof MDirtyable)) && 
      (((MDirtyable)element).isDirty())) {
      return "*" + ((MUILabel)element).getLocalizedLabel();
    }
    return ((MUILabel)element).getLocalizedLabel();
  }
  
  public Image getImage(Object element)
  {
    String iconURI = ((MUILabel)element).getIconURI();
    if (iconURI == null) {
      return null;
    }
    return BasicPartList.access$0(this$0, iconURI);
  }
  
  public String getToolTipText(Object element)
  {
    return ((MUILabel)element).getLocalizedTooltip();
  }
  
  public boolean useNativeToolTip(Object object)
  {
    return true;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.internal.workbench.renderers.swt.BasicPartList.BasicStackListLabelProvider
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.internal.workbench.renderers.swt;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.e4.ui.model.application.ui.MDirtyable;
import org.eclipse.e4.ui.model.application.ui.MElementContainer;
import org.eclipse.e4.ui.model.application.ui.MUIElement;
import org.eclipse.e4.ui.model.application.ui.MUILabel;
import org.eclipse.e4.ui.model.application.ui.advanced.MPlaceholder;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.e4.ui.workbench.swt.util.ISWTResourceUtilities;
import org.eclipse.emf.common.util.URI;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;

public class BasicPartList
  extends AbstractTableInformationControl
{
  private class BasicStackListLabelProvider
    extends ColumnLabelProvider
  {
    private BasicStackListLabelProvider() {}
    
    public String getText(Object element)
    {
      if (((element instanceof MDirtyable)) && 
        (((MDirtyable)element).isDirty())) {
        return "*" + ((MUILabel)element).getLocalizedLabel();
      }
      return ((MUILabel)element).getLocalizedLabel();
    }
    
    public Image getImage(Object element)
    {
      String iconURI = ((MUILabel)element).getIconURI();
      if (iconURI == null) {
        return null;
      }
      return BasicPartList.this.getLabelImage(iconURI);
    }
    
    public String getToolTipText(Object element)
    {
      return ((MUILabel)element).getLocalizedTooltip();
    }
    
    public boolean useNativeToolTip(Object object)
    {
      return true;
    }
  }
  
  private Map<String, Image> images = new HashMap();
  private ISWTResourceUtilities utils;
  private MElementContainer<?> input;
  private EPartService partService;
  
  public BasicPartList(Shell parent, int shellStyle, int treeStyler, EPartService partService, MElementContainer<?> input, ISWTResourceUtilities utils, boolean alphabetical)
  {
    super(parent, shellStyle, treeStyler);
    this.partService = partService;
    this.input = input;
    this.utils = utils;
    if ((alphabetical) && (getTableViewer() != null)) {
      getTableViewer().setComparator(new ViewerComparator());
    }
  }
  
  private Image getLabelImage(String iconURI)
  {
    Image image = (Image)images.get(iconURI);
    if (image == null)
    {
      ImageDescriptor descriptor = (ImageDescriptor)utils.imageDescriptorFromURI(
        URI.createURI(iconURI));
      image = descriptor.createImage();
      images.put(iconURI, image);
    }
    return image;
  }
  
  protected TableViewer createTableViewer(Composite parent, int style)
  {
    Table table = new Table(parent, 0x4 | style & 0xFFFFFFFD);
    table.setLayoutData(new GridData(1, 1, false, 
      false));
    TableViewer tableViewer = new TableViewer(table);
    tableViewer.addFilter(new AbstractTableInformationControl.NamePatternFilter(this));
    tableViewer.setContentProvider(ArrayContentProvider.getInstance());
    tableViewer.setLabelProvider(new BasicStackListLabelProvider(null));
    
    ColumnViewerToolTipSupport.enableFor(tableViewer);
    table.addListener(12, new Listener()
    {
      public void handleEvent(Event event)
      {
        for (Image image : images.values()) {
          image.dispose();
        }
      }
    });
    return tableViewer;
  }
  
  private List<Object> getInput()
  {
    List<Object> list = new ArrayList();
    for (MUIElement element : input.getChildren()) {
      if ((element instanceof MPlaceholder))
      {
        if ((element.isToBeRendered()) && (element.isVisible())) {
          element = ((MPlaceholder)element).getRef();
        }
      }
      else if ((element.isToBeRendered()) && (element.isVisible()) && 
        ((element instanceof MPart))) {
        list.add(element);
      }
    }
    return list;
  }
  
  public void setInput()
  {
    getTableViewer().setInput(getInput());
    selectFirstMatch();
  }
  
  protected void gotoSelectedElement()
  {
    Object selectedElement = getSelectedElement();
    
    dispose();
    if ((selectedElement instanceof MPart)) {
      partService.activate((MPart)selectedElement);
    }
  }
  
  protected boolean deleteSelectedElements()
  {
    Object selectedElement = getSelectedElement();
    if (selectedElement != null)
    {
      partService.hidePart((MPart)selectedElement);
      if (getInput().isEmpty())
      {
        getShell().dispose();
        return true;
      }
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.internal.workbench.renderers.swt.BasicPartList
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.internal.workbench.renderers.swt;

import org.eclipse.core.commands.ParameterizedCommand;
import org.eclipse.e4.ui.model.application.ui.menu.MItem;

public abstract interface IUpdateService
{
  public abstract Runnable registerElementForUpdate(ParameterizedCommand paramParameterizedCommand, MItem paramMItem);
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.internal.workbench.renderers.swt.IUpdateService
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.internal.workbench.renderers.swt;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

public class SWTRenderersActivator
  implements BundleActivator
{
  private static BundleContext bundleContext;
  
  public void start(BundleContext context)
    throws Exception
  {
    bundleContext = context;
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    bundleContext = null;
  }
  
  static BundleContext getContext()
  {
    return bundleContext;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.internal.workbench.renderers.swt.SWTRenderersActivator
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.internal.workbench.renderers.swt;

import org.eclipse.osgi.util.NLS;

public class SWTRenderersMessages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.e4.ui.internal.workbench.renderers.swt.messages";
  public static String menuClose;
  public static String menuCloseOthers;
  public static String menuCloseAll;
  public static String viewMenu;
  public static String tabScrollingLeft;
  public static String tabScrollingRight;
  
  static {}
  
  public static void reloadMessages()
  {
    NLS.initializeMessages("org.eclipse.e4.ui.internal.workbench.renderers.swt.messages", SWTRenderersMessages.class);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.internal.workbench.renderers.swt.SWTRenderersMessages
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.workbench.renderers.swt;

import org.eclipse.e4.ui.model.application.ui.advanced.MArea;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.CTabItem;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventHandler;

class AreaRenderer$1
  implements EventHandler
{
  AreaRenderer$1(AreaRenderer paramAreaRenderer) {}
  
  public void handleEvent(Event event)
  {
    if (!(event.getProperty("ChangedElement") instanceof MArea)) {
      return;
    }
    MArea areaModel = (MArea)event
      .getProperty("ChangedElement");
    CTabFolder ctf = (CTabFolder)areaModel.getWidget();
    CTabItem areaItem = ctf.getItem(0);
    if (areaItem == null) {
      return;
    }
    String attName = (String)event
      .getProperty("AttName");
    if ("label".equals(attName)) {
      areaItem.setText(areaModel.getLocalizedLabel());
    } else if ("iconURI".equals(attName)) {
      areaItem.setImage(this$0.getImage(areaModel));
    } else if ("tooltip".equals(attName)) {
      areaItem.setToolTipText(areaModel.getLocalizedTooltip());
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.workbench.renderers.swt.AreaRenderer.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.workbench.renderers.swt;

import org.eclipse.e4.ui.model.application.ui.MUIElement;
import org.eclipse.e4.ui.model.application.ui.advanced.MArea;
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventHandler;

class AreaRenderer$2
  implements EventHandler
{
  AreaRenderer$2(AreaRenderer paramAreaRenderer) {}
  
  public void handleEvent(Event event)
  {
    MUIElement changedElement = (MUIElement)event
      .getProperty("ChangedElement");
    if (!(changedElement instanceof MPartStack)) {
      return;
    }
    MArea areaModel = findArea(changedElement);
    if (areaModel != null) {
      AreaRenderer.access$0(this$0, areaModel);
    }
  }
  
  private MArea findArea(MUIElement element)
  {
    MUIElement parent = element.getParent();
    while (parent != null)
    {
      if ((parent instanceof MArea)) {
        return (MArea)parent;
      }
      parent = parent.getParent();
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.workbench.renderers.swt.AreaRenderer.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.workbench.renderers.swt;

import java.util.List;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.inject.Inject;
import org.eclipse.e4.core.services.events.IEventBroker;
import org.eclipse.e4.core.services.log.Logger;
import org.eclipse.e4.ui.model.application.ui.MUIElement;
import org.eclipse.e4.ui.model.application.ui.advanced.MArea;
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
import org.eclipse.e4.ui.workbench.modeling.EModelService;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.CTabItem;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventHandler;

public class AreaRenderer
  extends SWTPartRenderer
{
  @Inject
  Logger logger;
  @Inject
  IEventBroker eventBroker;
  private EventHandler itemUpdater = new EventHandler()
  {
    public void handleEvent(Event event)
    {
      if (!(event.getProperty("ChangedElement") instanceof MArea)) {
        return;
      }
      MArea areaModel = (MArea)event
        .getProperty("ChangedElement");
      CTabFolder ctf = (CTabFolder)areaModel.getWidget();
      CTabItem areaItem = ctf.getItem(0);
      if (areaItem == null) {
        return;
      }
      String attName = (String)event
        .getProperty("AttName");
      if ("label".equals(attName)) {
        areaItem.setText(areaModel.getLocalizedLabel());
      } else if ("iconURI".equals(attName)) {
        areaItem.setImage(getImage(areaModel));
      } else if ("tooltip".equals(attName)) {
        areaItem.setToolTipText(areaModel.getLocalizedTooltip());
      }
    }
  };
  private EventHandler widgetListener = new EventHandler()
  {
    public void handleEvent(Event event)
    {
      MUIElement changedElement = (MUIElement)event
        .getProperty("ChangedElement");
      if (!(changedElement instanceof MPartStack)) {
        return;
      }
      MArea areaModel = findArea(changedElement);
      if (areaModel != null) {
        AreaRenderer.this.synchCT
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

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