Search in sources :

Example 16 with VirtualFilePointerContainer

use of com.intellij.openapi.vfs.pointers.VirtualFilePointerContainer in project intellij-community by JetBrains.

the class DetectionExcludesConfigurationImpl method addExcludedFile.

@Override
public void addExcludedFile(@NotNull VirtualFile file, @Nullable FrameworkType type) {
    convert();
    final String typeId = type != null ? type.getId() : null;
    if (typeId != null && myExcludedFrameworks.contains(typeId) || isFileExcluded(file, typeId)) {
        return;
    }
    final VirtualFilePointerContainer container = myExcludedFiles.get(typeId);
    if (typeId == null) {
        for (VirtualFilePointerContainer pointerContainer : myExcludedFiles.values()) {
            removeDescendants(file, pointerContainer);
        }
    } else {
        removeDescendants(file, container);
    }
    container.add(file);
}
Also used : VirtualFilePointerContainer(com.intellij.openapi.vfs.pointers.VirtualFilePointerContainer)

Example 17 with VirtualFilePointerContainer

use of com.intellij.openapi.vfs.pointers.VirtualFilePointerContainer in project intellij-community by JetBrains.

the class DetectionExcludesConfigurationImpl method doLoadState.

private void doLoadState(@Nullable ExcludesConfigurationState state) {
    myExcludedFrameworks.clear();
    for (VirtualFilePointerContainer container : myExcludedFiles.values()) {
        container.clear();
    }
    myDetectionEnabled = state == null || state.isDetectionEnabled();
    if (state != null) {
        myExcludedFrameworks.addAll(state.getFrameworkTypes());
        for (ExcludedFileState fileState : state.getFiles()) {
            myExcludedFiles.get(fileState.getFrameworkType()).add(fileState.getUrl());
        }
    }
}
Also used : VirtualFilePointerContainer(com.intellij.openapi.vfs.pointers.VirtualFilePointerContainer)

Example 18 with VirtualFilePointerContainer

use of com.intellij.openapi.vfs.pointers.VirtualFilePointerContainer in project intellij-community by JetBrains.

the class JavaModuleExternalPathsImpl method setRootUrls.

private void setRootUrls(final OrderRootType orderRootType, @NotNull final String[] urls) {
    VirtualFilePointerContainer container = myOrderRootPointerContainers.get(orderRootType);
    if (container == null) {
        if (urls.length == 0) {
            // (that in turn can mask issues like https://youtrack.jetbrains.com/issue/IDEA-166461)
            return;
        }
        container = VirtualFilePointerManager.getInstance().createContainer(this, null);
        myOrderRootPointerContainers.put(orderRootType, container);
    } else {
        container.clear();
    }
    for (final String url : urls) {
        container.add(url);
    }
}
Also used : VirtualFilePointerContainer(com.intellij.openapi.vfs.pointers.VirtualFilePointerContainer)

Example 19 with VirtualFilePointerContainer

use of com.intellij.openapi.vfs.pointers.VirtualFilePointerContainer in project intellij-community by JetBrains.

the class JavaModuleExternalPathsImpl method readExternal.

@Override
public void readExternal(@NotNull Element element) throws InvalidDataException {
    for (PersistentOrderRootType orderRootType : OrderRootType.getAllPersistentTypes()) {
        String paths = orderRootType.getModulePathsName();
        if (paths != null) {
            final Element pathsElement = element.getChild(paths);
            if (pathsElement != null) {
                VirtualFilePointerContainer container = VirtualFilePointerManager.getInstance().createContainer(this, null);
                myOrderRootPointerContainers.put(orderRootType, container);
                container.readExternal(pathsElement, ROOT_ELEMENT);
            }
        }
    }
}
Also used : Element(org.jdom.Element) VirtualFilePointerContainer(com.intellij.openapi.vfs.pointers.VirtualFilePointerContainer)

Example 20 with VirtualFilePointerContainer

use of com.intellij.openapi.vfs.pointers.VirtualFilePointerContainer in project intellij-community by JetBrains.

the class JavaModuleExternalPathsImpl method writeExternal.

@Override
public void writeExternal(@NotNull Element element) throws WriteExternalException {
    for (OrderRootType orderRootType : myOrderRootPointerContainers.keySet()) {
        VirtualFilePointerContainer container = myOrderRootPointerContainers.get(orderRootType);
        if (container != null && container.size() > 0) {
            final Element javaDocPaths = new Element(((PersistentOrderRootType) orderRootType).getModulePathsName());
            container.writeExternal(javaDocPaths, ROOT_ELEMENT);
            element.addContent(javaDocPaths);
        }
    }
}
Also used : Element(org.jdom.Element) VirtualFilePointerContainer(com.intellij.openapi.vfs.pointers.VirtualFilePointerContainer)

Aggregations

VirtualFilePointerContainer (com.intellij.openapi.vfs.pointers.VirtualFilePointerContainer)33 VirtualFilePointer (com.intellij.openapi.vfs.pointers.VirtualFilePointer)11 Element (org.jdom.Element)6 VirtualFile (com.intellij.openapi.vfs.VirtualFile)5 OrderRootType (com.intellij.openapi.roots.OrderRootType)4 NotNull (org.jetbrains.annotations.NotNull)4 HashMap (com.intellij.util.containers.HashMap)2 PsiFile (com.intellij.psi.PsiFile)1 PsiManager (com.intellij.psi.PsiManager)1 SmartList (com.intellij.util.SmartList)1 THashSet (gnu.trove.THashSet)1 JpsLibraryRoot (org.jetbrains.jps.model.library.JpsLibraryRoot)1