示例#1
0
  @Override
  public void setSources(String... sources) {
    TreeItem[] items = tree.getSelection();
    if (items.length < 1) return;
    TreeItem item = items[0];
    if (lastSelectedItem == item) return;

    if (lastSelectedItem != null && !lastSelectedItem.isDisposed()) {
      lastSelectedItem.setBackground(new Color(getDisplay(), 255, 255, 255));
      lastSelectedItem.setExpanded(false);
      lastSelectedItem.removeAll();
    }
    lastSelectedItem = item;
    lastSelectedItem.setBackground(new Color(getDisplay(), 190, 190, 255));

    if (sources == null || sources.length < 1) return;

    for (String source : sources) {
      item = new TreeItem(lastSelectedItem, SWT.NONE);
      item.setFont(UIDATA.FONT_9);
      int idx = source.indexOf('.');
      if (idx > -1) source = source.substring(idx + 1);
      item.setText(source);
    }
    if (!lastSelectedItem.getExpanded()) lastSelectedItem.setExpanded(true);
  }
示例#2
0
 /**
  * Create a default TreeItem for a test class.
  *
  * @param parent
  * @param font
  * @return TreeItem for test class
  */
 private TreeItem createTestClassTreeItem(Tree parent, Font font) {
   TreeItem newClassNode = new TreeItem(parent, SWT.NONE);
   newClassNode.setFont(font);
   newClassNode.setExpanded(false);
   // Mark this test class as pass until we find a test method within it that says otherwise
   setColorAndIconForNode(newClassNode, ApexTestOutcome.Pass);
   return newClassNode;
 }
示例#3
0
 public TreeItem lookCategoryItem(String category) {
   TreeItem[] items = tree.getItems();
   if (items != null) {
     for (TreeItem item : items) {
       if (item.getText().equals(category)) return item;
     }
   }
   TreeItem item = new TreeItem(tree, SWT.NONE);
   item.setFont(UIDATA.FONT_10B);
   item.setText(category);
   return item;
 }
 protected void refreshItem(TreeItem item, SelectableFeature feature) {
   item.setBackground(null);
   item.setFont(treeItemStandardFont);
   switch (feature.getAutomatic()) {
     case SELECTED:
       item.setGrayed(true);
       item.setForeground(null);
       item.setChecked(true);
       break;
     case UNSELECTED:
       item.setGrayed(true);
       item.setForeground(gray);
       item.setChecked(false);
       break;
     case UNDEFINED:
       item.setGrayed(false);
       item.setForeground(null);
       item.setChecked(feature.getManual() == Selection.SELECTED);
       break;
   }
 }
 protected void lockItem(TreeItem item) {
   item.setGrayed(true);
   item.setChecked(true);
   item.setForeground(gray);
   item.setFont(treeItemStandardFont);
 }