Search in sources :

Example 46 with MessageBusConnection

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

the class JavaFxHtmlPanel method subscribeForGrayscaleSetting.

private void subscribeForGrayscaleSetting() {
    MessageBusConnection settingsConnection = ApplicationManager.getApplication().getMessageBus().connect(this);
    MarkdownApplicationSettings.SettingsChangedListener settingsChangedListener = new MarkdownApplicationSettings.SettingsChangedListener() {

        @Override
        public void onSettingsChange(@NotNull final MarkdownApplicationSettings settings) {
            runInPlatformWhenAvailable(() -> {
                if (myWebView != null) {
                    updateFontSmoothingType(myWebView, settings.getMarkdownPreviewSettings().isUseGrayscaleRendering());
                }
            });
        }
    };
    settingsConnection.subscribe(MarkdownApplicationSettings.SettingsChangedListener.TOPIC, settingsChangedListener);
}
Also used : MessageBusConnection(com.intellij.util.messages.MessageBusConnection) MarkdownApplicationSettings(org.intellij.plugins.markdown.settings.MarkdownApplicationSettings) NotNull(org.jetbrains.annotations.NotNull)

Example 47 with MessageBusConnection

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

use of com.intellij.util.messages.MessageBusConnection 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 49 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 50 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)

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