Exemplo n.º 1
0
  /**
   * Called whenever the value of the selection changes, we watch this to cache whenever
   * HermesTreeNode is in the selection path and to change the components tooltip text.
   */
  public void valueChanged(TreeSelectionEvent e) {
    final TreePath treePath = e.getNewLeadSelectionPath();

    try {
      if (treePath != null) {
        for (int i = 0; i < treePath.getPathCount(); i++) {
          if (treePath.getPathComponent(i) instanceof HermesTreeNode) {
            final HermesTreeNode node = (HermesTreeNode) treePath.getPathComponent(i);
            lastSelectedHermesTreeNode = node;

            setToolTipText(node.getHermes().getMetaData().getToolTipText());
          } else if (treePath.getPathComponent(i) instanceof DestinationConfigTreeNode) {
            final DestinationConfigTreeNode node =
                (DestinationConfigTreeNode) treePath.getPathComponent(i);
            setToolTipText(node.getDestinationName());

            maybeRefocusDocument(node);

          } else if (treePath.getPathComponent(i) instanceof RepositoryTreeNode) {
            final RepositoryTreeNode node = (RepositoryTreeNode) treePath.getPathComponent(i);
            setToolTipText(node.getRepository().getId());
          } else if (treePath.getPathComponent(i) instanceof MessageStoreTreeNode) {
            final MessageStoreTreeNode node = (MessageStoreTreeNode) treePath.getPathComponent(i);
            setToolTipText(node.getMessageStore().getTooltipText());
            maybeRefocusDocument(node);

          } else if (treePath.getPathComponent(i) instanceof MessageStoreURLTreeNode) {
            final MessageStoreURLTreeNode node =
                (MessageStoreURLTreeNode) treePath.getPathComponent(i);

            setToolTipText(node.getURL());
          }
        }
      }
    } catch (JMSException ex) {
      Hermes.ui.getDefaultMessageSink().add(ex.getMessage());
    }
  }
Exemplo n.º 2
0
 public void remove(MessageStoreURLTreeNode node) {
   MutableTreeNode parent = (MutableTreeNode) node.getParent();
   node.close();
   parent.remove(node);
   getBrowserModel().nodeStructureChanged(parent);
 }