Пример #1
0
  /**
   * Method addComment.
   *
   * @param string
   */
  public void addComment(String comment) {
    // Make comment first element if it's already there
    int index = getCommentIndex(comment);
    if (index != -1) {
      makeFirstElement(index);
      return;
    }
    if (containsCommentTemplate(comment)) return;

    // Insert the comment as the first element
    String[] newComments = new String[Math.min(previousComments.length + 1, maxComments)];
    newComments[0] = comment;
    for (int i = 1; i < newComments.length; i++) {
      newComments[i] = previousComments[i - 1];
    }
    previousComments = newComments;
  }
Пример #2
0
 /**
  * Run the given runnable, waiting until the end to perform a refresh
  *
  * @param runnable
  * @param monitor
  */
 public void run(IRunnableWithProgress runnable, IProgressMonitor monitor)
     throws InvocationTargetException, InterruptedException {
   try {
     notificationLevel++;
     runnable.run(monitor);
   } finally {
     notificationLevel = Math.max(0, notificationLevel - 1);
     if (notificationLevel == 0) {
       try {
         Collection roots = changedRepositories.values();
         broadcastRepositoriesChanged(
             (ICVSRepositoryLocation[]) roots.toArray(new ICVSRepositoryLocation[roots.size()]));
       } finally {
         changedRepositories.clear();
       }
     }
   }
 }