Search in sources :

Example 51 with MessageBusConnection

use of com.intellij.util.messages.MessageBusConnection 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 52 with MessageBusConnection

use of com.intellij.util.messages.MessageBusConnection in project intellij-community by JetBrains.

the class CompilerManagerImpl method addCompilationStatusListener.

public void addCompilationStatusListener(@NotNull final CompilationStatusListener listener) {
    final MessageBusConnection connection = myProject.getMessageBus().connect();
    myListenerAdapters.put(listener, connection);
    connection.subscribe(CompilerTopics.COMPILATION_STATUS, listener);
}
Also used : MessageBusConnection(com.intellij.util.messages.MessageBusConnection)

Example 53 with MessageBusConnection

use of com.intellij.util.messages.MessageBusConnection in project android by JetBrains.

the class AndroidStudioUsageTracker method subscribeToEvents.

private static void subscribeToEvents() {
    Application app = ApplicationManager.getApplication();
    MessageBusConnection connection = app.getMessageBus().connect();
    connection.subscribe(ProjectLifecycleListener.TOPIC, new ProjectLifecycleTracker());
}
Also used : MessageBusConnection(com.intellij.util.messages.MessageBusConnection) Application(com.intellij.openapi.application.Application)

Example 54 with MessageBusConnection

use of com.intellij.util.messages.MessageBusConnection in project android by JetBrains.

the class GradleSpecificInitializer method registerAppClosing.

// Registers a callback that gets notified when the IDE is closing.
private static void registerAppClosing() {
    Application app = ApplicationManager.getApplication();
    MessageBusConnection connection = app.getMessageBus().connect(app);
    connection.subscribe(AppLifecycleListener.TOPIC, new AppLifecycleListener() {

        @Override
        public void appClosing() {
            try {
                DefaultGradleConnector.close();
            } catch (RuntimeException e) {
                LOG.info("Failed to stop Gradle daemons during IDE shutdown", e);
            }
        }
    });
}
Also used : MessageBusConnection(com.intellij.util.messages.MessageBusConnection) AppLifecycleListener(com.intellij.ide.AppLifecycleListener) Application(com.intellij.openapi.application.Application)

Example 55 with MessageBusConnection

use of com.intellij.util.messages.MessageBusConnection in project android by JetBrains.

the class NdkFacet method initFacet.

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

        @Override
        public void rootsChanged(ModuleRootEvent event) {
            ApplicationManager.getApplication().invokeLater(() -> {
                if (!isDisposed()) {
                    PsiDocumentManager.getInstance(getModule().getProject()).commitAllDocuments();
                    updateConfiguration();
                }
            });
        }
    });
    updateConfiguration();
}
Also used : MessageBusConnection(com.intellij.util.messages.MessageBusConnection) ModuleRootEvent(com.intellij.openapi.roots.ModuleRootEvent) ModuleRootListener(com.intellij.openapi.roots.ModuleRootListener)

Aggregations

MessageBusConnection (com.intellij.util.messages.MessageBusConnection)81 Project (com.intellij.openapi.project.Project)16 NotNull (org.jetbrains.annotations.NotNull)15 Module (com.intellij.openapi.module.Module)11 ModuleRootEvent (com.intellij.openapi.roots.ModuleRootEvent)10 ModuleListener (com.intellij.openapi.project.ModuleListener)8 ModuleRootListener (com.intellij.openapi.roots.ModuleRootListener)8 VirtualFile (com.intellij.openapi.vfs.VirtualFile)7 Disposable (com.intellij.openapi.Disposable)6 Document (com.intellij.openapi.editor.Document)6 VFileEvent (com.intellij.openapi.vfs.newvfs.events.VFileEvent)5 Update (com.intellij.util.ui.update.Update)5 ApplicationManager (com.intellij.openapi.application.ApplicationManager)4 StringUtil (com.intellij.openapi.util.text.StringUtil)4 ProcessHandler (com.intellij.execution.process.ProcessHandler)3 Application (com.intellij.openapi.application.Application)3 FileDocumentManagerAdapter (com.intellij.openapi.fileEditor.FileDocumentManagerAdapter)3 ModuleRootAdapter (com.intellij.openapi.roots.ModuleRootAdapter)3 VFileCreateEvent (com.intellij.openapi.vfs.newvfs.events.VFileCreateEvent)3 File (java.io.File)3