コード例 #1
0
  // --------------------------------------------------------------------------------
  private void drawItem(String parentFieldName, TreeItem parentItem, List data, boolean expand) {
    for (int i = 0; i < data.size(); ++i) {
      TreeItem newItem = new TreeItem(parentItem, SWT.NONE);
      Object value = data.get(i);
      newItem.setText(1, getClassName(value));

      String fieldName = parentFieldName + "." + i;
      if (fieldName.startsWith(".")) {
        fieldName = fieldName.substring(1);
      }
      newItem.setData("fieldName", fieldName);
      newItem.setData("value", value);
      fieldNameTreeItemMap.put(fieldName, newItem);

      if (value instanceof Map) {
        newItem.setText("[" + i + "]");
        newItem.setImage(mapImage);
        drawItem(fieldName, newItem, (Map) value, expand);
      } else if (value instanceof List) {
        newItem.setText("[" + i + "]");
        newItem.setImage(listImage);
        drawItem(fieldName, newItem, (List) value, expand);
      } else {
        setItemInfo(newItem, "[" + i + "]", value);
      }

      if (expand) {
        parentItem.setExpanded(expand);
        newItem.setExpanded(expand);
      }
    }
  }
コード例 #2
0
  private void addDirectory(TreeItem ti, FsNode node) {
    for (FsNode child : node.getChildren()) {
      TreeItem trtmTest = new TreeItem(ti, SWT.NONE);

      trtmTest.setData(FsNode.class.getName(), child);

      trtmTest.setText(child.getName());
      if (child.isDirectory()) {
        trtmTest.setImage(SWTResourceManager.getImage(Gui.class, OterStatics.ICON_DIRECTORY));
        addDirectory(trtmTest, child);
      } else {
        trtmTest.setImage(SWTResourceManager.getImage(Gui.class, OterStatics.ICON_FILE));
      }
    }
  }
コード例 #3
0
ファイル: RunTestView.java プロジェクト: JinxingLi/idecore
  /**
   * Set color and icon for a test method's TreeItem.
   *
   * @param node
   * @param outcome
   */
  private void setColorAndIconForNode(TreeItem node, ApexTestOutcome outcome) {
    if (Utils.isEmpty(node) || Utils.isEmpty(outcome)) return;

    Display display = node.getDisplay();
    if (outcome.equals(ApexTestOutcome.Pass)) {
      node.setForeground(display.getSystemColor(PASS_COLOR));
      node.setImage(PASS_ICON);
    } else if (outcome.equals(ApexTestOutcome.Skip)) {
      node.setForeground(display.getSystemColor(WARNING_COLOR));
      node.setImage(WARNING_ICON);
    } else {
      node.setForeground(display.getSystemColor(FAILURE_COLOR));
      node.setImage(FAILURE_ICON);
    }
  }
コード例 #4
0
 /**
  * Sets the up tree item.
  *
  * @param cp the cp
  * @param checked the checked
  */
 private void setUpTreeItem(ICPEType cp, TreeItem checked) {
   checked.setText(cp.toString());
   checked.setChecked(cp.isEnabled());
   checked.setData(cp);
   if (cp.getIcon() != null) {
     checked.setImage(cp.getIcon());
   }
 }
コード例 #5
0
  public void run() {
    tree.removeAll();

    for (FsNode node : fs) {
      TreeItem trtmTest = new TreeItem(tree, SWT.NONE);

      trtmTest.setData(FsNode.class.getName(), node);

      if (node.isLink()) trtmTest.setText(node.getName() + " -> " + node.getLink());
      else trtmTest.setText(node.getName());
      if (node.isDirectory()) {
        addDirectory(trtmTest, node);
        trtmTest.setImage(SWTResourceManager.getImage(Gui.class, OterStatics.ICON_DIRECTORY));
      } else {
        trtmTest.setImage(SWTResourceManager.getImage(Gui.class, OterStatics.ICON_FILE));
      }
    }
  }
コード例 #6
0
ファイル: MainProcessor.java プロジェクト: KUNHO-YANG/scouter
 private void addMainTreeSubItem(TreeItem parent, ArrayList<StackAnalyzedInfo> list) {
   TreeItem subItem;
   for (StackAnalyzedInfo info : list) {
     subItem = new TreeItem(parent, SWT.NONE);
     subItem.setText(info.toTreeInfo());
     subItem.setImage(Images.grid);
     subItem.setData(info);
   }
 }
コード例 #7
0
ファイル: MainProcessor.java プロジェクト: KUNHO-YANG/scouter
 private void addMainTree(StackFileInfo stackFileInfo) {
   Tree tree = getMainTree();
   TreeItem item = new TreeItem(tree, SWT.NONE);
   item.setText(stackFileInfo.toTreeInfo());
   item.setImage(Images.thread);
   item.setData(stackFileInfo);
   addMainTreeSubItem(item, stackFileInfo.getStackAnalyzedInfoList());
   item.setExpanded(true);
 }
コード例 #8
0
  // --------------------------------------------------------------------------------
  private void drawItem(String parentFieldName, TreeItem parentItem, Map data, boolean expand) {
    Iterator p = data.keySet().iterator();
    while (p.hasNext()) {
      String key = (String) p.next();
      if (!data.containsKey(key)) {
        continue;
      }
      Object value = data.get(key);

      TreeItem newItem = new TreeItem(parentItem, SWT.NONE);
      newItem.setText(1, getClassName(value));

      String fieldName = parentFieldName + "." + key;
      if (fieldName.startsWith(".")) {
        fieldName = fieldName.substring(1);
      }
      newItem.setData("fieldName", fieldName);
      newItem.setData("value", value);
      fieldNameTreeItemMap.put(fieldName, newItem);

      if (value == null) {
        newItem.setText(key + " : null");
        newItem.setImage(nullImage);
      } else if (value instanceof Map) {
        newItem.setText(key);
        newItem.setImage(mapImage);
        drawItem(fieldName, newItem, (Map) value, expand);
      } else if (value instanceof List) {
        newItem.setText(key);
        newItem.setImage(listImage);
        drawItem(fieldName, newItem, (List) value, expand);
      } else {
        setItemInfo(newItem, key, value);
      }

      if (expand) {
        parentItem.setExpanded(expand);
        newItem.setExpanded(expand);
      }
    }
  }
コード例 #9
0
 private void fillItem(TreeItem item, FileInfo info) {
   assert Thread.currentThread() == fDisplay.getThread();
   Object data = item.getData("TCFContextInfo");
   if (data != null && data != info) item.removeAll();
   item.setData("TCFContextInfo", info);
   String text = info.name != null ? info.name : info.fullname;
   item.setText(text);
   item.setForeground(fDisplay.getSystemColor(SWT.COLOR_LIST_FOREGROUND));
   item.setImage(getImage(info));
   if (!canHaveChildren(info)) item.setItemCount(0);
   else if (info.children == null || info.children_error != null) item.setItemCount(1);
   else item.setItemCount(info.children.length);
 }
コード例 #10
0
  private boolean getData() {
    // Clear the tree top entry
    if (tiTree != null && !tiTree.isDisposed()) {
      tiTree.dispose();
    }

    tiTree = new TreeItem(wTree, SWT.NONE);
    tiTree.setImage(GUIResource.getInstance().getImageFolder());
    RepositoryDirectoryUI.getDirectoryTree(tiTree, dircolor, repositoryTree);
    tiTree.setExpanded(true);

    return true;
  }
コード例 #11
0
 private void displayError(Tree tree, String message) {
   tree.removeAll();
   TreeItem item = new TreeItem(tree, 1);
   item.setText(message);
   item.setImage(
       0,
       FMUIPlugin.getDefault()
           .getWorkbench()
           .getSharedImages()
           .getImage(ISharedImages.IMG_OBJS_ERROR_TSK));
   item.setChecked(true);
   item.setGrayed(true);
   dirty = false;
 }
コード例 #12
0
 // --------------------------------------------------------------------------------
 private void setItemInfo(TreeItem treeItem, String key, Object value) {
   treeItem.setText(key + " : " + value);
   if (value instanceof Integer) {
     treeItem.setImage(intImage);
   } else if (value instanceof Double) {
     treeItem.setImage(doubleImage);
   } else if (value instanceof Long) {
     treeItem.setImage(longImage);
   } else if (value instanceof Date) {
     treeItem.setImage(dateImage);
   } else if (value instanceof String) {
     treeItem.setImage(stringImage);
   } else if (value instanceof ObjectId) {
     treeItem.setImage(oidImage);
   } else if (value instanceof Boolean) {
     treeItem.setImage(boolImage);
   } else if (value instanceof Code) {
     treeItem.setImage(jsImage);
   }
 }
コード例 #13
0
  // --------------------------------------------------------------------------------
  private void drawTreeRoot(Tree _tree, DBObject data) {
    // reset tree
    _tree.removeAll();

    if (data != null) {
      TreeItem root = new TreeItem(_tree, SWT.NONE);
      root.setText(data.get("_id") + "");
      root.setImage(documentImage);
      root.setData("fieldName", "");
      root.setData("value", data.get("_id"));
      fieldNameTreeItemMap.put("", root);

      boolean expand = (data.keySet().size() < 35);
      drawItem("", root, data.toMap(), expand);
    }

    nameText.setText("");
    typeCombo.select(0);
    typeCombo.setEnabled(false);
    valueText.setText("");
    updateButton.setEnabled(false);
  }
コード例 #14
0
ファイル: ExistingOrNewPage.java プロジェクト: blizzy78/egit
 private void updateProjectTreeItem(TreeItem item, IProject project) {
   item.setImage(
       0, PlatformUI.getWorkbench().getSharedImages().getImage(SharedImages.IMG_OBJ_PROJECT));
   item.setText(0, project.getName());
 }
コード例 #15
0
ファイル: NoteSwtActions.java プロジェクト: RTM945/xworker
 public static void setImage(TreeItem item, String imageName, ActionContext actionContext) {
   Image image = (Image) actionContext.get(imageName);
   if (image != null) {
     item.setImage(image);
   }
 }