Search in sources :

Example 1 with Scope

use of org.netbeans.modules.refactoring.api.Scope in project netbeans-mmd-plugin by raydac.

the class AbstractPlugin method allMapsInProject.

protected Collection<FileObject> allMapsInProject(final Project project) {
    final Collection<? extends Scope> scopes = this.refactoring.getRefactoringSource().lookupAll(Scope.class);
    if (!scopes.isEmpty()) {
        final Collection<FileObject> mindMaps = new HashSet<FileObject>();
        for (final Scope s : scopes) {
            for (final NonRecursiveFolder f : s.getFolders()) {
                synchronized (this.cache) {
                    Collection<FileObject> found = this.cache.get(f.getFolder());
                    if (found == null) {
                        found = RefactoringUtils.findAllMindMapsInFolder(f, this);
                        this.cache.put(f.getFolder(), found);
                    }
                    mindMaps.addAll(found);
                }
            }
        }
        return mindMaps;
    } else {
        if (project == null) {
            return Collections.<FileObject>emptyList();
        }
        final FileObject projectFolder = project.getProjectDirectory();
        synchronized (this.cache) {
            Collection<FileObject> result = this.cache.get(projectFolder);
            if (result == null) {
                result = RefactoringUtils.findAllMindMapsInProject(project, this);
                this.cache.put(projectFolder, result);
            }
            return result;
        }
    }
}
Also used : Scope(org.netbeans.modules.refactoring.api.Scope) NonRecursiveFolder(org.netbeans.api.fileinfo.NonRecursiveFolder) FileObject(org.openide.filesystems.FileObject)

Aggregations

NonRecursiveFolder (org.netbeans.api.fileinfo.NonRecursiveFolder)1 Scope (org.netbeans.modules.refactoring.api.Scope)1 FileObject (org.openide.filesystems.FileObject)1