use of org.netbeans.lib.cvsclient.file.AbstractFileObject in project intellij-community by JetBrains.
the class CheckoutCommand method processExistingModules.
private void processExistingModules(ExpandedModules expandedModules, IClientEnvironment clientEnvironment) {
final ICvsFileSystem cvsFileSystem = clientEnvironment.getCvsFileSystem();
for (final String moduleName : expandedModules.getModules()) {
if (moduleName.equals(".")) {
addFileObject(DirectoryObject.getRoot());
break;
}
final File moduleFile = cvsFileSystem.getLocalFileSystem().getFile(moduleName);
final AbstractFileObject abstractFileObject;
final DirectoryObject directoryObject;
if (moduleFile.isFile()) {
abstractFileObject = cvsFileSystem.getLocalFileSystem().getFileObject(moduleFile);
directoryObject = abstractFileObject.getParent();
} else {
directoryObject = cvsFileSystem.getLocalFileSystem().getDirectoryObject(moduleFile);
abstractFileObject = directoryObject;
}
if (clientEnvironment.getAdminReader().hasCvsDirectory(directoryObject, cvsFileSystem)) {
addFileObject(abstractFileObject);
}
}
}
use of org.netbeans.lib.cvsclient.file.AbstractFileObject in project intellij-community by JetBrains.
the class StatusMessageParser method createFile.
// Utils ==================================================================
private File createFile(String fileName) {
File file = null;
if (relativeDirectory != null) {
if (relativeDirectory.trim().equals(".")) {
file = cvsFileSystem.getLocalFileSystem().getFile(fileName);
} else {
file = cvsFileSystem.getLocalFileSystem().getFile(relativeDirectory + '/' + fileName);
}
} else {
for (Iterator it = fileObjects.iterator(); it.hasNext(); ) {
final AbstractFileObject abstractFileObject = (AbstractFileObject) it.next();
if (abstractFileObject instanceof FileObject) {
final FileObject fileObject = (FileObject) abstractFileObject;
if (!fileObject.getName().equals(fileName)) {
continue;
}
it.remove();
return cvsFileSystem.getLocalFileSystem().getFile(fileObject);
}
it.remove();
}
}
BugLog.getInstance().assertTrue(file != null, "Wrong algorithm for detecting file name (" + fileName + ")");
return file;
}
use of org.netbeans.lib.cvsclient.file.AbstractFileObject in project intellij-community by JetBrains.
the class AbstractCommand method appendFileArguments.
protected final void appendFileArguments(StringBuffer buffer) {
boolean appendSpace = false;
for (AbstractFileObject fileObject : fileObjects) {
if (appendSpace) {
buffer.append(' ');
}
buffer.append(fileObject.toUnixPath());
appendSpace = true;
}
}
use of org.netbeans.lib.cvsclient.file.AbstractFileObject in project intellij-community by JetBrains.
the class FileSystemScanner method scan.
// Actions ================================================================
public void scan(List<AbstractFileObject> abstractFileObjects, CvsFiles cvsFiles) throws IOException {
cvsFiles.clear();
if (abstractFileObjects.size() == 0) {
// if no arguments have been specified, then specify the
// local directory - the "top level" for this command
scanDirectories(DirectoryObject.getRoot(), cvsFiles);
} else {
for (final AbstractFileObject fileOrDirectory : abstractFileObjects) {
if (fileOrDirectory instanceof DirectoryObject) {
final DirectoryObject directoryObject = (DirectoryObject) fileOrDirectory;
scanDirectories(directoryObject, cvsFiles);
} else if (fileOrDirectory instanceof FileObject) {
final FileObject fileObject = (FileObject) fileOrDirectory;
addRequestsForFile(fileObject, cvsFiles);
}
}
}
}
use of org.netbeans.lib.cvsclient.file.AbstractFileObject 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