Java 类org.eclipse.swt.widgets.CoolItem 实例源码

项目:TranskribusSwtGui    文件:SWTCoolBarTestDemo.java   
protected Control createContents(Composite parent) {
  // --- Create the window title. ---

  getShell().setText("CoolBar Test");

  String asCoolItemSection[] = { "File", "Formatting", "Search" };
  CoolBar composite = new CoolBar(parent, SWT.NONE);
  for (int idxCoolItem = 0; idxCoolItem < 3; ++idxCoolItem) {
    CoolItem item = new CoolItem(composite, SWT.NONE);
    ToolBar tb = new ToolBar(composite, SWT.FLAT);
    for (int idxItem = 0; idxItem < 3; ++idxItem) {
      ToolItem ti = new ToolItem(tb, SWT.NONE);
      ti
          .setText(asCoolItemSection[idxCoolItem] + " Item #"
              + idxItem);
    }
    Point p = tb.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    tb.setSize(p);
    Point p2 = item.computeSize(p.x, p.y);
    item.setControl(tb);
    item.setSize(p2);
  }
  return composite;
}
项目:AndroidRobot    文件:LogAnalysis.java   
public void createToolBar() {
    Composite compCoolBar = new Composite(shell, SWT.BORDER);
    compCoolBar.setLayout(new FillLayout());

    CoolBar coolBarSort = new CoolBar(compCoolBar, SWT.NONE);

    CoolItem coolItemSort = new CoolItem(coolBarSort, SWT.NONE);

    Combo prjCombo = new Combo(coolBarSort, SWT.READ_ONLY);
    prjCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    prjCombo.setItems(new String[] { "显示所有用例", "只显示成功的用例", "只显示失败的用例" });
    prjCombo.select(0);

    Point p = prjCombo.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    prjCombo.setSize(p);
    Point p2 = coolItemSort.computeSize(p.x, p.y);
    coolItemSort.setSize(p2);
    coolItemSort.setControl(prjCombo);

    coolBarSort.pack();

}
项目:gef-gwt    文件:CoolBarManager.java   
/**
 * Disposes the given cool item.
 * 
 * @param item
 *            the cool item to dispose
 */
private void dispose(CoolItem item) {
    if ((item != null) && !item.isDisposed()) {

        item.setData(null);
        Control control = item.getControl();
        // if the control is already disposed, setting the coolitem
        // control to null will cause an SWT exception, workaround
        // for 19630
        if ((control != null) && !control.isDisposed()) {
            item.setControl(null);
            // we created it, we dispose it, see bug 293433
            control.dispose();
        }
        item.dispose();
    }
}
项目:gef-gwt    文件:CoolBarManager.java   
/**
 * Sets the tab order of the coolbar to the visual order of its items.
 */
/* package */void updateTabOrder() {
    if (coolBar != null) {
        CoolItem[] items = coolBar.getItems();
        if (items != null) {
            ArrayList children = new ArrayList(items.length);
            for (int i = 0; i < items.length; i++) {
                if ((items[i].getControl() != null)
                        && (!items[i].getControl().isDisposed())) {
                    children.add(items[i].getControl());
                }
            }
            // Convert array
            Control[] childrenArray = new Control[0];
            childrenArray = (Control[]) children.toArray(childrenArray);

            if (childrenArray != null) {
                coolBar.setTabList(childrenArray);
            }

        }
    }
}
项目:jframe    文件:JframeApp.java   
/**
 * 
 */
protected void createToolBar() {
    CoolBar bar = new CoolBar(shell, SWT.FLAT);
    bar.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    bar.setLayout(new RowLayout());

    CoolItem item = new CoolItem(bar, SWT.NONE);
    Button button = new Button(bar, SWT.FLAT);
    // button.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true));
    button.setText("Button");
    Point size = button.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    item.setPreferredSize(item.computeSize(size.x, size.y));
    item.setControl(button);

    Rectangle clientArea = shell.getClientArea();
    bar.setLocation(clientArea.x, clientArea.y);
    bar.pack();
}
项目:totallicks-tuxguitar    文件:ItemManager.java   
protected void updateCoolBarWrapIndices(){
    int coolBarWidth = this.coolBar.getClientArea().width;
    int coolItemsWidth = 0;

    List coolItemIndices = new ArrayList();

    CoolItem[] items = this.coolBar.getItems();
    for(int i = 0;i < items.length; i ++){
        Point controlSise = items[i].getControl().computeSize(SWT.DEFAULT, SWT.DEFAULT);
        Point itemSize = items[i].computeSize(controlSise.x, controlSise.y);

        int nextCoolItemsWidth = ( coolItemsWidth + itemSize.x );
        if( nextCoolItemsWidth > coolBarWidth ){
            coolItemIndices.add( new Integer( i ) );
            nextCoolItemsWidth = itemSize.x;
        }
        coolItemsWidth = nextCoolItemsWidth;
    }

    int[] coolItemIndicesArray = new int[ coolItemIndices.size() ];
    for(int i = 0;i < coolItemIndicesArray.length; i ++){
        coolItemIndicesArray[i] = ((Integer)coolItemIndices.get(i)).intValue();
    }

    this.coolBar.setWrapIndices( coolItemIndicesArray );
}
项目:Hydrograph    文件:TransformViewDataDialog.java   
/**
 * Create contents of the dialog.
 * @param parent
 */

@Override
protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    container.setLayout(new GridLayout(1, false));

    Shell shell=container.getShell();
    shell.setText("View Transform");
    shell.setImage(ImagePathConstant.APP_ICON.getImageFromRegistry());

    CoolBar coolBar = new CoolBar(container, SWT.FLAT);
    coolBar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));

     CoolItem buttonItem = new CoolItem(coolBar, SWT.NONE | SWT.DROP_DOWN);
      Composite buttonComposite = new Composite(coolBar, SWT.NONE);
      buttonComposite.setLayout(new GridLayout(3, false));

        createWrapButton(buttonComposite);

        createCopyButton(buttonComposite);

        buttonComposite.pack();

        Point size = buttonComposite.getSize();
        buttonItem.setControl(buttonComposite);
        buttonItem.setSize(buttonItem.computeSize(size.x, size.y));

        createStyleTextEditor(container);

        getShell().setMinimumSize(290,290);
        return container;
}
项目:team-explorer-everywhere    文件:HTMLEditor.java   
private void createCoolItem(final CoolBar coolBar, final ToolBar toolBar) {
    Check.notNull(coolBar, "coolBar"); //$NON-NLS-1$
    Check.notNull(toolBar, "toolBar"); //$NON-NLS-1$

    // Compute the size of the toolbar
    toolBar.pack();
    final Point toolBarSize = toolBar.getSize();

    // Create a CoolItem to hold the toolbar
    final CoolItem coolItem = new CoolItem(coolBar, SWT.NONE);
    coolItem.setControl(toolBar);

    // Set the preferred size to what was computed from the toolbar
    final Point coolItemSize = coolItem.computeSize(toolBarSize.x, toolBarSize.y);

    /*
     * SWT Quirk (Bug?)
     *
     * The cool item should have its PREFERRED size set to the result of its
     * OWN computeSize() calculation, but its MINIMUM size should be set to
     * its "child" TOOL BAR's computed size. I think it should rightly use
     * the same size (its OWN computed size) for minimum size, but this
     * leaves way too much empty space in the right side of the toolbar.
     */
    coolItem.setPreferredSize(coolItemSize);
    coolItem.setMinimumSize(toolBarSize);
}
项目:raptor-chess-interface    文件:ChessBoardUtils.java   
public static void adjustCoolbar(ChessBoard board, ToolBar toolbar) {
    clearCoolbar(board);
    toolbar.pack();
    Point size = toolbar.getSize();
    board.getCoolbar().setVisible(true);
    board.getCoolbar().setLocked(true);
    CoolItem coolItem = new CoolItem(board.getCoolbar(), SWT.NONE);
    coolItem.setControl(toolbar);
    coolItem.setSize(size.x, size.y);
    coolItem.setPreferredSize(size.x, size.y);
    coolItem.setMinimumSize(size);
    board.getControl().layout();
}
项目:raptor-chess-interface    文件:ChessBoardUtils.java   
public static void clearCoolbar(ChessBoard board) {
    CoolBar coolbar = board.getCoolbar();
    CoolItem[] items = coolbar.getItems();
    for (CoolItem item : items) {
        if (item.getControl() != null && !item.getControl().isDisposed()) {
            item.getControl().dispose();
        }
        item.dispose();
    }
    board.getCoolbar().setVisible(false);
}
项目:AndroidRobot    文件:LogAnalysis.java   
private void createStatusBar() {
    coolBar1 = new CoolBar(shell, SWT.NONE);
    FormData formData1 = new FormData();
    formData1.left = new FormAttachment(0, 0);
    formData1.right = new FormAttachment(100, 0);
    formData1.top = new FormAttachment(100, -24);
    formData1.bottom = new FormAttachment(100, 0);
    coolBar1.setLayoutData(formData1);
    CoolItem coolItem1 = new CoolItem(coolBar1, SWT.NONE);
    toolBar1 = new ToolBar(coolBar1, SWT.NONE);

    ToolItem tiStatusBarTotal = new ToolItem(toolBar1, SWT.NONE);
    ToolItem tiStatusBarPass = new ToolItem(toolBar1, SWT.NONE);
    ToolItem tiStatusBarFail = new ToolItem(toolBar1, SWT.NONE);
    ToolItem tiStatusBarRate = new ToolItem(toolBar1, SWT.NONE);

    tiStatusBarPass.setText("通过:0");
    tiStatusBarFail.setText("失败:0");
    tiStatusBarRate.setText("通过率:0%");
    tiStatusBarTotal.setText("总用例数:0");

    coolItem1.setControl(toolBar1);

    Control control = coolItem1.getControl();
    Point pt = control.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    pt = coolItem1.computeSize(pt.x, pt.y);
    coolItem1.setSize(pt);

    coolBar1.pack();
}
项目:gef-gwt    文件:ToolBarManager.java   
/**
 * Re-lays out the tool bar.
 * <p>
 * The default implementation of this framework method re-lays out the
 * parent when the number of items are different and the new count != 0
 * 
 * @param layoutBar
 *            the tool bar control
 * @param oldCount
 *            the old number of items
 * @param newCount
 *            the new number of items
 */
protected void relayout(ToolBar layoutBar, int oldCount, int newCount) {
    if ((oldCount != newCount) && (newCount!=0)) {
        Point beforePack = layoutBar.getSize();
        layoutBar.pack(true);
        Point afterPack = layoutBar.getSize();

        // If the TB didn't change size then we're done
        if (beforePack.equals(afterPack))
            return;

        // OK, we need to re-layout the TB
        layoutBar.getParent().layout();

        // Now, if we're in a CoolBar then change the CoolItem size as well
        if (layoutBar.getParent() instanceof CoolBar) {
            CoolBar cb = (CoolBar) layoutBar.getParent();
            CoolItem[] items = cb.getItems();
            for (int i = 0; i < items.length; i++) {
                if (items[i].getControl() == layoutBar) {
                    Point curSize = items[i].getSize();
                    items[i].setSize(curSize.x+ (afterPack.x - beforePack.x),
                                curSize.y+ (afterPack.y - beforePack.y));
                    return;
                }
            }
        }
    }
}
项目:gef-gwt    文件:CoolBarManager.java   
private CoolItem findCoolItem(CoolItem[] items, IContributionItem item) {
      if (items == null) {
    return null;
}

      for (int i = 0; i < items.length; i++) {
          CoolItem coolItem = items[i];
          IContributionItem data = (IContributionItem) coolItem.getData();
          if (data != null && data.equals(item)) {
        return coolItem;
    }
      }
      return null;
  }
项目:gef-gwt    文件:CoolBarManager.java   
/**
 * Subclasses may extend this <code>ContributionManager</code> method,
 * but must call <code>super.itemRemoved</code>.
 * 
 * @see org.eclipse.jface.action.ContributionManager#itemRemoved(org.eclipse.jface.action.IContributionItem)
 */
protected void itemRemoved(IContributionItem item) {
    Assert.isNotNull(item);
    super.itemRemoved(item);
    CoolItem coolItem = findCoolItem(item);
    if (coolItem != null) {
        coolItem.setData(null);
    }
}
项目:gef-gwt    文件:CoolBarManager.java   
/**
 * Replaces the current items with the given items.
 * Forces an update.
 * 
 * @param newItems the items with which to replace the current items
 */
public void setItems(IContributionItem[] newItems) {
    // dispose of all the cool items on the cool bar manager
    if (coolBar != null) {
        CoolItem[] coolItems = coolBar.getItems();
        for (int i = 0; i < coolItems.length; i++) {
            dispose(coolItems[i]);
        }
    }
    // Set the internal structure to this order
    internalSetItems(newItems);
    // Force and update
    update(true);
}
项目:RepDev    文件:MainShell.java   
/**
 * Add a toolbar to the coolBar (sorry, but no pun intended.)
 */
public void addBar(ToolBar b) {
    CoolItem item = new CoolItem(coolBar, SWT.NONE);
    item.setControl(b);
    Point size = b.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    item.setMinimumSize(size);

    coolItems.add(item);
}
项目:totallicks-tuxguitar    文件:ItemManager.java   
private void clearCoolBar(){
    if(this.coolBar != null && !this.coolBar.isDisposed()){
        this.loadedToolItems.clear();
        CoolItem[] items = this.coolBar.getItems();
        for(int i = 0;i < items.length; i ++){
            items[i].dispose();
        }
        Control[] controls = this.coolBar.getChildren();
        for(int i = 0;i < controls.length; i ++){
            controls[i].dispose();
        }
    }
    this.coolbarVisible = false;
}
项目:totallicks-tuxguitar    文件:ItemManager.java   
private void makeCoolItem(ToolBar toolBar){
    Point size = toolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    CoolItem coolItem = new CoolItem(this.coolBar, SWT.NONE);
    coolItem.setMinimumSize(size);
    coolItem.setPreferredSize(coolItem.computeSize(size.x, size.y));
    coolItem.setControl(toolBar);
}
项目:q7.quality.mockups    文件:CoolBarTest.java   
public Control construct(Composite parent) {
    final Composite composite = new Composite(parent, SWT.NONE);
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL)
            .grab(true, true).applyTo(composite);
    GridLayoutFactory.swtDefaults().numColumns(2).applyTo(composite);

    final Text t = new Text(composite, SWT.BORDER | SWT.MULTI);
    t.setText ("Test at the pressing");

    CoolBar bar = new CoolBar(composite, SWT.VERTICAL);
    for (int i=1; i<6; i++) {
        CoolItem item = new CoolItem (bar, SWT.NONE);
        final Button button = new Button (bar, SWT.PUSH);
        button.setText ("Button " + i);
        Point size = button.computeSize (SWT.DEFAULT, SWT.DEFAULT);
        item.setPreferredSize (item.computeSize (size.x, size.y));
        item.setControl (button);
        final String t2 = button.getText();
        button.addListener (SWT.Selection, new Listener () {
            public void handleEvent (Event e) {
                t.setText(t2);
            }
        });
    }
    Rectangle clientArea = composite.getClientArea ();
    bar.setLocation (clientArea.x, clientArea.y);

    return null;
}
项目:RxSWT    文件:SelectionAdapter.java   
static SelectionAdapter create(Widget widget) {
    if (widget instanceof Button) {
        return create((Button) widget);
    } else if (widget instanceof CCombo) {
        return create((CCombo) widget);
    } else if (widget instanceof Combo) {
        return create((Combo) widget);
    } else if (widget instanceof CoolItem) {
        return create((CoolItem) widget);
    } else if (widget instanceof CTabFolder) {
        return create((CTabFolder) widget);
    } else if (widget instanceof DateTime) {
        return create((DateTime) widget);
    } else if (widget instanceof Link) {
        return create((Link) widget);
    } else if (widget instanceof List) {
        return create((List) widget);
    } else if (widget instanceof MenuItem) {
        return create((MenuItem) widget);
    } else if (widget instanceof Sash) {
        return create((Sash) widget);
    } else if (widget instanceof Scale) {
        return create((Scale) widget);
    } else if (widget instanceof Slider) {
        return create((Slider) widget);
    } else if (widget instanceof Spinner) {
        return create((Spinner) widget);
    } else if (widget instanceof StyledText) {
        return create((StyledText) widget);
    } else if (widget instanceof TabFolder) {
        return create((TabFolder) widget);
    } else if (widget instanceof Table) {
        return create((Table) widget);
    } else if (widget instanceof TableColumn) {
        return create((TableColumn) widget);
    } else if (widget instanceof TableCursor) {
        return create((TableCursor) widget);
    } else if (widget instanceof Text) {
        return create((Text) widget);
    } else if (widget instanceof ToolItem) {
        return create((ToolItem) widget);
    } else if (widget instanceof ToolTip) {
        return create((ToolTip) widget);
    } else if (widget instanceof TrayItem) {
        return create((TrayItem) widget);
    } else if (widget instanceof Tree) {
        return create((Tree) widget);
    } else if (widget instanceof TreeColumn) {
        return create((TreeColumn) widget);
    } else if (widget instanceof TreeCursor) {
        return create((TreeCursor) widget);
    }

    throw new IllegalArgumentException("The given widget (" + widget.getClass().getName() + ") is not supported.");
}
项目:PDFReporter-Studio    文件:TabbedPropertyList.java   
private void calcSize(CoolItem item) {
    toolBarManager.update(true);
}
项目:gef-gwt    文件:CoolBarManager.java   
/**
 * Updates the indices at which the cool bar should wrap.
 */
private void updateWrapIndices() {
    final IContributionItem[] items = getItems();
    final int numRows = getNumRows(items) - 1;

    // Generate the list of wrap indices.
    final int[] wrapIndices = new int[numRows];
    boolean foundSeparator = false;
    int j = 0;
    CoolItem[] coolItems = (coolBar == null) ? null : coolBar.getItems();

    for (int i = 0; i < items.length; i++) {
        IContributionItem item = items[i];
        CoolItem coolItem = findCoolItem(coolItems, item);
        if (item.isSeparator()) {
            foundSeparator = true;
        }
        if ((!item.isSeparator()) && (!item.isGroupMarker())
                && (isChildVisible(item)) && (coolItem != null)
                && (foundSeparator)) {
            wrapIndices[j] = coolBar.indexOf(coolItem);
            j++;
            foundSeparator = false;
        }
    }

    /*
     * Check to see if these new wrap indices are different than the old
     * ones.
     */
    final int[] oldIndices = coolBar.getWrapIndices();
    boolean shouldUpdate = false;
    if (oldIndices.length == wrapIndices.length) {
        for (int i = 0; i < oldIndices.length; i++) {
            if (oldIndices[i] != wrapIndices[i]) {
                shouldUpdate = true;
                break;
            }
        }
    } else {
        shouldUpdate = true;
    }

    if (shouldUpdate) {
        coolBar.setWrapIndices(wrapIndices);
    }
}
项目:jisocreator    文件:IsoExplorerSashForm.java   
@Override
   public void addFeatures() {
setWeights(new int[] { 25, 75 });
isoTreeCLabel.setText("Iso explorer");
isoTreeCLabel.setImage(ImageUtils.getInstance().loadImage("iso.png"));
CoolBarManager coolbar = new CoolBarManager(isoTableCoolBar);
ToolBarManager toolbar = new ToolBarManager(SWT.WRAP | SWT.FLAT);

toolbar.add(OpenIsoEntryAction.getInstance());
toolbar.add(GoToIsoEntryParentAction.getInstance());
toolbar.add(ShowIsoInformationAction.getInstance());
toolbar.add(DeleteIsoEntryAction.getInstance());

coolbar.add(toolbar);
coolbar.update(true);
CoolItem coolItem = new CoolItem(isoTableCoolBar, SWT.WRAP | SWT.FLAT);
isoTableText = new Text(isoTableCoolBar, SWT.READ_ONLY | SWT.SINGLE | SWT.BORDER);
isoTableText.pack();
coolItem.setSize(isoTableText.getSize());
coolItem.setControl(isoTableText);

List<String> columnNames = new ArrayList<String>();
{
    columnNames.add("Name");
    columnNames.add("Size");
    columnNames.add("Type");
    columnNames.add("Last Modified Date");
}

List<String> tooltips = new ArrayList<String>();
{
    tooltips.add("Name");
    tooltips.add("Size");
    tooltips.add("Type");
    tooltips.add("Last Modified Date");
}
Iterator<String> it = tooltips.iterator();

for (String columnName : columnNames) {
    TableColumn tvc = new TableColumn(isoDirectoriesTable.getTable(), SWT.LEFT);
    tvc.setText(columnName);
    tvc.setToolTipText(it.next());
    tvc.setWidth(200);
    tvc.setMoveable(true);
    tvc.setResizable(true);
}

isoDirectoriesTable.getTable().setHeaderVisible(true);
isoDirectoriesTree.setContentProvider(new IsoTreeContentProvider());
isoDirectoriesTree.setLabelProvider(new IsoTreeLabelProvider());
isoDirectoriesTree.addFilter(new ShowOnlyIsoDirectoriesFilter());
isoDirectoriesTree.setSorter(new SortByIsoEntryFirstSorter());

isoDirectoriesTable.setContentProvider(new IsoTableProvider());
isoDirectoriesTable.setLabelProvider(new IsoTableProvider());
isoDirectoriesTable.setSorter(new SortByIsoEntryFirstSorter());

GridDataFactory.defaultsFor(isoTreeCLabel).grab(true, false).applyTo(isoTreeCLabel);
GridDataFactory.defaultsFor(isoDirectoriesTree.getControl()).grab(true, true)
    .applyTo(isoDirectoriesTree.getControl());
GridLayoutFactory.fillDefaults().generateLayout(composites.get(0));

GridDataFactory.defaultsFor(isoTableCoolBar).grab(true, false).applyTo(isoTableCoolBar);
GridDataFactory.defaultsFor(isoDirectoriesTable.getControl()).grab(true, true)
    .applyTo(isoDirectoriesTable.getControl());
GridLayoutFactory.fillDefaults().generateLayout(composites.get(1));
   }
项目:jisocreator    文件:OSExplorerSashForm.java   
@Override
   public void addFeatures() {
setWeights(new int[] { 25, 75 });
osTreeCLabel.setText("File explorer");
osTreeCLabel.setImage(ImageUtils.getInstance().loadImage("drive.png"));

CoolBarManager coolbar = new CoolBarManager(osTableCoolBar);
ToolBarManager toolbar = new ToolBarManager(SWT.WRAP | SWT.FLAT);

toolbar.add(OpenAction.getInstance());
toolbar.add(GoToParentAction.getInstance());
toolbar.add(RefreshExplorerAction.getInstance());
toolbar.add(AddFileAction.getInstance());
toolbar.add(ShowHiddenFilesAction.getInstance());

coolbar.add(toolbar);
coolbar.update(true);

CoolItem coolItem = new CoolItem(osTableCoolBar, SWT.WRAP | SWT.FLAT);
osTableText = new Text(osTableCoolBar, SWT.READ_ONLY | SWT.SINGLE | SWT.BORDER);
osTableText.pack();
coolItem.setSize(osTableText.getSize());
coolItem.setControl(osTableText);

List<String> tooltips = new ArrayList<String>();
{
    tooltips.add("File name");
    tooltips.add("File size, in bytes");
    tooltips.add("File type");
    tooltips.add("File kast modified date");
}

List<String> columnNames = new ArrayList<String>();
{
    columnNames.add("Name");
    columnNames.add("Size");
    columnNames.add("Type");
    columnNames.add("Last Modified Date");
}
Iterator<String> it = tooltips.iterator();

for (String columnName : columnNames) {
    TableColumn tvc = new TableColumn(osDirectoriesTable.getTable(), SWT.LEFT);
    tvc.setText(columnName);
    tvc.setToolTipText(it.next());
    tvc.setWidth(200);
    tvc.setMoveable(true);
    tvc.setResizable(true);
}
osDirectoriesTable.getTable().setHeaderVisible(true);

osDirectoriesTree.setContentProvider(new OSTreeContentProvider());
osDirectoriesTree.setLabelProvider(new OSTreeLabelProvider());
osDirectoriesTree.addFilter(new ShowOnlyDirectoriesFilter());
osDirectoriesTree.addFilter(new HideHiddenFilesFilter());
osDirectoriesTree.setSorter(new SortByDirectoriesFirstSorter());
osDirectoriesTree.setInput(OSExplorer.getInstance());

osDirectoriesTable.setContentProvider(new OsTableProvider());
osDirectoriesTable.setLabelProvider(new OsTableProvider());
osDirectoriesTable.addFilter(new HideHiddenFilesFilter());
osDirectoriesTable.setSorter(new SortByDirectoriesFirstSorter());

GridDataFactory.defaultsFor(osTreeCLabel).grab(true, false).applyTo(osTreeCLabel);
GridDataFactory.defaultsFor(osDirectoriesTree.getControl()).grab(true, true)
    .applyTo(osDirectoriesTree.getControl());
GridLayoutFactory.fillDefaults().generateLayout(composites.get(0));

GridDataFactory.defaultsFor(osTableCoolBar).grab(true, false).applyTo(osTableCoolBar);
GridDataFactory.defaultsFor(osDirectoriesTable.getControl()).grab(true, true)
    .applyTo(osDirectoriesTable.getControl());
GridLayoutFactory.fillDefaults().generateLayout(composites.get(1));
   }
项目:gef-gwt    文件:CoolBarManager.java   
/**
 * Finds the cool item associated with the given contribution item.
 * 
 * @param item
 *            the contribution item
 * @return the associated cool item, or <code>null</code> if not found
 */
private CoolItem findCoolItem(IContributionItem item) {
    CoolItem[] coolItems = (coolBar == null) ? null : coolBar.getItems(); 
    return findCoolItem(coolItems, item);
}