Search in sources :

Example 1 with VirtualFileListener

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

the class NewVirtualFileSystem method addVirtualFileListener.

@Override
public void addVirtualFileListener(@NotNull final VirtualFileListener listener) {
    VirtualFileListener wrapper = new VirtualFileFilteringListener(listener, this);
    VirtualFileManager.getInstance().addVirtualFileListener(wrapper);
    myListenerWrappers.put(listener, wrapper);
}
Also used : VirtualFileListener(com.intellij.openapi.vfs.VirtualFileListener)

Example 2 with VirtualFileListener

use of com.intellij.openapi.vfs.VirtualFileListener in project intellij-plugins by JetBrains.

the class PhoneGapStartupActivity method runActivity.

@Override
public void runActivity(@NotNull Project project) {
    StartupManager.getInstance(project).runWhenProjectIsInitialized(() -> {
        if (PhoneGapUtil.isPhoneGapProject(project)) {
            if (PhoneGapSettings.getInstance().isExcludePlatformFolder()) {
                excludeWorkingDirectories(project);
            }
            PhoneGapExecutableChecker.check(project);
        }
    });
    VirtualFileManager.getInstance().addVirtualFileListener(new VirtualFileListener() {

        @Override
        public void fileCreated(@NotNull VirtualFileEvent event) {
            if (!isProcess(event)) {
                return;
            }
            updateModuleExcludeByFSEvent(project, event, ContainerUtil.newHashSet(), ContainerUtil.newHashSet(getExcludedFolderNames(event)));
        }

        @Override
        public void beforeFileDeletion(@NotNull VirtualFileEvent event) {
            if (!isProcess(event)) {
                return;
            }
            updateModuleExcludeByFSEvent(project, event, getExcludedFolderNames(event), ContainerUtil.newHashSet());
        }

        private boolean isProcess(@NotNull VirtualFileEvent event) {
            return shouldExcludeDirectory(event) && PhoneGapUtil.isPhoneGapProject(project) && PhoneGapSettings.getInstance().isExcludePlatformFolder();
        }
    }, project);
}
Also used : VirtualFileListener(com.intellij.openapi.vfs.VirtualFileListener) VirtualFileEvent(com.intellij.openapi.vfs.VirtualFileEvent)

Aggregations

VirtualFileListener (com.intellij.openapi.vfs.VirtualFileListener)2 VirtualFileEvent (com.intellij.openapi.vfs.VirtualFileEvent)1