private ChangeListWorker(final ChangeListWorker worker) { myProject = worker.myProject; myMap = new LinkedHashMap<String, LocalChangeList>(); myIdx = new ChangeListsIndexes(worker.myIdx); myLocallyDeleted = worker.myLocallyDeleted.copy(); mySwitchedHolder = worker.mySwitchedHolder.copy(); myDelta = worker.myDelta; myListsToDisappear = new LinkedList<String>(worker.myListsToDisappear); LocalChangeList defaultList = null; for (LocalChangeList changeList : worker.myMap.values()) { final LocalChangeList copy = changeList.copy(); final String changeListName = copy.getName(); myMap.put(changeListName, copy); if (copy.isDefault()) { defaultList = copy; } } if (defaultList == null) { LOG.info("default list not found when copy"); defaultList = myMap.get(worker.getDefaultListName()); } if (defaultList == null) { LOG.info("default list not found when copy in original object too"); if (!myMap.isEmpty()) { defaultList = myMap.values().iterator().next(); } else { // can be when there's no vcs configured /// LOG.error("no changelists at all"); } } myDefault = defaultList; }
@Override public LocalChangeList findOrCreateList(final String name, final String comment) { LocalChangeList list = myWorker.getCopyByName(name); if (list == null) { list = addChangeList(name, comment); } return list; }
@Override public void setDefaultChangeList(@NotNull String list) { myWorker.setDefault(list); }
@Override public FileStatus getStatus(@NotNull FilePath filePath) { return myWorker.getStatus(filePath); }
@Deprecated @Override public FileStatus getStatus(File file) { return myWorker.getStatus(VcsUtil.getFilePath(file)); }
@Override public FileStatus getStatus(VirtualFile file) { return myWorker.getStatus(file); }
@Override public void setListsToDisappear(final Collection<String> names) { myWorker.setListsToDisappear(names); }
@Override public void editName(String oldName, String newName) { myWorker.editName(oldName, newName); }
@Override public void editComment(final String name, final String comment) { myWorker.editComment(name, comment); }
@Override public LocalChangeList addChangeList(final String name, final String comment) { return myWorker.addChangeList(null, name, comment, true, null); }
@Nullable @Override public LocalChangeList findChangeList(final String name) { return myWorker.getCopyByName(name); }
@Override public List<LocalChangeList> getListsCopy() { return myWorker.getListsCopy(); }