Example #1
0
 /**
  * Given the list of paths converts them to the list of {@link Change Changes} found in the {@link
  * ChangeListManager}, i.e. this works only for local changes. </br> Paths can be absolute or
  * relative to the repository. If a path is not found in the local changes, it is ignored, but the
  * fact is logged.
  */
 @NotNull
 public static List<Change> findLocalChangesForPaths(
     @NotNull Project project,
     @NotNull VirtualFile root,
     @NotNull Collection<String> affectedPaths,
     boolean relativePaths) {
   ChangeListManagerEx changeListManager =
       (ChangeListManagerEx) ChangeListManager.getInstance(project);
   List<Change> affectedChanges = new ArrayList<Change>();
   for (String path : affectedPaths) {
     String absolutePath = relativePaths ? toAbsolute(root, path) : path;
     VirtualFile file = findRefreshFileOrLog(absolutePath);
     if (file != null) {
       Change change = changeListManager.getChange(file);
       if (change != null) {
         affectedChanges.add(change);
       } else {
         String message = "Change is not found for " + file.getPath();
         if (changeListManager.isInUpdate()) {
           message += " because ChangeListManager is being updated.";
         }
         LOG.warn(message);
       }
     }
   }
   return affectedChanges;
 }
 @Override
 public void render(
     final ChangesBrowserNodeRenderer renderer,
     final boolean selected,
     final boolean expanded,
     final boolean hasFocus) {
   if (userObject instanceof LocalChangeList) {
     final LocalChangeList list = ((LocalChangeList) userObject);
     renderer.appendTextWithIssueLinks(
         list.getName(),
         list.isDefault()
             ? SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES
             : SimpleTextAttributes.REGULAR_ATTRIBUTES);
     appendCount(renderer);
     for (ChangeListDecorator decorator : myDecorators) {
       decorator.decorateChangeList(list, renderer, selected, expanded, hasFocus);
     }
     final String freezed = myClManager.isFreezed();
     if (freezed != null) {
       renderer.append(" " + freezed, SimpleTextAttributes.GRAYED_ATTRIBUTES);
     } else if (myClManager.isInUpdate()) {
       renderer.append(
           " " + VcsBundle.message("changes.nodetitle.updating"),
           SimpleTextAttributes.GRAYED_ATTRIBUTES);
     }
     if (!myChangeListRemoteState.getState()) {
       renderer.append(" ");
       renderer.append(
           VcsBundle.message("changes.nodetitle.have.outdated.files"),
           SimpleTextAttributes.ERROR_ATTRIBUTES);
     }
   } else {
     renderer.append(getUserObject().getName(), SimpleTextAttributes.SIMPLE_CELL_ATTRIBUTES);
     appendCount(renderer);
   }
 }