Search in sources :

Example 6 with VirtualFilePointer

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

the class FileAssociationsManagerImpl method readExternal.

@SuppressWarnings({ "unchecked" })
public void readExternal(Element element) throws InvalidDataException {
    final List<Element> children = element.getChildren("file");
    for (Element child : children) {
        final String url = child.getAttributeValue("url");
        if (url != null) {
            final VirtualFilePointer pointer = myFilePointerManager.create(url, myProject, null);
            final VirtualFilePointerContainer container = myFilePointerManager.createContainer(myProject);
            container.readExternal(child, "association");
            myAssociations.put(pointer, container);
        }
    }
}
Also used : Element(org.jdom.Element) VirtualFilePointer(com.intellij.openapi.vfs.pointers.VirtualFilePointer) VirtualFilePointerContainer(com.intellij.openapi.vfs.pointers.VirtualFilePointerContainer)

Example 7 with VirtualFilePointer

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

the class VirtualFilePointerContainerImpl method writeExternal.

@Override
public void writeExternal(@NotNull final Element element, @NotNull final String childElementName) {
    for (VirtualFilePointer pointer : myList) {
        String url = pointer.getUrl();
        final Element rootPathElement = new Element(childElementName);
        rootPathElement.setAttribute(URL_ATTR, url);
        element.addContent(rootPathElement);
    }
}
Also used : Element(org.jdom.Element) VirtualFilePointer(com.intellij.openapi.vfs.pointers.VirtualFilePointer)

Example 8 with VirtualFilePointer

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

the class VirtualFilePointerContainerImpl method add.

@Override
public void add(@NotNull String url) {
    assert !myDisposed;
    dropCaches();
    final VirtualFilePointer pointer = create(url);
    myList.add(pointer);
}
Also used : VirtualFilePointer(com.intellij.openapi.vfs.pointers.VirtualFilePointer)

Example 9 with VirtualFilePointer

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

the class VirtualFilePointerContainerImpl method add.

@Override
public void add(@NotNull VirtualFile file) {
    assert !myDisposed;
    dropCaches();
    final VirtualFilePointer pointer = create(file);
    myList.add(pointer);
}
Also used : VirtualFilePointer(com.intellij.openapi.vfs.pointers.VirtualFilePointer)

Example 10 with VirtualFilePointer

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

the class CompilerModuleExtensionImpl method getOutputPathValue.

@Nullable
protected VirtualFilePointer getOutputPathValue(Element element, String tag, final boolean createPointer) {
    final Element outputPathChild = element.getChild(tag);
    VirtualFilePointer vptr = null;
    if (outputPathChild != null && createPointer) {
        String outputPath = outputPathChild.getAttributeValue(ATTRIBUTE_URL);
        vptr = createPointer(outputPath);
    }
    return vptr;
}
Also used : Element(org.jdom.Element) VirtualFilePointer(com.intellij.openapi.vfs.pointers.VirtualFilePointer) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

VirtualFilePointer (com.intellij.openapi.vfs.pointers.VirtualFilePointer)66 MockVirtualFile (com.intellij.mock.MockVirtualFile)23 File (java.io.File)22 VirtualFile (com.intellij.openapi.vfs.VirtualFile)12 NotNull (org.jetbrains.annotations.NotNull)12 VirtualFilePointerContainer (com.intellij.openapi.vfs.pointers.VirtualFilePointerContainer)11 IOException (java.io.IOException)8 Disposable (com.intellij.openapi.Disposable)7 VirtualFilePointerListener (com.intellij.openapi.vfs.pointers.VirtualFilePointerListener)6 ArrayList (java.util.ArrayList)5 Element (org.jdom.Element)5 Nullable (org.jetbrains.annotations.Nullable)4 Job (com.intellij.concurrency.Job)3 FileEditorProvider (com.intellij.openapi.fileEditor.FileEditorProvider)3 FileEditorState (com.intellij.openapi.fileEditor.FileEditorState)3 VirtualFilePointerManager (com.intellij.openapi.vfs.pointers.VirtualFilePointerManager)3 JobLauncher (com.intellij.concurrency.JobLauncher)2 ApplicationManager (com.intellij.openapi.application.ApplicationManager)2 PathManagerEx (com.intellij.openapi.application.ex.PathManagerEx)2 WriteCommandAction (com.intellij.openapi.command.WriteCommandAction)2