Beispiel #1
0
  private boolean doLocalTransfer(Transferable t, int action) {
    if (HermesBrowser.getBrowser().isRestrictedWithWarning()) {
      return false;
    }

    try {

      if (t.isDataFlavorSupported(JMSMessagesTransferable.FLAVOR)) {
        return doMessagesTransfer(
            (MessageGroup) t.getTransferData(JMSMessagesTransferable.FLAVOR), action);
      }

      if (t.isDataFlavorSupported(JMSAdministeredObjectTransferable.FLAVOR)) {
        return doContextContentTransfer(
            (HermesConfigGroup) t.getTransferData(JMSAdministeredObjectTransferable.FLAVOR));
      }

      if (t.isDataFlavorSupported(MessagesTransferable.BYTE_FLAVOR)) {

        return doBytesMessageTransfer(
            (Collection<byte[]>) t.getTransferData(MessagesTransferable.BYTE_FLAVOR));
      }
      if (t.isDataFlavorSupported(HermesAdministeredObjectTransferable.FLAVOR)) {
        if (getSelectionPath().getLastPathComponent() instanceof NamingConfigTreeNode) {
          final NamingConfigTreeNode namingConfigTreeNode =
              (NamingConfigTreeNode) getSelectionPath().getLastPathComponent();
          final Collection objects =
              (Collection) t.getTransferData(HermesAdministeredObjectTransferable.FLAVOR);
          final JNDIContextFactory contextFactory =
              new JNDIContextFactory(namingConfigTreeNode.getConfig());
          final BindToolDialog bindTool =
              new BindToolDialog(HermesBrowser.getBrowser(), contextFactory, "", objects);

          bindTool.pack();
          JideSwingUtilities.centerWindow(bindTool);
          bindTool.show();

          return true;
        }
      }
    } catch (Exception ex) {
      log.error(ex.getMessage(), ex);
      JOptionPane.showMessageDialog(
          this, "During transfer: " + ex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
    }

    return false;
  }
Beispiel #2
0
  /** Gets some nice text to display in a tooltip. */
  public String getToolTipText(MouseEvent evt) {
    if (getRowForLocation(evt.getX(), evt.getY()) == -1) {
      return null;
    }

    TreePath curPath = getPathForLocation(evt.getX(), evt.getY());
    Object component = curPath.getLastPathComponent();

    if (component != null) {
      if (component instanceof HermesTreeNode) {
        try {
          return ((HermesTreeNode) component).getHermes().getMetaData().getToolTipText();
        } catch (JMSException ex) {
          log.error(ex.getMessage(), ex);
        }
      }

      if (component instanceof NamingConfigTreeNode) {
        try {
          NamingConfigTreeNode nNode = (NamingConfigTreeNode) component;

          return nNode.getToolTipText();
        } catch (Exception ex) {
          log.error(ex.getMessage(), ex);
        }
      }

      if (component instanceof DestinationConfigTreeNode) {
        return ((DestinationConfigTreeNode) component).getToolTipText();
      }

      if (component instanceof RepositoryTreeNode) {
        return ((RepositoryTreeNode) component).getRepository().getToolTipText();
      }

      if (component instanceof MessageStoreTreeNode) {
        return ((MessageStoreTreeNode) component).getMessageStore().getTooltipText();
      }

      if (component instanceof MessageStoreURLTreeNode) {
        return ((MessageStoreURLTreeNode) component).getTooltipText();
      }
    }

    return null;
  }