Search in sources :

Example 6 with AbstractFileObject

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);
    }
}
Also used : DummyRequestsProgressHandler(org.netbeans.lib.cvsclient.progress.sending.DummyRequestsProgressHandler) ICvsListener(org.netbeans.lib.cvsclient.event.ICvsListener) IOException(java.io.IOException) AbstractFileObject(org.netbeans.lib.cvsclient.file.AbstractFileObject) Requests(org.netbeans.lib.cvsclient.request.Requests) IOCommandException(org.netbeans.lib.cvsclient.command.IOCommandException)

Example 7 with AbstractFileObject

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);
        }
    }
}
Also used : ICvsFileSystem(org.netbeans.lib.cvsclient.file.ICvsFileSystem) Iterator(java.util.Iterator) AbstractFileObject(org.netbeans.lib.cvsclient.file.AbstractFileObject) File(java.io.File) DirectoryObject(org.netbeans.lib.cvsclient.file.DirectoryObject)

Example 8 with 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()]);
}
Also used : HashMap(com.intellij.util.containers.HashMap) AbstractFileObject(org.netbeans.lib.cvsclient.file.AbstractFileObject) File(java.io.File) DirectoryObject(org.netbeans.lib.cvsclient.file.DirectoryObject)

Example 9 with AbstractFileObject

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);
        }
    }
}
Also used : AbstractFileObject(org.netbeans.lib.cvsclient.file.AbstractFileObject)

Example 10 with AbstractFileObject

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);
    }
}
Also used : AbstractFileObject(org.netbeans.lib.cvsclient.file.AbstractFileObject)

Aggregations

AbstractFileObject (org.netbeans.lib.cvsclient.file.AbstractFileObject)11 File (java.io.File)5 DirectoryObject (org.netbeans.lib.cvsclient.file.DirectoryObject)4 ICvsFileSystem (org.netbeans.lib.cvsclient.file.ICvsFileSystem)3 HashMap (com.intellij.util.containers.HashMap)2 Iterator (java.util.Iterator)2 FileObject (org.netbeans.lib.cvsclient.file.FileObject)2 DummyRequestsProgressHandler (org.netbeans.lib.cvsclient.progress.sending.DummyRequestsProgressHandler)2 Requests (org.netbeans.lib.cvsclient.request.Requests)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 HashSet (com.intellij.util.containers.HashSet)1 IOException (java.io.IOException)1 Map (java.util.Map)1 IOCommandException (org.netbeans.lib.cvsclient.command.IOCommandException)1 ICvsListener (org.netbeans.lib.cvsclient.event.ICvsListener)1 IIgnoreFileFilter (org.netbeans.lib.cvsclient.util.IIgnoreFileFilter)1