Search in sources :

Example 1 with AbstractFileObject

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

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

Example 3 with AbstractFileObject

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

Example 4 with AbstractFileObject

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

Example 5 with AbstractFileObject

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);
        }
    };
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ICvsFileSystem(org.netbeans.lib.cvsclient.file.ICvsFileSystem) IIgnoreFileFilter(org.netbeans.lib.cvsclient.util.IIgnoreFileFilter) AbstractFileObject(org.netbeans.lib.cvsclient.file.AbstractFileObject) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) HashMap(com.intellij.util.containers.HashMap) Map(java.util.Map) HashSet(com.intellij.util.containers.HashSet)

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