Пример #1
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));
      }
    }
  }
Пример #2
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));
      }
    }
  }