summaryrefslogtreecommitdiff
path: root/platform/vcs-impl/src/com/intellij/openapi/vcs/impl
diff options
context:
space:
mode:
Diffstat (limited to 'platform/vcs-impl/src/com/intellij/openapi/vcs/impl')
-rw-r--r--platform/vcs-impl/src/com/intellij/openapi/vcs/impl/DefaultFileIndexFacade.java5
-rw-r--r--platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ProjectLevelVcsManagerImpl.java16
-rw-r--r--platform/vcs-impl/src/com/intellij/openapi/vcs/impl/VcsRootIterator.java28
-rw-r--r--platform/vcs-impl/src/com/intellij/openapi/vcs/impl/projectlevelman/NewMappings.java11
4 files changed, 39 insertions, 21 deletions
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/DefaultFileIndexFacade.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/DefaultFileIndexFacade.java
index a63bbdbf0a69..d4063478d373 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/DefaultFileIndexFacade.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/DefaultFileIndexFacade.java
@@ -66,6 +66,11 @@ public class DefaultFileIndexFacade extends FileIndexFacade {
}
@Override
+ public boolean isUnderIgnored(@NotNull VirtualFile file) {
+ return false;
+ }
+
+ @Override
public Module getModuleForFile(@NotNull VirtualFile file) {
return null;
}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ProjectLevelVcsManagerImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ProjectLevelVcsManagerImpl.java
index 5cc3a8a9ca92..e699383321ae 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ProjectLevelVcsManagerImpl.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ProjectLevelVcsManagerImpl.java
@@ -132,7 +132,7 @@ public class ProjectLevelVcsManagerImpl extends ProjectLevelVcsManagerEx impleme
myBackgroundableActionHandlerMap = new EnumMap<VcsBackgroundableActions, BackgroundableActionEnabledHandler>(VcsBackgroundableActions.class);
myInitialization = new VcsInitialization(myProject);
- myMappings = new NewMappings(myProject, myMessageBus, this, manager, excludedFileIndex);
+ myMappings = new NewMappings(myProject, myMessageBus, this, manager);
myMappingsToRoots = new MappingsToRoots(myMappings, myProject);
if (!myProject.isDefault()) {
@@ -843,12 +843,24 @@ public class ProjectLevelVcsManagerImpl extends ProjectLevelVcsManagerEx impleme
@Override
public Boolean compute() {
return vf != null && (myExcludedIndex.isInContent(vf) || isFileInBaseDir(vf) || vf.equals(myProject.getBaseDir()) ||
- hasExplicitMapping(vf) || isInDirectoryBasedRoot(vf)) && !myExcludedIndex.isExcludedFile(vf);
+ hasExplicitMapping(vf) || isInDirectoryBasedRoot(vf)
+ || !Registry.is("ide.hide.excluded.files") && myExcludedIndex.isExcludedFile(vf))
+ && !isIgnored(vf);
}
});
}
@Override
+ public boolean isIgnored(VirtualFile vf) {
+ if (Registry.is("ide.hide.excluded.files")) {
+ return myExcludedIndex.isExcludedFile(vf);
+ }
+ else {
+ return myExcludedIndex.isUnderIgnored(vf);
+ }
+ }
+
+ @Override
public boolean dvcsUsedInProject() {
AbstractVcs[] allActiveVcss = getAllActiveVcss();
for (AbstractVcs activeVcs : allActiveVcss) {
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/VcsRootIterator.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/VcsRootIterator.java
index 122988896cb2..cfddcaa3e65d 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/VcsRootIterator.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/VcsRootIterator.java
@@ -36,14 +36,17 @@ public class VcsRootIterator {
// folder path to files to be excluded
private final Map<String, MyRootFilter> myOtherVcsFolders;
private final FileIndexFacade myExcludedFileIndex;
+ private final ProjectLevelVcsManager myVcsManager;
+ private final Project myProject;
public VcsRootIterator(final Project project, final AbstractVcs vcs) {
- final ProjectLevelVcsManager plVcsManager = ProjectLevelVcsManager.getInstance(project);
+ myProject = project;
+ myVcsManager = ProjectLevelVcsManager.getInstance(project);
myOtherVcsFolders = new HashMap<String, MyRootFilter>();
myExcludedFileIndex = PeriodicalTasksCloser.getInstance().safeGetService(project, FileIndexFacade.class);
- final VcsRoot[] allRoots = plVcsManager.getAllVcsRoots();
- final VirtualFile[] roots = plVcsManager.getRootsUnderVcs(vcs);
+ final VcsRoot[] allRoots = myVcsManager.getAllVcsRoots();
+ final VirtualFile[] roots = myVcsManager.getRootsUnderVcs(vcs);
for (VirtualFile root : roots) {
final MyRootFilter rootPresentFilter = new MyRootFilter(root, vcs.getName());
rootPresentFilter.init(allRoots);
@@ -57,14 +60,14 @@ public class VcsRootIterator {
if ((rootFilter != null) && (!rootFilter.accept(file))) {
return false;
}
- return !isExcluded(myExcludedFileIndex, file);
+ return !isIgnoredByVcs(myVcsManager, myProject, file);
}
- private static boolean isExcluded(final FileIndexFacade indexFacade, final VirtualFile file) {
+ private static boolean isIgnoredByVcs(final ProjectLevelVcsManager vcsManager, final Project project, final VirtualFile file) {
return ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() {
@Override
public Boolean compute() {
- return indexFacade.isExcludedFile(file);
+ return !project.isDisposed() && vcsManager.isIgnored(file);
}
});
}
@@ -140,7 +143,7 @@ public class VcsRootIterator {
@Nullable private final VirtualFileFilter myDirectoryFilter;
private final VirtualFile myRoot;
private final MyRootFilter myRootPresentFilter;
- private final FileIndexFacade myExcludedFileIndex;
+ private final ProjectLevelVcsManager myVcsManager;
private MyRootIterator(final Project project,
final VirtualFile root,
@@ -153,13 +156,12 @@ public class VcsRootIterator {
myDirectoryFilter = directoryFilter;
myRoot = root;
- final ProjectLevelVcsManager plVcsManager = ProjectLevelVcsManager.getInstance(project);
- final AbstractVcs vcs = plVcsManager.getVcsFor(root);
- myRootPresentFilter = (vcs == null) ? null : new MyRootFilter(root, vcs.getName());
+ myVcsManager = ProjectLevelVcsManager.getInstance(project);
+ final AbstractVcs vcs = myVcsManager.getVcsFor(root);
+ myRootPresentFilter = vcs == null ? null : new MyRootFilter(root, vcs.getName());
if (myRootPresentFilter != null) {
- myRootPresentFilter.init(ProjectLevelVcsManager.getInstance(myProject).getAllVcsRoots());
+ myRootPresentFilter.init(myVcsManager.getAllVcsRoots());
}
- myExcludedFileIndex = PeriodicalTasksCloser.getInstance().safeGetService(project, FileIndexFacade.class);
}
public void iterate() {
@@ -174,7 +176,7 @@ public class VcsRootIterator {
@NotNull
@Override
public Result visitFileEx(@NotNull VirtualFile file) {
- if (isExcluded(myExcludedFileIndex, file)) return SKIP_CHILDREN;
+ if (isIgnoredByVcs(myVcsManager, myProject, file)) return SKIP_CHILDREN;
if (myRootPresentFilter != null && !myRootPresentFilter.accept(file)) return SKIP_CHILDREN;
if (myProject.isDisposed() || !process(file)) return skipTo(myRoot);
if (myDirectoryFilter != null && file.isDirectory() && !myDirectoryFilter.shouldGoIntoDirectory(file)) return SKIP_CHILDREN;
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/projectlevelman/NewMappings.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/projectlevelman/NewMappings.java
index 32fe920fc4db..5ff541ebc67d 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/projectlevelman/NewMappings.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/projectlevelman/NewMappings.java
@@ -19,7 +19,6 @@ import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.DumbAwareRunnable;
import com.intellij.openapi.project.Project;
-import com.intellij.openapi.roots.FileIndexFacade;
import com.intellij.openapi.ui.MessageType;
import com.intellij.openapi.util.EmptyRunnable;
import com.intellij.openapi.util.Pair;
@@ -52,18 +51,18 @@ public class NewMappings {
private final DefaultVcsRootPolicy myDefaultVcsRootPolicy;
private final MessageBus myMessageBus;
+ private final ProjectLevelVcsManager myVcsManager;
private final FileStatusManager myFileStatusManager;
- private final FileIndexFacade myFileIndexFacade;
private final Project myProject;
private boolean myActivated;
- public NewMappings(final Project project, final MessageBus messageBus,
- final ProjectLevelVcsManagerImpl vcsManager, FileStatusManager fileStatusManager, FileIndexFacade fileIndexFacade) {
+ public NewMappings(final Project project, final MessageBus messageBus, final ProjectLevelVcsManagerImpl vcsManager,
+ FileStatusManager fileStatusManager) {
myProject = project;
myMessageBus = messageBus;
+ myVcsManager = vcsManager;
myFileStatusManager = fileStatusManager;
- myFileIndexFacade = fileIndexFacade;
myLock = new Object();
myVcsToPaths = new HashMap<String, List<VcsDirectoryMapping>>();
myFileWatchRequestsManager = new FileWatchRequestsManager(myProject, this, LocalFileSystem.getInstance());
@@ -235,7 +234,7 @@ public class NewMappings {
@Nullable
public VcsDirectoryMapping getMappingFor(final VirtualFile file, final Object parentModule) {
// if parentModule is not null it means that file belongs to the module so it isn't excluded
- if (parentModule == null && myFileIndexFacade.isExcludedFile(file)) {
+ if (parentModule == null && myVcsManager.isIgnored(file)) {
return null;
}