Search in sources :

Example 1 with ProjectRoot

use of com.intellij.openapi.projectRoots.ex.ProjectRoot in project intellij-community by JetBrains.

the class ProjectJdkImpl method getRoots.

@Override
public VirtualFile[] getRoots(OrderRootType rootType) {
    // use getRoots() cause the data is most up-to-date there
    final ProjectRoot[] roots = myRootContainer.getRoots(rootType);
    final List<VirtualFile> files = new ArrayList<>(roots.length);
    for (ProjectRoot root : roots) {
        ContainerUtil.addAll(files, root.getVirtualFiles());
    }
    return VfsUtilCore.toVirtualFileArray(files);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ProjectRoot(com.intellij.openapi.projectRoots.ex.ProjectRoot) ArrayList(java.util.ArrayList)

Example 2 with ProjectRoot

use of com.intellij.openapi.projectRoots.ex.ProjectRoot in project intellij-community by JetBrains.

the class ProjectJdkImpl method copyRoots.

static void copyRoots(@NotNull ProjectRootContainerImpl rootContainer, @NotNull ProjectJdkImpl dest) {
    dest.myRootContainer.startChange();
    dest.myRootContainer.removeAllRoots();
    for (OrderRootType rootType : OrderRootType.getAllTypes()) {
        final ProjectRoot[] newRoots = rootContainer.getRoots(rootType);
        for (ProjectRoot newRoot : newRoots) {
            dest.myRootContainer.addRoot(newRoot, rootType);
        }
    }
    dest.myRootContainer.finishChange();
}
Also used : OrderRootType(com.intellij.openapi.roots.OrderRootType) ProjectRoot(com.intellij.openapi.projectRoots.ex.ProjectRoot)

Aggregations

ProjectRoot (com.intellij.openapi.projectRoots.ex.ProjectRoot)2 OrderRootType (com.intellij.openapi.roots.OrderRootType)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 ArrayList (java.util.ArrayList)1