Search in sources :

Example 11 with ModuleRootListener

use of com.intellij.openapi.roots.ModuleRootListener in project intellij-community by JetBrains.

the class VcsEventWatcher method projectOpened.

@Override
public void projectOpened() {
    MessageBusConnection connection = myProject.getMessageBus().connect(myProject);
    connection.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() {

        @Override
        public void rootsChanged(ModuleRootEvent event) {
            ApplicationManager.getApplication().invokeLater(() -> VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty(), ModalityState.NON_MODAL, myProject.getDisposed());
        }
    });
    WolfTheProblemSolver.getInstance(myProject).addProblemListener(new MyProblemListener(), myProject);
}
Also used : MessageBusConnection(com.intellij.util.messages.MessageBusConnection) ModuleRootEvent(com.intellij.openapi.roots.ModuleRootEvent) ModuleRootListener(com.intellij.openapi.roots.ModuleRootListener)

Example 12 with ModuleRootListener

use of com.intellij.openapi.roots.ModuleRootListener in project intellij-community by JetBrains.

the class DirectoryIndexImpl method subscribeToFileChanges.

protected void subscribeToFileChanges() {
    myConnection.subscribe(FileTypeManager.TOPIC, new FileTypeListener() {

        @Override
        public void fileTypesChanged(@NotNull FileTypeEvent event) {
            myRootIndex = null;
        }
    });
    myConnection.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() {

        @Override
        public void rootsChanged(ModuleRootEvent event) {
            myRootIndex = null;
        }
    });
    myConnection.subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener() {

        @Override
        public void after(@NotNull List<? extends VFileEvent> events) {
            RootIndex rootIndex = myRootIndex;
            if (rootIndex != null && rootIndex.resetOnEvents(events)) {
                myRootIndex = null;
            }
        }
    });
}
Also used : FileTypeListener(com.intellij.openapi.fileTypes.FileTypeListener) ModuleRootEvent(com.intellij.openapi.roots.ModuleRootEvent) BulkFileListener(com.intellij.openapi.vfs.newvfs.BulkFileListener) FileTypeEvent(com.intellij.openapi.fileTypes.FileTypeEvent) ModuleRootListener(com.intellij.openapi.roots.ModuleRootListener)

Example 13 with ModuleRootListener

use of com.intellij.openapi.roots.ModuleRootListener in project intellij-community by JetBrains.

the class MiscImportingTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    myProject.getMessageBus().connect().subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() {

        @Override
        public void beforeRootsChange(ModuleRootEvent event) {
            beforeRootsChangedCount++;
        }

        @Override
        public void rootsChanged(ModuleRootEvent event) {
            rootsChangedCount++;
        }
    });
}
Also used : ModuleRootEvent(com.intellij.openapi.roots.ModuleRootEvent) ModuleRootListener(com.intellij.openapi.roots.ModuleRootListener)

Aggregations

ModuleRootEvent (com.intellij.openapi.roots.ModuleRootEvent)13 ModuleRootListener (com.intellij.openapi.roots.ModuleRootListener)13 MessageBusConnection (com.intellij.util.messages.MessageBusConnection)7 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 BulkFileListener (com.intellij.openapi.vfs.newvfs.BulkFileListener)2 Update (com.intellij.util.ui.update.Update)2 StringRegistry (com.intellij.flex.uiDesigner.io.StringRegistry)1 SortResult (com.intellij.flex.uiDesigner.libraries.LibrarySorter.SortResult)1 ProjectComponentReferenceCounter (com.intellij.flex.uiDesigner.mxml.ProjectComponentReferenceCounter)1 Notification (com.intellij.notification.Notification)1 AccessToken (com.intellij.openapi.application.AccessToken)1 Document (com.intellij.openapi.editor.Document)1 DocumentAdapter (com.intellij.openapi.editor.event.DocumentAdapter)1 DocumentEvent (com.intellij.openapi.editor.event.DocumentEvent)1 FileDocumentManagerAdapter (com.intellij.openapi.fileEditor.FileDocumentManagerAdapter)1 FileEditorManager (com.intellij.openapi.fileEditor.FileEditorManager)1 FileEditorManagerListener (com.intellij.openapi.fileEditor.FileEditorManagerListener)1 FileTypeEvent (com.intellij.openapi.fileTypes.FileTypeEvent)1 FileTypeListener (com.intellij.openapi.fileTypes.FileTypeListener)1 Project (com.intellij.openapi.project.Project)1