private void updateBusy() {
    if (myBusy) {
      if (myBusyIcon == null) {
        myBusyIcon = new AsyncProcessIcon(toString()).setUseMask(false);
        myBusyIcon.setOpaque(false);
        myBusyIcon.setPaintPassiveIcon(false);
        add(myBusyIcon);
      }
    }

    if (myBusyIcon != null) {
      if (myBusy) {
        myBusyIcon.resume();
      } else {
        myBusyIcon.suspend();
        //noinspection SSBasedInspection
        SwingUtilities.invokeLater(
            new Runnable() {
              public void run() {
                if (myBusyIcon != null) {
                  repaint();
                }
              }
            });
      }
      if (myBusyIcon != null) {
        myBusyIcon.updateLocation(this);
      }
    }
  }
 @Override
 public void paint(Graphics g) {
   super.paint(g);
   if (myBusyIcon != null) {
     myBusyIcon.updateLocation(this);
   }
 }
 @Override
 public void doLayout() {
   super.doLayout();
   if (myBusyIcon != null) {
     myBusyIcon.updateLocation(this);
   }
 }
 protected final void showProgress(String message) {
   myProgressMessage.setText(message);
   if (myProgressPanel.getParent() == null) {
     myGlassLayer.setEnabled(false);
     myProgressIcon.resume();
     myLayeredPane.add(myProgressPanel, LAYER_PROGRESS);
     myLayeredPane.repaint();
   }
 }
  public void updateArchetypesList(final MavenArchetype selected) {
    ApplicationManager.getApplication().assertIsDispatchThread();

    myLoadingIcon.setBackground(myArchetypesTree.getBackground());

    ((CardLayout) myArchetypesPanel.getLayout()).show(myArchetypesPanel, "loading");

    final Object currentUpdaterMarker = new Object();
    myCurrentUpdaterMarker = currentUpdaterMarker;

    ApplicationManager.getApplication()
        .executeOnPooledThread(
            new Runnable() {
              public void run() {
                final Set<MavenArchetype> archetypes =
                    MavenIndicesManager.getInstance().getArchetypes();

                //noinspection SSBasedInspection
                SwingUtilities.invokeLater(
                    new Runnable() {
                      public void run() {
                        if (currentUpdaterMarker != myCurrentUpdaterMarker)
                          return; // Other updater has been run.

                        ((CardLayout) myArchetypesPanel.getLayout())
                            .show(myArchetypesPanel, "archetypes");

                        TreeNode root = groupAndSortArchetypes(archetypes);
                        TreeModel model = new DefaultTreeModel(root);
                        myArchetypesTree.setModel(model);

                        if (selected != null) {
                          TreePath path = findNodePath(selected, model, model.getRoot());
                          if (path != null) {
                            myArchetypesTree.expandPath(path.getParentPath());
                            TreeUtil.selectPath(myArchetypesTree, path, true);
                          }
                        }

                        updateArchetypeDescription();
                      }
                    });
              }
            });
  }
 protected final void hideProgress() {
   myGlassLayer.setEnabled(true);
   myProgressIcon.suspend();
   myLayeredPane.remove(myProgressPanel);
 }