use of org.netbeans.lib.cvsclient.file.DirectoryObject 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.DirectoryObject in project intellij-community by JetBrains.
the class ImportCommand method addFileRequests.
/**
* Adds recursively all request for files and directories in the specified
* directory to the specified requestList.
*/
private void addFileRequests(File directory, Requests requests, IRequestProcessor requestProcessor, IClientEnvironment clientEnvironment) throws IOException {
final DirectoryObject directoryObject = clientEnvironment.getCvsFileSystem().getLocalFileSystem().getDirectoryObject(directory);
final String relativePath = directoryObject.toUnixPath();
String repository = getRepositoryRoot(clientEnvironment);
if (!relativePath.equals(".")) {
repository += '/' + relativePath;
}
requests.addRequest(new DirectoryRequest(relativePath, repository));
final File[] files = directory.listFiles();
if (files == null) {
return;
}
final List<File> subdirectories = new ArrayList();
for (final File file : files) {
if (file.isDirectory()) {
final DirectoryObject subDirObject = clientEnvironment.getCvsFileSystem().getLocalFileSystem().getDirectoryObject(file);
if (clientEnvironment.getIgnoreFileFilter().shouldBeIgnored(subDirObject, clientEnvironment.getCvsFileSystem())) {
continue;
}
subdirectories.add(file);
} else {
final FileObject fileObject = clientEnvironment.getCvsFileSystem().getLocalFileSystem().getFileObject(file);
if (clientEnvironment.getIgnoreFileFilter().shouldBeIgnored(fileObject, clientEnvironment.getCvsFileSystem())) {
continue;
}
final KeywordSubstitution keywordSubstMode = getKeywordSubstMode(file.getName());
final boolean writable = clientEnvironment.getLocalFileReader().isWritable(fileObject, clientEnvironment.getCvsFileSystem());
if (keywordSubstMode != null) {
requests.addKoptRequest(keywordSubstMode);
}
requests.addModifiedRequest(fileObject, keywordSubstMode == KeywordSubstitution.BINARY, writable);
}
}
for (final File subdirectory : subdirectories) {
addFileRequests(subdirectory, requests, requestProcessor, clientEnvironment);
}
}
use of org.netbeans.lib.cvsclient.file.DirectoryObject 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.DirectoryObject in project intellij-community by JetBrains.
the class LocalPathIndifferentOperationHelper method createFileObjects.
private AbstractFileObject[] createFileObjects() {
ArrayList<AbstractFileObject> result = new ArrayList<>();
Collection<File> parents = collectAllParents();
Map<File, DirectoryObject> parentsMap = new HashMap<>();
for (final File file : parents) {
String relativeFileName = file.getPath().replace(File.separatorChar, '/');
if (!StringUtil.startsWithChar(relativeFileName, '/'))
relativeFileName = "/" + relativeFileName;
parentsMap.put(file, DirectoryObject.createInstance(relativeFileName));
}
for (final File file : myFileToEntryMap.keySet()) {
result.add(FileObject.createInstance(parentsMap.get(file.getParentFile()), "/" + file.getName()));
}
return result.toArray(new AbstractFileObject[result.size()]);
}
use of org.netbeans.lib.cvsclient.file.DirectoryObject in project intellij-community by JetBrains.
the class CreateFileObjects method createAbstractFileObject.
private AbstractFileObject createAbstractFileObject(File parent, File file, boolean isDirectory) {
myCreatedFiles.add(file);
String relativeFileName = "/" + file.getName();
if (parent == null) {
return isDirectory ? DirectoryObject.createInstance(relativeFileName) : FileObject.createInstance(relativeFileName);
} else {
DirectoryObject parentObject = getDirectoryObjectFor(parent);
return isDirectory ? DirectoryObject.createInstance(parentObject, relativeFileName) : FileObject.createInstance(parentObject, relativeFileName);
}
}
Aggregations