Search in sources :

Example 6 with VirtualFilePointerListener

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

the class MavenProjectsManagerWatcher method addFilePointer.

private void addFilePointer(File... settingsFiles) {
    Collection<String> pathsToWatch = new ArrayList<>(settingsFiles.length);
    for (File settingsFile : settingsFiles) {
        if (settingsFile == null)
            continue;
        File parentFile = settingsFile.getParentFile();
        if (parentFile != null) {
            String path = getNormalizedPath(parentFile);
            if (path != null) {
                pathsToWatch.add(path);
            }
        }
        String path = getNormalizedPath(settingsFile);
        if (path != null) {
            String url = VfsUtilCore.pathToUrl(path);
            mySettingsFilesPointers.add(VirtualFilePointerManager.getInstance().create(url, myChangedDocumentsQueue, new VirtualFilePointerListener() {
            }));
        }
    }
    myWatchedRoots.addAll(LocalFileSystem.getInstance().addRootsToWatch(pathsToWatch, false));
}
Also used : VirtualFilePointerListener(com.intellij.openapi.vfs.pointers.VirtualFilePointerListener) XmlFile(com.intellij.psi.xml.XmlFile) VirtualFile(com.intellij.openapi.vfs.VirtualFile) PsiFile(com.intellij.psi.PsiFile) File(java.io.File)

Aggregations

VirtualFilePointerListener (com.intellij.openapi.vfs.pointers.VirtualFilePointerListener)6 VirtualFilePointer (com.intellij.openapi.vfs.pointers.VirtualFilePointer)5 File (java.io.File)5 MockVirtualFile (com.intellij.mock.MockVirtualFile)4 NotNull (org.jetbrains.annotations.NotNull)3 Disposable (com.intellij.openapi.Disposable)2 Job (com.intellij.concurrency.Job)1 JobLauncher (com.intellij.concurrency.JobLauncher)1 ApplicationManager (com.intellij.openapi.application.ApplicationManager)1 PathManagerEx (com.intellij.openapi.application.ex.PathManagerEx)1 WriteCommandAction (com.intellij.openapi.command.WriteCommandAction)1 ModuleRootManager (com.intellij.openapi.roots.ModuleRootManager)1 OrderRootType (com.intellij.openapi.roots.OrderRootType)1 ProjectRootManager (com.intellij.openapi.roots.ProjectRootManager)1 OrderEntryUtil (com.intellij.openapi.roots.impl.OrderEntryUtil)1 Library (com.intellij.openapi.roots.libraries.Library)1 LibraryTable (com.intellij.openapi.roots.libraries.LibraryTable)1 LibraryUtil (com.intellij.openapi.roots.libraries.LibraryUtil)1 Computable (com.intellij.openapi.util.Computable)1 Disposer (com.intellij.openapi.util.Disposer)1