use of org.netbeans.lib.cvsclient.util.IIgnoreFileFilter in project intellij-community by JetBrains.
the class ImportTree method getIgnoreFileFilter.
public IIgnoreFileFilter getIgnoreFileFilter() {
final Collection<File> excludedFiles = new HashSet<>();
for (final VirtualFile excludedFile : myExcludedFiles) {
excludedFiles.add(CvsVfsUtil.getFileFor(excludedFile));
}
final Collection<File> includedFiles = new HashSet<>();
for (VirtualFile includedFile : myIncludedFiles) {
includedFiles.add(CvsVfsUtil.getFileFor(includedFile));
}
return new IIgnoreFileFilter() {
private final Map<File, IgnoredFilesInfo> myParentToIgnoresMap = new HashMap<>();
public boolean shouldBeIgnored(AbstractFileObject abstractFileObject, ICvsFileSystem cvsFileSystem) {
final File file = cvsFileSystem.getLocalFileSystem().getFile(abstractFileObject);
if (file.isDirectory() && file.getName().equals(CvsUtil.CVS))
return true;
if (FileTypeManager.getInstance().isFileIgnored(abstractFileObject.getName()))
return true;
final VirtualFile vFile = LocalFileSystem.getInstance().findFileByIoFile(file);
if (myProject != null && !includedFiles.contains(file)) {
if (vFile != null && isIgnoredByVcs(vFile)) {
return true;
}
}
if (excludedFiles.contains(file))
return true;
final File parentFile = file.getParentFile();
if (parentFile == null)
return false;
if (!myParentToIgnoresMap.containsKey(parentFile)) {
myParentToIgnoresMap.put(parentFile, IgnoredFilesInfoImpl.createForFile(new File(parentFile, CvsUtil.CVS_IGNORE_FILE)));
}
return myParentToIgnoresMap.get(parentFile).shouldBeIgnored(vFile);
}
};
}
Aggregations