コード例 #1
0
 public boolean editName(@NotNull final String fromName, @NotNull final String toName) {
   if (fromName.equals(toName)) return false;
   final LocalChangeList list = myMap.get(fromName);
   final boolean canEdit = list != null && (!list.isReadOnly());
   if (canEdit) {
     final LocalChangeListImpl listImpl = (LocalChangeListImpl) list;
     listImpl.setNameImpl(toName);
     myMap.remove(fromName);
     myMap.put(toName, list);
     final ChangeListEditHandler editHandler = listImpl.getEditHandler();
     if (editHandler != null) {
       listImpl.setCommentImpl(
           editHandler.changeCommentOnChangeName(toName, listImpl.getComment()));
     }
   }
   return canEdit;
 }
コード例 #2
0
  public void notifyDoneProcessingChanges(final ChangeListListener dispatcher) {
    List<ChangeList> changedLists = new ArrayList<ChangeList>();
    final Map<LocalChangeListImpl, List<Change>> removedChanges =
        new HashMap<LocalChangeListImpl, List<Change>>();
    final Map<LocalChangeListImpl, List<Change>> addedChanges =
        new HashMap<LocalChangeListImpl, List<Change>>();
    for (LocalChangeList list : myMap.values()) {
      final List<Change> removed = new ArrayList<Change>();
      final List<Change> added = new ArrayList<Change>();
      final LocalChangeListImpl listImpl = (LocalChangeListImpl) list;
      if (listImpl.doneProcessingChanges(removed, added)) {
        changedLists.add(list);
      }
      if (!removed.isEmpty()) {
        removedChanges.put(listImpl, removed);
      }
      if (!added.isEmpty()) {
        addedChanges.put(listImpl, added);
      }
    }
    for (Map.Entry<LocalChangeListImpl, List<Change>> entry : removedChanges.entrySet()) {
      dispatcher.changesRemoved(entry.getValue(), entry.getKey());
    }
    for (Map.Entry<LocalChangeListImpl, List<Change>> entry : addedChanges.entrySet()) {
      dispatcher.changesAdded(entry.getValue(), entry.getKey());
    }
    for (ChangeList changeList : changedLists) {
      dispatcher.changeListChanged(changeList);
    }
    mySwitchedHolder.calculateChildren();

    for (String name : myListsToDisappear) {
      final LocalChangeList changeList = myMap.get(name);
      if ((changeList != null)
          && changeList.getChanges().isEmpty()
          && (!changeList.isReadOnly())
          && (!changeList.isDefault())) {
        removeChangeList(name);
      }
    }
    myListsToDisappear.clear();
  }