Beispiel #1
0
  public void closeProject(boolean delNode) {
    BTreeNode node = (BTreeNode) tree.getLastSelectedPathComponent();
    if (node != null) {
      BTreeNode parent = (BTreeNode) (node.getParent());
      if (node.isLeaf()) {
        BElement dKey = node.getKey();
        if (develop.get(dKey) != null) {
          develop.get(dKey).close();
          develop.remove(dKey);
          tree.removeSelectionPath(tree.getSelectionPath());
        }

        if ((delNode) && (parent != null)) {
          int n =
              JOptionPane.showConfirmDialog(
                  treePanel,
                  "Are you sure you want to delete the project?",
                  "Project Deletion",
                  JOptionPane.YES_NO_OPTION);
          if (n == 0) {
            treemodel.removeNodeFromParent(node);
            root.delNode(dKey);
            Bio io = new Bio();
            io.saveFile(configDir + "config.xml", root.toString());

            log.info("Project deleted");
          }
        }
      }
    } else {
      log.info("Select a project first");
    }
  }
Beispiel #2
0
  public void valueChanged(TreeSelectionEvent ev) {
    BTreeNode node = (BTreeNode) tree.getLastSelectedPathComponent();

    if (node != null) {
      BElement dKey = node.getKey();

      if (develop.get(dKey) == null) // Create a new IDE if one is not one the MAP
      develop.put(dKey, new BDevelop(dKey, root, node, treemodel, configDir, logHandle));

      try {
        if (develop.get(dKey).isVisible()) {
          develop.get(dKey).setSelected(true);
          if (develop.get(dKey).isIcon()) develop.get(dKey).setIcon(false);
        } else {
          develop.get(dKey).setVisible(true);
          desktop.add(develop.get(dKey));
          develop.get(dKey).setSelected(true);
        }
      } catch (java.beans.PropertyVetoException ex) {
        log.severe("Desktop show error : " + ex);
      }
    }
  }