Search in sources :

Example 6 with ModuleRootEvent

use of com.intellij.openapi.roots.ModuleRootEvent in project intellij-plugins by JetBrains.

the class DartServerRootsHandler method ensureProjectServed.

public void ensureProjectServed() {
    assert (myIncludedRoots.isEmpty());
    assert (myExcludedRoots.isEmpty());
    ProgressManager.getInstance().executeNonCancelableSection(() -> {
        updateRoots();
        final DartAnalysisServerService das = DartAnalysisServerService.getInstance(myProject);
        das.updateCurrentFile();
        das.updateVisibleFiles();
    });
    myProject.getMessageBus().connect().subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() {

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

Example 7 with ModuleRootEvent

use of com.intellij.openapi.roots.ModuleRootEvent in project intellij-leiningen-plugin by derkork.

the class LeiningenProjectsManagerWatcher method start.

public synchronized void start() {
    final MessageBusConnection myBusConnection = project.getMessageBus().connect(myQueue);
    myBusConnection.subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener() {

        public void before(List<? extends VFileEvent> vFileEvents) {
        }

        public void after(List<? extends VFileEvent> vFileEvents) {
            for (VFileEvent vFileEvent : vFileEvents) {
                //                    }
                if (vFileEvent instanceof VFileCreateEvent) {
                    if (isRelevant(vFileEvent.getPath())) {
                        manager.importLeiningenProject(vFileEvent.getFileSystem().findFileByPath(vFileEvent.getPath()), project);
                    }
                }
            }
        }

        private boolean isRelevant(String path) {
            return path != null && path.endsWith(LeiningenConstants.PROJECT_CLJ);
        }
    });
    myBusConnection.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() {

        public void beforeRootsChange(ModuleRootEvent moduleRootEvent) {
        }

        public void rootsChanged(ModuleRootEvent moduleRootEvent) {
        }
    });
    myQueue.activate();
}
Also used : MessageBusConnection(com.intellij.util.messages.MessageBusConnection) VFileEvent(com.intellij.openapi.vfs.newvfs.events.VFileEvent) BulkFileListener(com.intellij.openapi.vfs.newvfs.BulkFileListener) ModuleRootEvent(com.intellij.openapi.roots.ModuleRootEvent) VFileCreateEvent(com.intellij.openapi.vfs.newvfs.events.VFileCreateEvent) ModuleRootListener(com.intellij.openapi.roots.ModuleRootListener)

Example 8 with ModuleRootEvent

use of com.intellij.openapi.roots.ModuleRootEvent in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoVendoringUI method initPanel.

public void initPanel(@NotNull Module module) {
    if (!module.isDisposed()) {
        MessageBusConnection connection = module.getMessageBus().connect(this);
        //noinspection unchecked
        myVendoringEnabledCombo.setModel(myVendoringEnabledComboModel);
        connection.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {

            @Override
            public void rootsChanged(ModuleRootEvent event) {
                initComboValues(module);
            }
        });
        initComboValues(module);
    }
}
Also used : MessageBusConnection(com.intellij.util.messages.MessageBusConnection) ModuleRootAdapter(com.intellij.openapi.roots.ModuleRootAdapter) ModuleRootEvent(com.intellij.openapi.roots.ModuleRootEvent)

Example 9 with ModuleRootEvent

use of com.intellij.openapi.roots.ModuleRootEvent in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoBuildTagsUI method initPanel.

public void initPanel(@NotNull Module module) {
    if (!module.isDisposed()) {
        MessageBusConnection connection = module.getMessageBus().connect(this);
        connection.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {

            @Override
            public void rootsChanged(ModuleRootEvent event) {
                initComboValues(module);
            }
        });
        initComboValues(module);
    }
}
Also used : MessageBusConnection(com.intellij.util.messages.MessageBusConnection) ModuleRootAdapter(com.intellij.openapi.roots.ModuleRootAdapter) ModuleRootEvent(com.intellij.openapi.roots.ModuleRootEvent)

Example 10 with ModuleRootEvent

use of com.intellij.openapi.roots.ModuleRootEvent 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)

Aggregations

ModuleRootEvent (com.intellij.openapi.roots.ModuleRootEvent)16 ModuleRootListener (com.intellij.openapi.roots.ModuleRootListener)13 MessageBusConnection (com.intellij.util.messages.MessageBusConnection)10 ModuleRootAdapter (com.intellij.openapi.roots.ModuleRootAdapter)3 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