diff --git a/platform/util/src/com/intellij/util/containers/WeakValueHashMap.java b/platform/util/src/com/intellij/util/containers/WeakValueHashMap.java index c5b1e4fdbc42..1591e509a2dd 100644 --- a/platform/util/src/com/intellij/util/containers/WeakValueHashMap.java +++ b/platform/util/src/com/intellij/util/containers/WeakValueHashMap.java @@ -17,6 +17,7 @@ package com.intellij.util.containers; import gnu.trove.THashMap; import gnu.trove.TObjectHashingStrategy; +import org.jetbrains.annotations.NotNull; import java.lang.ref.ReferenceQueue; import java.lang.ref.WeakReference; @@ -27,9 +28,9 @@ public final class WeakValueHashMap implements Map{ private final ReferenceQueue myQueue = new ReferenceQueue(); private static class MyReference extends WeakReference { - final K key; + private final K key; - public MyReference(K key, T referent, ReferenceQueue q) { + private MyReference(K key, T referent, ReferenceQueue q) { super(referent, q); this.key = key; } @@ -39,7 +40,7 @@ public final class WeakValueHashMap implements Map{ myMap = new THashMap>(); } - public WeakValueHashMap(TObjectHashingStrategy strategy) { + public WeakValueHashMap(@NotNull TObjectHashingStrategy strategy) { myMap = new THashMap>(strategy); } @@ -49,58 +50,71 @@ public final class WeakValueHashMap implements Map{ if (ref == null) { return; } - if (myMap.get(ref.key) == ref){ - myMap.remove(ref.key); + @SuppressWarnings("unchecked") + K key = (K)ref.key; + if (myMap.get(key) == ref){ + myMap.remove(key); } } } + @Override public V get(Object key) { MyReference ref = myMap.get(key); if (ref == null) return null; return ref.get(); } + @Override public V put(K key, V value) { processQueue(); MyReference oldRef = myMap.put(key, new MyReference(key, value, myQueue)); return oldRef != null ? oldRef.get() : null; } + @Override public V remove(Object key) { processQueue(); MyReference ref = myMap.remove(key); return ref != null ? ref.get() : null; } + @Override public void putAll(Map t) { throw new RuntimeException("method not implemented"); } + @Override public void clear() { myMap.clear(); } + @Override public int size() { return myMap.size(); //? } + @Override public boolean isEmpty() { return myMap.isEmpty(); //? } + @Override public boolean containsKey(Object key) { return get(key) != null; } + @Override public boolean containsValue(Object value) { throw new RuntimeException("method not implemented"); } + @Override public Set keySet() { return myMap.keySet(); } + @Override public Collection values() { List result = new ArrayList(); final Collection> refs = myMap.values(); @@ -113,6 +127,7 @@ public final class WeakValueHashMap implements Map{ return result; } + @Override public Set> entrySet() { throw new RuntimeException("method not implemented"); } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/FilePathImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/FilePathImpl.java index ab38f7f6e305..82e475af0aed 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/FilePathImpl.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/FilePathImpl.java @@ -75,7 +75,7 @@ public class FilePathImpl implements FilePath { this(virtualParent, name, isDirectory, null, forDeleted); } - public FilePathImpl(final File file, final boolean isDirectory) { + public FilePathImpl(@NotNull File file, final boolean isDirectory) { myFile = file; myName = file.getName(); myIsDirectory = isDirectory; @@ -90,7 +90,8 @@ public class FilePathImpl implements FilePath { if (getVirtualFile() != null && subPath.indexOf('/') == -1 && subPath.indexOf('\\') == -1) { return new FilePathImpl(getVirtualFile(), subPath, isDirectory, true); - } else { + } + else { return new FilePathImpl(new File(getIOFile(), subPath), isDirectory); } } @@ -105,15 +106,16 @@ public class FilePathImpl implements FilePath { } else { if (! isSpecialName(myName) && ! isSpecialName(((FilePath)o).getName()) && - (! Comparing.equal(myName, ((FilePath)o).getName()))) return false; + ! Comparing.equal(myName, ((FilePath)o).getName())) return false; return myFile.equals(((FilePath)o).getIOFile()); } } - private boolean isSpecialName(final String name) { + private static boolean isSpecialName(final String name) { return ".".equals(name) || "..".equals(name); } + @Override public void refresh() { if (!myNonLocal) { if (myVirtualParent == null) { @@ -125,12 +127,14 @@ public class FilePathImpl implements FilePath { } } + @Override public void hardRefresh() { if (! myNonLocal && (myVirtualFile == null || ! myVirtualFile.isValid())) { myVirtualFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(myFile); } } + @Override public String getPath() { final VirtualFile virtualFile = myVirtualFile; if (virtualFile != null && virtualFile.isValid()) { @@ -145,6 +149,7 @@ public class FilePathImpl implements FilePath { myIsDirectory = isDirectory; } + @Override public boolean isDirectory() { if (myVirtualFile == null) { return myIsDirectory; @@ -154,6 +159,7 @@ public class FilePathImpl implements FilePath { } } + @Override public boolean isUnder(FilePath parent, boolean strict) { if (myVirtualFile != null && parent.getVirtualFile() != null) { return VfsUtil.isAncestor(parent.getVirtualFile(), myVirtualFile, strict); @@ -161,6 +167,7 @@ public class FilePathImpl implements FilePath { return FileUtil.isAncestor(parent.getIOFile(), getIOFile(), strict); } + @Override public FilePath getParentPath() { if (myVirtualParent != null && myVirtualParent.isValid()) { return new FilePathImpl(myVirtualParent); @@ -177,6 +184,7 @@ public class FilePathImpl implements FilePath { return new FilePathImpl(new File(path.substring(0, pos)), true); } + @Override @Nullable public VirtualFile getVirtualFile() { if (myVirtualFile != null && !myVirtualFile.isValid()) { @@ -185,6 +193,7 @@ public class FilePathImpl implements FilePath { return myVirtualFile; } + @Override @Nullable public VirtualFile getVirtualFileParent() { if (myVirtualParent != null && !myVirtualParent.isValid()) { @@ -193,15 +202,18 @@ public class FilePathImpl implements FilePath { return myVirtualParent; } + @Override @NotNull public File getIOFile() { return myFile; } + @Override public String getName() { return myName; } + @Override public String getPresentableUrl() { if (myVirtualFile == null) { return myFile.getAbsolutePath(); @@ -211,18 +223,21 @@ public class FilePathImpl implements FilePath { } } + @Override @Nullable public Document getDocument() { - if ((myVirtualFile == null) || (myVirtualFile.getFileType().isBinary())) { + if (myVirtualFile == null || myVirtualFile.getFileType().isBinary()) { return null; } return FileDocumentManager.getInstance().getDocument(myVirtualFile); } + @Override public Charset getCharset() { return getCharset(null); } + @Override public Charset getCharset(Project project) { // try to find existing virtual file VirtualFile existing = myVirtualFile != null && myVirtualFile.isValid() ? myVirtualFile : null; @@ -248,6 +263,7 @@ public class FilePathImpl implements FilePath { return e.getDefaultCharset(); } + @Override public FileType getFileType() { return myVirtualFile != null ? myVirtualFile.getFileType() : FileTypeManager.getInstance().getFileTypeByFileName(myFile.getName()); } @@ -346,6 +362,7 @@ public class FilePathImpl implements FilePath { return "FilePath[" + myFile + "]"; } + @Override public boolean isNonLocal() { return myNonLocal; } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserFileNode.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserFileNode.java index 1335e6fcb5e4..8f844dac73de 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserFileNode.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserFileNode.java @@ -23,6 +23,7 @@ import com.intellij.openapi.vcs.changes.ChangeListManager; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.ui.SimpleTextAttributes; import com.intellij.util.PlatformIcons; +import org.jetbrains.annotations.NotNull; /** * @author yole @@ -30,19 +31,20 @@ import com.intellij.util.PlatformIcons; public class ChangesBrowserFileNode extends ChangesBrowserNode { private final Project myProject; - public ChangesBrowserFileNode(Project project, VirtualFile userObject) { + public ChangesBrowserFileNode(Project project, @NotNull VirtualFile userObject) { super(userObject); myProject = project; - if (!userObject.isDirectory()) { - myCount = 1; - } else { + if (userObject.isDirectory()) { myDirectoryCount = 1; } + else { + myCount = 1; + } } @Override protected boolean isDirectory() { - return (getUserObject()).isDirectory() && + return getUserObject().isDirectory() && FileStatusManager.getInstance(myProject).getStatus(getUserObject()) != FileStatus.NOT_CHANGED; } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserNode.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserNode.java index 8406bd08b0e9..9cc98f10ad79 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserNode.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowserNode.java @@ -108,6 +108,7 @@ public class ChangesBrowserNode extends DefaultMutableTreeNode { return new ChangesBrowserNode(userObject); } + @Override public void insert(MutableTreeNode newChild, int childIndex) { super.insert(newChild, childIndex); myCount = -1; @@ -233,6 +234,7 @@ public class ChangesBrowserNode extends DefaultMutableTreeNode { return userObject == null ? "" : userObject.toString(); } + @Override public T getUserObject() { //noinspection unchecked return (T) userObject; diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesListView.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesListView.java index a4f9e24599fa..63a19e858ebf 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesListView.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesListView.java @@ -19,7 +19,6 @@ import com.intellij.ide.CopyProvider; import com.intellij.ide.dnd.*; import com.intellij.ide.util.treeView.TreeState; import com.intellij.openapi.actionSystem.*; -import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.fileChooser.actions.VirtualFileDeleteProvider; import com.intellij.openapi.fileEditor.OpenFileDescriptor; import com.intellij.openapi.project.Project; @@ -28,7 +27,7 @@ import com.intellij.openapi.util.Trinity; import com.intellij.openapi.vcs.*; import com.intellij.openapi.vcs.changes.*; import com.intellij.openapi.vcs.changes.issueLinks.TreeLinkMouseListener; -import com.intellij.openapi.vfs.VfsUtil; +import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.ui.PopupHandler; import com.intellij.ui.SmartExpander; @@ -59,8 +58,6 @@ import java.util.List; * @author max */ public class ChangesListView extends Tree implements TypeSafeDataProvider, AdvancedDnDSource { - private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.vcs.changes.ui.ChangesListView"); - private ChangesListView.DropTarget myDropTarget; private DnDManager myDndManager; private ChangeListOwner myDragOwner; @@ -92,6 +89,7 @@ public class ChangesListView extends Tree implements TypeSafeDataProvider, Advan new TreeLinkMouseListener(new ChangesBrowserNodeRenderer(myProject, false, false)).installOn(this); } + @Override public DefaultTreeModel getModel() { return (DefaultTreeModel)super.getModel(); } @@ -105,6 +103,7 @@ public class ChangesListView extends Tree implements TypeSafeDataProvider, Advan myDndManager.registerTarget(myDropTarget, this); } + @Override public void dispose() { if (myDropTarget != null) { myDndManager.unregisterSource(this); @@ -175,6 +174,7 @@ public class ChangesListView extends Tree implements TypeSafeDataProvider, Advan } } + @Override public void calcData(DataKey key, DataSink sink) { if (key == VcsDataKeys.CHANGES) { sink.put(VcsDataKeys.CHANGES, getSelectedChanges()); @@ -233,7 +233,7 @@ public class ChangesListView extends Tree implements TypeSafeDataProvider, Advan else if (key == VcsDataKeys.CHANGES_IN_LIST_KEY) { final TreePath selectionPath = getSelectionPath(); if (selectionPath != null && selectionPath.getPathCount() > 1) { - ChangesBrowserNode firstNode = (ChangesBrowserNode)selectionPath.getPathComponent(1); + ChangesBrowserNode firstNode = (ChangesBrowserNode)selectionPath.getPathComponent(1); if (firstNode instanceof ChangesBrowserChangeListNode) { final List list = firstNode.getAllChangesUnder(); sink.put(VcsDataKeys.CHANGES_IN_LIST_KEY, list); @@ -262,7 +262,7 @@ public class ChangesListView extends Tree implements TypeSafeDataProvider, Advan if (path.getPathCount() > 1) { ChangesBrowserNode firstNode = (ChangesBrowserNode)path.getPathComponent(1); if (tag == null || firstNode.getUserObject() == tag) { - ChangesBrowserNode node = (ChangesBrowserNode)path.getLastPathComponent(); + ChangesBrowserNode node = (ChangesBrowserNode)path.getLastPathComponent(); files.addAll(node.getAllFilesUnder()); } } @@ -279,7 +279,7 @@ public class ChangesListView extends Tree implements TypeSafeDataProvider, Advan if (path.getPathCount() > 1) { ChangesBrowserNode firstNode = (ChangesBrowserNode)path.getPathComponent(1); if (tag == null || firstNode.getUserObject() == tag) { - ChangesBrowserNode node = (ChangesBrowserNode)path.getLastPathComponent(); + ChangesBrowserNode node = (ChangesBrowserNode)path.getLastPathComponent(); files.addAll(node.getAllFilePathsUnder()); } } @@ -296,7 +296,7 @@ public class ChangesListView extends Tree implements TypeSafeDataProvider, Advan if (path.getPathCount() > 1) { ChangesBrowserNode firstNode = (ChangesBrowserNode)path.getPathComponent(1); if (firstNode.getUserObject() == TreeModelBuilder.LOCALLY_DELETED_NODE) { - ChangesBrowserNode node = (ChangesBrowserNode)path.getLastPathComponent(); + ChangesBrowserNode node = (ChangesBrowserNode)path.getLastPathComponent(); final List objectsUnder = node.getAllObjectsUnder(LocallyDeletedChange.class); files.addAll(objectsUnder); } @@ -325,7 +325,7 @@ public class ChangesListView extends Tree implements TypeSafeDataProvider, Advan files.addAll(getSelectedVirtualFiles(null)); - return VfsUtil.toVirtualFileArray(files); + return VfsUtilCore.toVirtualFileArray(files); } protected boolean haveSelectedFileType(final Object tag) { @@ -395,13 +395,13 @@ public class ChangesListView extends Tree implements TypeSafeDataProvider, Advan } for (TreePath path : paths) { - ChangesBrowserNode node = (ChangesBrowserNode)path.getLastPathComponent(); + ChangesBrowserNode node = (ChangesBrowserNode)path.getLastPathComponent(); changes.addAll(node.getAllChangesUnder()); } - if (changes.size() == 0) { + if (changes.isEmpty()) { final List selectedModifiedWithoutEditing = getSelectedModifiedWithoutEditing(); - if (selectedModifiedWithoutEditing != null && selectedModifiedWithoutEditing.size() > 0) { + if (selectedModifiedWithoutEditing != null && !selectedModifiedWithoutEditing.isEmpty()) { for(VirtualFile file: selectedModifiedWithoutEditing) { AbstractVcs vcs = ProjectLevelVcsManager.getInstance(myProject).getVcsFor(file); if (vcs == null) continue; @@ -451,6 +451,7 @@ public class ChangesListView extends Tree implements TypeSafeDataProvider, Advan PopupHandler.installPopupHandler(this, myMenuGroup, ActionPlaces.CHANGES_VIEW_POPUP, ActionManager.getInstance()); } + @Override public void updateUI() { super.updateUI(); if (myMenuGroup != null) { @@ -577,6 +578,7 @@ public class ChangesListView extends Tree implements TypeSafeDataProvider, Advan } public class DropTarget implements DnDTarget { + @Override public boolean update(DnDEvent aEvent) { aEvent.hideHighlighter(); aEvent.setDropPossible(false, ""); @@ -614,6 +616,7 @@ public class ChangesListView extends Tree implements TypeSafeDataProvider, Advan return false; } + @Override public void drop(DnDEvent aEvent) { Object attached = aEvent.getAttachedObject(); if (!(attached instanceof ChangeListDragBean)) return; @@ -625,9 +628,11 @@ public class ChangesListView extends Tree implements TypeSafeDataProvider, Advan } } + @Override public void cleanUpOnLeave() { } + @Override public void updateDraggedImage(Image image, Point dropPoint, Point imageOffset) { } } @@ -645,39 +650,47 @@ public class ChangesListView extends Tree implements TypeSafeDataProvider, Advan } private static class NodeToTextConvertor implements Convertor { + @Override public String convert(final TreePath path) { ChangesBrowserNode node = (ChangesBrowserNode)path.getLastPathComponent(); return node.getTextPresentation(); } } + @Override public boolean canStartDragging(DnDAction action, Point dragOrigin) { return action == DnDAction.MOVE && - (getSelectedChanges().length > 0 || getSelectedUnversionedFiles().size() > 0 || getSelectedIgnoredFiles().size() > 0); + (getSelectedChanges().length > 0 || !getSelectedUnversionedFiles().isEmpty() || !getSelectedIgnoredFiles().isEmpty()); } + @Override public DnDDragStartBean startDragging(DnDAction action, Point dragOrigin) { return new DnDDragStartBean(new ChangeListDragBean(this, getSelectedChanges(), getSelectedUnversionedFiles(), getSelectedIgnoredFiles())); } + @Override @Nullable public Pair createDraggedImage(DnDAction action, Point dragOrigin) { final Image image = DragImageFactory.createImage(this); return new Pair(image, new Point(-image.getWidth(null), -image.getHeight(null))); } + @Override public void dragDropEnd() { } + @Override public void dropActionChanged(final int gestureModifiers) { } + @Override @NotNull public JComponent getComponent() { return this; } + @Override public void processMouseEvent(final MouseEvent e) { if (MouseEvent.MOUSE_RELEASED == e.getID() && !isSelectionEmpty() && !e.isShiftDown() && !e.isControlDown() && !e.isMetaDown() && !e.isPopupTrigger()) { @@ -694,10 +707,12 @@ public class ChangesListView extends Tree implements TypeSafeDataProvider, Advan super.processMouseEvent(e); } + @Override public boolean isOverSelection(final Point point) { return TreeUtil.isOverSelection(this, point); } + @Override public void dropSelectionButUnderPoint(final Point point) { TreeUtil.dropSelectionButUnderPoint(this, point); } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/TreeModelBuilder.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/TreeModelBuilder.java index 8b9cfa09f8d0..bb770fde10dc 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/TreeModelBuilder.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/TreeModelBuilder.java @@ -32,6 +32,7 @@ import com.intellij.util.containers.MultiMap; import com.intellij.util.ui.tree.TreeUtil; import com.intellij.vcsUtil.VcsUtil; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.tree.DefaultTreeModel; @@ -68,6 +69,7 @@ public class TreeModelBuilder { final ChangesGroupingPolicy policy = createGroupingPolicy(); for (final Change change : changes) { insertChangeNode(change, policy, root, new Computable() { + @Override public ChangesBrowserNode compute() { return new ChangesBrowserChangeNode(myProject, change, changeNodeDecorator); } @@ -92,7 +94,7 @@ public class TreeModelBuilder { return myPolicy; } - public DefaultTreeModel buildModelFromFiles(final List files) { + public DefaultTreeModel buildModelFromFiles(@NotNull List files) { buildVirtualFiles(files, null); collapseDirectories(model, root); sortNodes(); @@ -119,6 +121,7 @@ public class TreeModelBuilder { myReporter.report(state); } + @Override public void preDecorate(Change change, ChangesBrowserNodeRenderer renderer, boolean showFlatten) { } } @@ -129,7 +132,8 @@ public class TreeModelBuilder { final List modifiedWithoutEditing, final MultiMap switchedFiles, @Nullable Map switchedRoots, - @Nullable final List ignoredFiles, @Nullable final List lockedFolders, + @Nullable final List ignoredFiles, + @Nullable final List lockedFolders, @Nullable final Map logicallyLockedFiles) { resetGrouping(); buildModel(changeLists); @@ -139,7 +143,7 @@ public class TreeModelBuilder { buildVirtualFiles(modifiedWithoutEditing, ChangesBrowserNode.MODIFIED_WITHOUT_EDITING_TAG); } final boolean manyUnversioned = unversionedFiles.getSecond() > unversionedFiles.getFirst().size(); - if (manyUnversioned || (! unversionedFiles.getFirst().isEmpty())) { + if (manyUnversioned || ! unversionedFiles.getFirst().isEmpty()) { resetGrouping(); if (manyUnversioned) { @@ -149,7 +153,7 @@ public class TreeModelBuilder { buildVirtualFiles(unversionedFiles.getFirst(), ChangesBrowserNode.UNVERSIONED_FILES_TAG); } } - if (switchedRoots != null && (! switchedRoots.isEmpty())) { + if (switchedRoots != null && ! switchedRoots.isEmpty()) { resetGrouping(); buildSwitchedRoots(switchedRoots); } @@ -165,7 +169,7 @@ public class TreeModelBuilder { resetGrouping(); buildVirtualFiles(lockedFolders, ChangesBrowserNode.LOCKED_FOLDERS_TAG); } - if (logicallyLockedFiles != null && (! logicallyLockedFiles.isEmpty())) { + if (logicallyLockedFiles != null && ! logicallyLockedFiles.isEmpty()) { resetGrouping(); buildLogicallyLockedFiles(logicallyLockedFiles); } @@ -188,7 +192,7 @@ public class TreeModelBuilder { myPolicyInitialized = false; } - public DefaultTreeModel buildModel(List changeLists) { + public DefaultTreeModel buildModel(@NotNull List changeLists) { final RemoteRevisionsCache revisionsCache = RemoteRevisionsCache.getInstance(myProject); for (ChangeList list : changeLists) { final List changes = new ArrayList(list.getChanges()); @@ -203,6 +207,7 @@ public class TreeModelBuilder { final MyChangeNodeUnderChangeListDecorator decorator = new MyChangeNodeUnderChangeListDecorator(revisionsCache, new ChangeListRemoteState.Reporter(i, listRemoteState)); insertChangeNode(change, policy, listNode, new Computable() { + @Override public ChangesBrowserNode compute() { return new ChangesBrowserChangeNode(myProject, change, decorator); } @@ -220,12 +225,13 @@ public class TreeModelBuilder { return ourInstance; } + @Override public int compare(Change o1, Change o2) { final FilePath fp1 = ChangesUtil.getFilePath(o1); final FilePath fp2 = ChangesUtil.getFilePath(o2); final int diff = fp1.getIOFile().getPath().length() - fp2.getIOFile().getPath().length(); - return diff == 0 ? 0 : (diff < 0 ? -1 : 1); + return diff == 0 ? 0 : diff < 0 ? -1 : 1; } } @@ -238,7 +244,7 @@ public class TreeModelBuilder { } } */ - private void buildVirtualFiles(final List files, @Nullable final Object tag) { + private void buildVirtualFiles(@NotNull List files, @Nullable final Object tag) { final ChangesBrowserNode baseNode = createNode(tag); insertFilesIntoNode(files, baseNode); } @@ -255,7 +261,7 @@ public class TreeModelBuilder { return baseNode; } - private void insertFilesIntoNode(final List files, ChangesBrowserNode baseNode) { + private void insertFilesIntoNode(@NotNull List files, ChangesBrowserNode baseNode) { final ChangesGroupingPolicy policy = createGroupingPolicy(); Collections.sort(files, VirtualFileHierarchicalComparator.getInstance()); @@ -285,7 +291,7 @@ public class TreeModelBuilder { assert file != null; // whether a folder does not matter final String path = file.getPath(); - final StaticFilePath pathKey = (! FileUtil.isAbsolute(path) || VcsUtil.isPathRemote(path)) ? + final StaticFilePath pathKey = ! FileUtil.isAbsolute(path) || VcsUtil.isPathRemote(path) ? new StaticFilePath(false, path, null) : new StaticFilePath(false, new File(file.getIOFile().getPath().replace('\\', '/')).getAbsolutePath(), file.getVirtualFile()); ChangesBrowserNode oldNode = myFoldersCache.get(pathKey.getKey()); @@ -313,13 +319,17 @@ public class TreeModelBuilder { final Change change = new Change(cr, cr, FileStatus.NOT_CHANGED); final String branchName = switchedRoots.get(vf); insertChangeNode(vf, policy, rootsHeadNode, new Computable() { + @Override public ChangesBrowserNode compute() { return new ChangesBrowserChangeNode(myProject, change, new ChangeNodeDecorator() { + @Override public void decorate(Change change, SimpleColoredComponent component, boolean isShowFlatten) { } + @Override public List> stressPartsOfFileName(Change change, String parentPath) { return null; } + @Override public void preDecorate(Change change, ChangesBrowserNodeRenderer renderer, boolean showFlatten) { renderer.append("[" + branchName + "] ", SimpleTextAttributes.GRAYED_BOLD_ATTRIBUTES); } @@ -363,6 +373,7 @@ public class TreeModelBuilder { private Computable defaultNodeCreator(final Object change) { return new Computable() { + @Override public ChangesBrowserNode compute() { return ChangesBrowserNode.create(myProject, change); } @@ -394,6 +405,7 @@ public class TreeModelBuilder { return ourInstance; } + @Override public int compare(ChangesBrowserNode node1, ChangesBrowserNode node2) { final int classdiff = node1.getSortWeight() - node2.getSortWeight(); if (classdiff != 0) return classdiff;