use of org.netbeans.lib.cvsclient.file.AbstractFileObject in project intellij-community by JetBrains.
the class AddCommand method execute.
// Implemented ============================================================
public boolean execute(IRequestProcessor requestProcessor, IEventSender eventManager, ICvsListenerRegistry listenerRegistry, IClientEnvironment clientEnvironment, IProgressViewer progressViewer) throws CommandException, AuthenticationException {
BugLog.getInstance().assertTrue(getFileObjects().size() > 0, "No file specified.");
repositoryPathToDirectoryObject.clear();
final Requests requests;
try {
requests = new Requests(CommandRequest.ADD, clientEnvironment);
requests.addArgumentRequest(getKeywordSubst(), "-k");
for (AbstractFileObject abstractFileObject : getFileObjects()) {
addRequests(abstractFileObject, requests, requestProcessor, clientEnvironment);
}
requests.addLocalPathDirectoryRequest();
addArgumentRequests(requests);
} catch (IOException ex) {
throw new IOCommandException(ex);
}
final ICvsListener parser = new AddParser(eventManager, clientEnvironment.getCvsFileSystem());
parser.registerListeners(listenerRegistry);
try {
final boolean result = requestProcessor.processRequests(requests, new DummyRequestsProgressHandler());
createCvsDirectories(clientEnvironment);
return result;
} catch (IOException ex) {
throw new IOCommandException(ex);
} finally {
repositoryPathToDirectoryObject.clear();
parser.unregisterListeners(listenerRegistry);
}
}
use of org.netbeans.lib.cvsclient.file.AbstractFileObject in project intellij-community by JetBrains.
the class ExportCommand method processExistingModules.
private void processExistingModules(ExpandedModules expandedModules, IClientEnvironment clientEnvironment) {
final ICvsFileSystem cvsFileSystem = clientEnvironment.getCvsFileSystem();
for (Iterator it = expandedModules.getModules().iterator(); it.hasNext(); ) {
final String moduleName = (String) it.next();
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 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.AbstractFileObject in project intellij-community by JetBrains.
the class AddFileOperation method addFilesToCommand.
protected void addFilesToCommand(CvsRootProvider root, AbstractCommand command) {
super.addFilesToCommand(root, command);
List<AbstractFileObject> fileObjects = command.getFileObjects();
for (final AbstractFileObject fileObject : fileObjects) {
if (fileObject.getParent() == null) {
LOG.error("Local Root: " + getLocalRootFor(root) + ", Files: " + myFiles);
}
}
}
use of org.netbeans.lib.cvsclient.file.AbstractFileObject in project intellij-community by JetBrains.
the class CvsOperationOnFiles method addFilesToCommand.
protected void addFilesToCommand(CvsRootProvider root, AbstractCommand command) {
CreateFileObjects createFileObjects = new CreateFileObjects(getLocalRootFor(root), getFilesAsArray(root));
Collection<AbstractFileObject> fileObjects = createFileObjects.execute();
for (final AbstractFileObject fileObject : fileObjects) {
command.addFileObject(fileObject);
}
}
Aggregations