public String getDisplayName() {
   if (group != null) {
     return group.getDisplayName();
   }
   final String nodeName = node.getName();
   return nodeName.length() == 0 ? DEFAULT_PACKAGE_DISPLAY_NAME : nodeName;
 }
  private void updateHistory(Node[] selectedNodes) {
    if (selectedNodes.length == 0) {
      return;
    }

    Node selectedNode = selectedNodes[0];
    String selectedNodeName = selectedNode.getName();

    /* get the previous entry to make sure we don't duplicate it.
     * Motivation for this is also that if we used the back button,
     * then we already added the 'current' node to 'back' and we will
     * detect that and not reset the forward list.
     */
    String[] currentLast = backList.peekLast();
    String lastNodeName = null;
    if (currentLast != null) {
      lastNodeName = currentLast[currentLast.length - 1];
    }

    if (currentLast == null || !selectedNodeName.equals(lastNodeName)) {
      // add to the list if the last if not the same as current
      final String[] selectedPath = NodeOp.createPath(selectedNode, em.getRootContext());
      backList.addLast(selectedPath); // add the node to the "backList"
      if (backList.size() > 1) {
        backButton.setEnabled(true);
      } else {
        backButton.setEnabled(false);
      }

      forwardList.clear(); // clear the "forwardList"
      forwardButton.setEnabled(false); // disable the forward Button
    }
  }
示例#3
0
  private boolean isValidProjectForCategory(Lookup lkp) {
    boolean ret = true;
    String cat = "";
    if (!isValidFileOpened()) {
      return false;
    }

    Node node = lkp.lookup(Node.class);
    if (node != null) {
      cat = node.getName();
    }

    // JAXB
    if ("JAXB".equals(cat)) { // NOI18N
      String pt = getProjectType();
      if (J2SE_PROJECT.equals(pt) || WEB_PROJECT.equals(pt) || EJB_PROJECT.equals(pt)) {
        return true;
      } else {
        return false;
      }
    }

    // POJO
    if ("OpenESB_POJO_Engine".equals(cat)) { // NOI18N
      String pt = getProjectType();
      if (J2SE_PROJECT.equals(pt)) {
        return true;
      } else {
        return false;
      }
    }

    // JCA
    if ("JCA".equals(cat)) { // NOI18N
      String pt = getProjectType();
      if (EJB_PROJECT.equals(pt)) {
        return true;
      } else {
        return false;
      }
    }

    // JMS
    if ("JMS".equals(cat)) { // NOI18N
      String pt = getProjectType();
      if (EJB_PROJECT.equals(pt)) {
        return true;
      } else {
        return false;
      }
    }

    // Mapper Tedmet
    if ("Tedmet".equals(cat)) { // NOI18N
      String pt = getProjectType();
      if (J2SE_PROJECT.equals(pt) || WEB_PROJECT.equals(pt) || EJB_PROJECT.equals(pt)) {
        return true;
      } else {
        return false;
      }
    }

    return ret;
  }
 public String toString() {
   if (group != null) {
     return getDisplayName();
   }
   return node.getName();
 }