IDEA-67402 VFS VCS listener: files, generated through VFS, menthioned in ignored pattern, are not ignored in listener

This commit is contained in:
irengrig
2011-04-04 15:39:14 +04:00
parent 1c17d184d4
commit dd2541151d
3 changed files with 12 additions and 8 deletions
@@ -256,4 +256,5 @@ public abstract class ProjectLevelVcsManager {
protected abstract VcsEnvironmentsProxyCreator getProxyCreator();
public abstract VcsHistoryCache getVcsHistoryCache();
public abstract boolean isFileInContent(final VirtualFile vf);
}
@@ -39,6 +39,7 @@ import java.util.*;
*/
public abstract class VcsVFSListener implements Disposable {
private VcsDirtyScopeManager myDirtyScopeManager;
private final ProjectLevelVcsManager myVcsManager;
protected static class MovedFileInfo {
public final String myOldPath;
@@ -75,9 +76,9 @@ public abstract class VcsVFSListener implements Disposable {
final MyVirtualFileAdapter myVFSListener = new MyVirtualFileAdapter();
final MyCommandAdapter myCommandListener = new MyCommandAdapter();
final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project);
myAddOption = vcsManager.getStandardConfirmation(VcsConfiguration.StandardConfirmation.ADD, vcs);
myRemoveOption = vcsManager.getStandardConfirmation(VcsConfiguration.StandardConfirmation.REMOVE, vcs);
myVcsManager = ProjectLevelVcsManager.getInstance(project);
myAddOption = myVcsManager.getStandardConfirmation(VcsConfiguration.StandardConfirmation.ADD, vcs);
myRemoveOption = myVcsManager.getStandardConfirmation(VcsConfiguration.StandardConfirmation.REMOVE, vcs);
VirtualFileManager.getInstance().addVirtualFileListener(myVFSListener, this);
CommandProcessor.getInstance().addCommandListener(myCommandListener, this);
@@ -87,7 +88,8 @@ public abstract class VcsVFSListener implements Disposable {
}
protected boolean isEventIgnored(final VirtualFileEvent event) {
return event.isFromRefresh() || ProjectLevelVcsManager.getInstance(myProject).getVcsFor(event.getFile()) != myVcs;
return event.isFromRefresh() || myVcsManager.getVcsFor(event.getFile()) != myVcs ||
(! myVcsManager.isFileInContent(event.getFile())) || myChangeListManager.isIgnoredFile(event.getFile());
}
protected void executeAdd() {
@@ -108,8 +108,9 @@ public class ProjectLevelVcsManagerImpl extends ProjectLevelVcsManagerEx impleme
private final VcsHistoryCache myVcsHistoryCache;
private MessageBusConnection myConnect;
private VcsListener myVcsListener;
private final ExcludedFileIndex myExcludedIndex;
public ProjectLevelVcsManagerImpl(Project project, final FileStatusManager manager, MessageBus messageBus) {
public ProjectLevelVcsManagerImpl(Project project, final FileStatusManager manager, MessageBus messageBus, final ExcludedFileIndex excludedFileIndex) {
myProject = project;
myMessageBus = messageBus;
mySerialization = new ProjectLevelVcsManagerSerialization();
@@ -135,6 +136,7 @@ public class ProjectLevelVcsManagerImpl extends ProjectLevelVcsManagerEx impleme
}
};
myConnect.subscribe(ProjectLevelVcsManager.VCS_CONFIGURATION_CHANGED, myVcsListener);
myExcludedIndex = excludedFileIndex;
}
public void initComponent() {
@@ -719,9 +721,8 @@ public void addMessageToConsoleWindow(final String message, final TextAttributes
}
public boolean isFileInContent(final VirtualFile vf) {
final ExcludedFileIndex excludedIndex = ExcludedFileIndex.getInstance(myProject);
return vf != null && (excludedIndex.isInContent(vf) || isFileInBaseDir(vf) || vf.equals(myProject.getBaseDir()) ||
hasExplicitMapping(vf) || isInDirectoryBasedRoot(vf)) && ! excludedIndex.isExcludedFile(vf);
return vf != null && (myExcludedIndex.isInContent(vf) || isFileInBaseDir(vf) || vf.equals(myProject.getBaseDir()) ||
hasExplicitMapping(vf) || isInDirectoryBasedRoot(vf)) && ! myExcludedIndex.isExcludedFile(vf);
}
private boolean isInDirectoryBasedRoot(final VirtualFile file) {