Пример #1
0
  /**
   * Sets whether the dialog box monitors MBT Status events. When true, the dialog box registers
   * itself as a listener for MBT Status events and displays them as they arrive. When false, the
   * dialog box is not a registered listener and does not display status events. In both cases,
   * calls to setNote() or setProgress() continue to update the dialog.
   *
   * @param onOff true if status is monitored
   */
  public void setStatusMonitored(final boolean onOff) {
    if (onOff == this.statusMonitored) {
      return; // No change
    }

    if (onOff == true) {
      Status.addStatusListener(this);
    } else {
      Status.removeStatusListener(this);
    }

    this.statusMonitored = onOff;
  }
 /**
  * Update the tree according to the list of loaded roots
  *
  * @param roots the list of roots to add to the tree
  * @param uncheckedCommits the map from vcs root to commit identifiers that should be
  *     uncheckedCommits
  */
 private void updateTree(List<Root> roots, Map<VirtualFile, Set<String>> uncheckedCommits) {
   myTreeRoot.removeAllChildren();
   if (roots == null) {
     roots = Collections.emptyList();
   }
   for (Root r : roots) {
     CheckedTreeNode rootNode = new CheckedTreeNode(r);
     Status status = new Status();
     status.root = r;
     rootNode.add(new DefaultMutableTreeNode(status, false));
     Set<String> unchecked =
         uncheckedCommits != null && uncheckedCommits.containsKey(r.root)
             ? uncheckedCommits.get(r.root)
             : Collections.<String>emptySet();
     for (Commit c : r.commits) {
       CheckedTreeNode child = new CheckedTreeNode(c);
       rootNode.add(child);
       child.setChecked(r.remoteName != null && !unchecked.contains(c.commitId()));
     }
     myTreeRoot.add(rootNode);
   }
 }
Пример #3
0
  /**
   * Initialize the dialog box, creating it's GUI components and setting their initial values.
   *
   * @param title the dialog's title
   * @param message the general message
   */
  protected void initialize(final String title, final String message_) {
    String message = message_;
    //
    // Configure the window.
    //
    if (title == null) {
      this.setTitle("Progress");
    } else {
      this.setTitle(title);
    }

    this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    //
    // Add an empty border around the dialog, and use a border
    // layout.  Prevent resizing.
    //
    this.setResizable(false);
    final Container pane = this.getContentPane();
    final JPanel content = new JPanel();
    content.setLayout(new BorderLayout());
    content.setBorder(new EmptyBorder(10, 10, 10, 10));
    pane.add(content);

    //
    // Add the general message.
    //
    if (message == null) {
      message = "";
    }
    this.messageLabel = new JLabel(message);
    final Font font = this.messageLabel.getFont();
    final Font boldFont = font.deriveFont(Font.BOLD);
    this.messageLabel.setFont(boldFont);
    content.add(this.messageLabel, BorderLayout.NORTH);

    //
    // Add the note, initially empty.
    //
    this.noteLabel = new JLabel(" ");
    content.add(this.noteLabel, BorderLayout.CENTER);

    //
    // Add the progress bar.
    //
    this.progressBar = new JProgressBar(SwingConstants.HORIZONTAL, 0, 100);
    this.progressBar.setBorderPainted(true);
    this.progressBar.setStringPainted(false);
    this.progressBar.setValue(0);
    final Dimension d = new Dimension(300, 20);
    this.progressBar.setMinimumSize(d);
    this.progressBar.setPreferredSize(d);
    content.add(this.progressBar, BorderLayout.SOUTH);

    //
    // Pack and size the dialog.
    //
    this.pack();
    this.validate();

    //
    // Listen to status events.
    //
    Status.addStatusListener(this);
  }
Пример #4
0
 /**
  * Hide the dialog box, removing it from the screen. If the dialog was modal, application
  * interaction is unblocked.
  */
 public void hide() {
   super.hide();
   if (this.statusMonitored) {
     Status.removeStatusListener(this);
   }
 }
Пример #5
0
 /**
  * DOCUMENT ME!
  *
  * @param status DOCUMENT ME!
  */
 public void setStatus(final Status status) {
   this.setStatusMessage(status.getStatusMessage(), status.getMessagePosition());
   this.setRedIconStatus(status.getRedIconState());
   this.setGreenIconStatus(status.getGreenIconState());
 }