// ======================================================
 // ======================================================
 private void treeMousePressed(java.awt.event.MouseEvent evt) {
   int mask = evt.getModifiers();
   if ((mask & MouseEvent.BUTTON1_MASK) != 0) {
     TreePath selectedPath = getPathForLocation(evt.getX(), evt.getY());
     if (selectedPath == null) return;
     DefaultMutableTreeNode node =
         (DefaultMutableTreeNode) selectedPath.getPathComponent(selectedPath.getPathCount() - 1);
     Object o = node.getUserObject();
     if (o instanceof String) {
       TransferHandler transfer = this.getTransferHandler();
       transfer.exportAsDrag(this, evt, TransferHandler.COPY);
       dragged_node = node;
       parent.setCursor(renderer.getNodeCursor(node));
     }
   }
 }
  private void loadList() {
    final JDialog form = this;
    final ReadOnlyCellTableModel model = (ReadOnlyCellTableModel) subscriptionTable.getModel();

    while (model.getRowCount() > 0) model.removeRow(0);

    form.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

    Vector<String> vector = new Vector<String>();
    vector.add("(loading... )");
    vector.add("");
    model.addRow(vector);

    ApplicationManager.getApplication()
        .invokeLater(
            new Runnable() {
              @Override
              public void run() {
                try {

                  while (model.getRowCount() > 0) model.removeRow(0);

                  subscriptionList = AzureRestAPIManager.getManager().getSubscriptionList();

                  if (subscriptionList != null && subscriptionList.size() > 0) {
                    for (Subscription subs : subscriptionList) {
                      Vector<String> row = new Vector<String>();
                      row.add(subs.getName());
                      row.add(subs.getId().toString());
                      model.addRow(row);
                    }

                    removeButton.setEnabled(true);
                  } else {
                    removeButton.setEnabled(false);
                  }

                  form.setCursor(Cursor.getDefaultCursor());
                } catch (AzureCmdException e) {
                  form.setCursor(Cursor.getDefaultCursor());
                  UIHelper.showException("Error getting subscription list", e);
                }
              }
            });
  }
 // ======================================================
 // ======================================================
 private void treeMouseReleased(java.awt.event.MouseEvent evt) {
   int mask = evt.getModifiers();
   if ((mask & MouseEvent.BUTTON1_MASK) != 0) {
     if (dragged_node == null) return;
     TreePath selectedPath = getPathForLocation(evt.getX(), evt.getY());
     if (selectedPath == null)
       if ((selectedPath = getUpperPath(evt.getX(), evt.getY())) == null) return;
     DefaultMutableTreeNode node =
         (DefaultMutableTreeNode) selectedPath.getPathComponent(selectedPath.getPathCount() - 1);
     Object o = node.getUserObject();
     int pos = 0;
     if (o instanceof String) {
       DefaultMutableTreeNode p_node = (DefaultMutableTreeNode) node.getParent();
       pos = p_node.getIndex(node);
       node = p_node;
     }
     moveLeaf(node, dragged_node, pos);
     dragged_node = null;
     Cursor cursor = new Cursor(Cursor.DEFAULT_CURSOR);
     parent.setCursor(cursor);
   }
 }