summaryrefslogtreecommitdiff
path: root/platform/vcs-impl/src/com/intellij/openapi/vcs/changes
diff options
context:
space:
mode:
Diffstat (limited to 'platform/vcs-impl/src/com/intellij/openapi/vcs/changes')
-rw-r--r--platform/vcs-impl/src/com/intellij/openapi/vcs/changes/MapIgnoredFilesHolder.java6
-rw-r--r--platform/vcs-impl/src/com/intellij/openapi/vcs/changes/RemoteRevisionsCache.java25
-rw-r--r--platform/vcs-impl/src/com/intellij/openapi/vcs/changes/UpdatingChangeListBuilder.java14
-rw-r--r--platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsGuess.java7
-rw-r--r--platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesTreeList.java3
5 files changed, 30 insertions, 25 deletions
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/MapIgnoredFilesHolder.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/MapIgnoredFilesHolder.java
index 297e46482135..5ba7ce8cab0e 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/MapIgnoredFilesHolder.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/MapIgnoredFilesHolder.java
@@ -20,7 +20,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.AbstractVcs;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.containers.ContainerUtil;
-import com.intellij.util.containers.hash.HashSet;
+import gnu.trove.THashSet;
import java.util.Collection;
import java.util.Set;
@@ -40,8 +40,8 @@ public class MapIgnoredFilesHolder extends AbstractIgnoredFilesHolder {
public MapIgnoredFilesHolder(Project project) {
super(project);
myProject = project;
- mySet = new HashSet<VirtualFile>();
- myVcsIgnoredSet = new HashSet<VirtualFile>(); //collect ignored files from VcsChangeProvider -> processIgnored
+ mySet = new THashSet<VirtualFile>();
+ myVcsIgnoredSet = new THashSet<VirtualFile>(); //collect ignored files from VcsChangeProvider -> processIgnored
}
@Override
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/RemoteRevisionsCache.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/RemoteRevisionsCache.java
index 0ff134eb723a..7870b7ddbe02 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/RemoteRevisionsCache.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/RemoteRevisionsCache.java
@@ -16,13 +16,11 @@
package com.intellij.openapi.vcs.changes;
import com.intellij.lifecycle.PeriodicalTasksCloser;
-import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Couple;
-import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Getter;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.vcs.*;
@@ -57,12 +55,12 @@ public class RemoteRevisionsCache implements PlusMinus<Pair<String, AbstractVcs>
private final Object myLock;
private final Map<String, RemoteDifferenceStrategy> myKinds;
private final ControlledCycle myControlledCycle;
- private final MessageBusConnection myConnection;
public static RemoteRevisionsCache getInstance(final Project project) {
return PeriodicalTasksCloser.getInstance().safeGetService(project, RemoteRevisionsCache.class);
}
+ @SuppressWarnings("UnusedDeclaration") // initialized as a Service
private RemoteRevisionsCache(final Project project) {
myProject = project;
myLock = new Object();
@@ -73,15 +71,11 @@ public class RemoteRevisionsCache implements PlusMinus<Pair<String, AbstractVcs>
myChangeDecorator = new RemoteStatusChangeNodeDecorator(this);
myVcsManager = ProjectLevelVcsManager.getInstance(project);
- myConnection = myProject.getMessageBus().connect();
- myConnection.subscribe(ProjectLevelVcsManager.VCS_CONFIGURATION_CHANGED, this);
- myConnection.subscribe(ProjectLevelVcsManager.VCS_CONFIGURATION_CHANGED_IN_PLUGIN, this);
+ MessageBusConnection connection = myProject.getMessageBus().connect();
+ connection.subscribe(ProjectLevelVcsManager.VCS_CONFIGURATION_CHANGED, this);
+ connection.subscribe(ProjectLevelVcsManager.VCS_CONFIGURATION_CHANGED_IN_PLUGIN, this);
myKinds = new HashMap<String, RemoteDifferenceStrategy>();
- Disposer.register(project, new Disposable() {
- public void dispose() {
- myConnection.disconnect();
- }
- });
+
final VcsConfiguration vcsConfiguration = VcsConfiguration.getInstance(myProject);
myControlledCycle = new ControlledCycle(project, new Getter<Boolean>() {
@Override
@@ -92,7 +86,14 @@ public class RemoteRevisionsCache implements PlusMinus<Pair<String, AbstractVcs>
boolean somethingChanged = myRemoteRevisionsNumbersCache.updateStep();
somethingChanged |= myRemoteRevisionsStateCache.updateStep();
if (somethingChanged) {
- myProject.getMessageBus().syncPublisher(REMOTE_VERSION_CHANGED).run();
+ ApplicationManager.getApplication().runReadAction(new Runnable() {
+ @Override
+ public void run() {
+ if (!myProject.isDisposed()) {
+ myProject.getMessageBus().syncPublisher(REMOTE_VERSION_CHANGED).run();
+ }
+ }
+ });
}
}
return shouldBeDone;
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/UpdatingChangeListBuilder.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/UpdatingChangeListBuilder.java
index 93919fcb2bd0..fdc079641b68 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/UpdatingChangeListBuilder.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/UpdatingChangeListBuilder.java
@@ -66,14 +66,14 @@ class UpdatingChangeListBuilder implements ChangelistBuilder {
}
public void processChange(final Change change, VcsKey vcsKey) {
- processChangeInList( change, (ChangeList) null, vcsKey);
+ processChangeInList(change, (ChangeList)null, vcsKey);
}
public void processChangeInList(final Change change, @Nullable final ChangeList changeList, final VcsKey vcsKey) {
checkIfDisposed();
LOG.debug("[processChangeInList-1] entering, cl name: " + ((changeList == null) ? null: changeList.getName()) +
- " change: " + ChangesUtil.getFilePath(change).getPath());
+ " change: " + ChangesUtil.getFilePath(change).getPath());
final String fileName = ChangesUtil.getFilePath(change).getName();
if (FileTypeManager.getInstance().isFileIgnored(fileName)) {
LOG.debug("[processChangeInList-1] file type ignored");
@@ -86,11 +86,13 @@ class UpdatingChangeListBuilder implements ChangelistBuilder {
if (changeList != null) {
LOG.debug("[processChangeInList-1] to add change to cl");
myChangeListWorker.addChangeToList(changeList.getName(), change, vcsKey);
- } else {
+ }
+ else {
LOG.debug("[processChangeInList-1] to add to corresponding list");
myChangeListWorker.addChangeToCorrespondingList(change, vcsKey);
}
- } else {
+ }
+ else {
LOG.debug("[processChangeInList-1] not under scope");
}
}
@@ -203,7 +205,7 @@ class UpdatingChangeListBuilder implements ChangelistBuilder {
if (file == null) return;
checkIfDisposed();
if (myScope.belongsTo(new FilePathImpl(file))) {
- ((LogicallyLockedHolder) myComposite.get(FileHolder.HolderType.LOGICALLY_LOCKED)).add(file, logicalLock);
+ ((LogicallyLockedHolder)myComposite.get(FileHolder.HolderType.LOGICALLY_LOCKED)).add(file, logicalLock);
}
}
@@ -220,7 +222,7 @@ class UpdatingChangeListBuilder implements ChangelistBuilder {
if (file == null) return;
checkIfDisposed();
if (myScope.belongsTo(new FilePathImpl(file))) {
- ((SwitchedFileHolder) myComposite.get(FileHolder.HolderType.ROOT_SWITCH)).addFile(file, branch, false);
+ ((SwitchedFileHolder)myComposite.get(FileHolder.HolderType.ROOT_SWITCH)).addFile(file, branch, false);
}
}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsGuess.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsGuess.java
index f5abcf039ece..00ca9f2ebf4f 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsGuess.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsGuess.java
@@ -22,6 +22,7 @@ import com.intellij.openapi.roots.FileIndexFacade;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.vcs.AbstractVcs;
import com.intellij.openapi.vcs.FilePath;
+import com.intellij.openapi.vcs.ProjectLevelVcsManager;
import com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
@@ -34,7 +35,7 @@ public class VcsGuess {
VcsGuess(final Project project) {
myProject = project;
- myVcsManager = (ProjectLevelVcsManagerImpl) ProjectLevelVcsManagerImpl.getInstance(myProject);
+ myVcsManager = (ProjectLevelVcsManagerImpl)ProjectLevelVcsManager.getInstance(myProject);
myExcludedFileIndex = PeriodicalTasksCloser.getInstance().safeGetService(myProject, FileIndexFacade.class);
}
@@ -72,14 +73,14 @@ public class VcsGuess {
final boolean inContent = myVcsManager.isFileInContent(validParent);
if (inContent) return true;
if (filePath != null) {
- return isFileInBaseDir(filePath, myProject.getBaseDir()) && ! myExcludedFileIndex.isExcludedFile(validParent);
+ return isFileInBaseDir(filePath, myProject.getBaseDir()) && !myExcludedFileIndex.isExcludedFile(validParent);
}
return false;
}
});
}
- private boolean isFileInBaseDir(final FilePath filePath, final VirtualFile baseDir) {
+ private static boolean isFileInBaseDir(final FilePath filePath, final VirtualFile baseDir) {
final VirtualFile parent = filePath.getVirtualFileParent();
return !filePath.isDirectory() && parent != null && parent.equals(baseDir);
}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesTreeList.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesTreeList.java
index 21ee42093193..2b4ea995448b 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesTreeList.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesTreeList.java
@@ -27,6 +27,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.EmptyRunnable;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.SystemInfo;
+import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vcs.FilePath;
@@ -445,7 +446,7 @@ public abstract class ChangesTreeList<T> extends JPanel implements TypeSafeDataP
ContentRevision afterRevision = change.getAfterRevision();
if (afterRevision == null) return false;
FilePath file = afterRevision.getFile();
- return file.getName().equals(toSelect.getName());
+ return FileUtil.pathsEqual(file.getPath(), toSelect.getPath());
}
protected abstract DefaultTreeModel buildTreeModel(final List<T> changes, final ChangeNodeDecorator changeNodeDecorator);