Search in sources :

Example 1 with PersistentOrderRootType

use of com.intellij.openapi.roots.PersistentOrderRootType in project intellij-community by JetBrains.

the class LibraryRootsComponent method getNotExcludedRoots.

private Set<VirtualFile> getNotExcludedRoots() {
    Set<VirtualFile> roots = new LinkedHashSet<>();
    String[] excludedRootUrls = getLibraryEditor().getExcludedRootUrls();
    Set<VirtualFile> excludedRoots = new HashSet<>();
    for (String url : excludedRootUrls) {
        ContainerUtil.addIfNotNull(excludedRoots, VirtualFileManager.getInstance().findFileByUrl(url));
    }
    for (PersistentOrderRootType type : OrderRootType.getAllPersistentTypes()) {
        VirtualFile[] files = getLibraryEditor().getFiles(type);
        for (VirtualFile file : files) {
            if (!VfsUtilCore.isUnder(file, excludedRoots)) {
                roots.add(PathUtil.getLocalFile(file));
            }
        }
    }
    return roots;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) PersistentOrderRootType(com.intellij.openapi.roots.PersistentOrderRootType) HashSet(com.intellij.util.containers.HashSet)

Example 2 with PersistentOrderRootType

use of com.intellij.openapi.roots.PersistentOrderRootType in project intellij-community by JetBrains.

the class ProjectRootContainerImpl method readOldVersion.

@SuppressWarnings({ "HardCodedStringLiteral" })
void readOldVersion(Element child) {
    for (Element root : child.getChildren("root")) {
        String url = root.getAttributeValue("file");
        SimpleProjectRoot projectRoot = new SimpleProjectRoot(url);
        String type = root.getChild("property").getAttributeValue("value");
        for (PersistentOrderRootType rootType : OrderRootType.getAllPersistentTypes()) {
            if (type.equals(rootType.getOldSdkRootName())) {
                addRoot(projectRoot, rootType);
                break;
            }
        }
    }
    myFiles = new HashMap<>();
    for (OrderRootType rootType : myRoots.keySet()) {
        myFiles.put(rootType, myRoots.get(rootType).getVirtualFiles());
    }
    for (OrderRootType type : OrderRootType.getAllTypes()) {
        final VirtualFile[] oldRoots = VirtualFile.EMPTY_ARRAY;
        final VirtualFile[] newRoots = getRootFiles(type);
        if (!Comparing.equal(oldRoots, newRoots)) {
            fireRootsChanged();
            break;
        }
    }
}
Also used : PersistentOrderRootType(com.intellij.openapi.roots.PersistentOrderRootType) OrderRootType(com.intellij.openapi.roots.OrderRootType) PersistentOrderRootType(com.intellij.openapi.roots.PersistentOrderRootType) Element(org.jdom.Element)

Example 3 with PersistentOrderRootType

use of com.intellij.openapi.roots.PersistentOrderRootType in project intellij-community by JetBrains.

the class ProjectRootContainerImpl method readExternal.

@Override
public void readExternal(Element element) {
    for (PersistentOrderRootType type : OrderRootType.getAllPersistentTypes()) {
        read(element, type);
    }
    ApplicationManager.getApplication().runReadAction(() -> {
        myFiles = new HashMap<>();
        for (OrderRootType rootType : myRoots.keySet()) {
            CompositeProjectRoot root = myRoots.get(rootType);
            if (myNoCopyJars) {
                setNoCopyJars(root);
            }
            myFiles.put(rootType, root.getVirtualFiles());
        }
    });
    for (OrderRootType type : OrderRootType.getAllTypes()) {
        final VirtualFile[] newRoots = getRootFiles(type);
        final VirtualFile[] oldRoots = VirtualFile.EMPTY_ARRAY;
        if (!Comparing.equal(oldRoots, newRoots)) {
            fireRootsChanged();
            break;
        }
    }
}
Also used : PersistentOrderRootType(com.intellij.openapi.roots.PersistentOrderRootType) OrderRootType(com.intellij.openapi.roots.OrderRootType) PersistentOrderRootType(com.intellij.openapi.roots.PersistentOrderRootType)

Aggregations

PersistentOrderRootType (com.intellij.openapi.roots.PersistentOrderRootType)3 OrderRootType (com.intellij.openapi.roots.OrderRootType)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 HashSet (com.intellij.util.containers.HashSet)1 Element (org.jdom.Element)1