Package com.intellij.util.messages

Examples of com.intellij.util.messages.MessageBusConnection


            !processIcon.isDisposed());
      }
    }
    );

    final MessageBusConnection messageBusConnection = project.getMessageBus().connect(usageView);
    messageBusConnection.subscribe(UsageFilteringRuleProvider.RULES_CHANGED, new Runnable() {
      @Override
      public void run() {
        pingEDT.ping();
      }
    });
View Full Code Here


        rebuildPopup(usageView, copy, nodes, table, popup, presentation, popupPosition, !processIcon.isDisposed());
      }
    });

    final MessageBusConnection messageBusConnection = project.getMessageBus().connect(usageView);
    messageBusConnection.subscribe(UsageFilteringRuleProvider.RULES_CHANGED, new Runnable() {
      @Override
      public void run() {
        pingEDT.ping();
      }
    });
View Full Code Here

        return ApplicationManager.getApplication().getComponent(EventManager.class);
    }

    private static MessageBusConnection connect(Object handler) {
        EventManager eventManager = EventManager.getInstance();
        MessageBusConnection connection = eventManager.connectionCache.get(handler);
        if (connection == null) {
            MessageBus messageBus = ApplicationManager.getApplication().getMessageBus();
            connection = messageBus.connect();
            eventManager.connectionCache.put(handler, connection);
        }
View Full Code Here

    }


    private static MessageBusConnection connect(Project project, Object handler) {
        EventManager eventManager = EventManager.getInstance();
        MessageBusConnection connection = eventManager.connectionCache.get(handler);
        if (connection == null) {
            MessageBus messageBus = project.getMessageBus();
            connection = messageBus.connect();
            eventManager.connectionCache.put(handler, connection);
        }
View Full Code Here

        }
        return connection;
    }
   
    public static <T> void subscribe(Project project, Topic<T> topic, T handler) {
        MessageBusConnection messageBusConnection = connect(project, handler);
        messageBusConnection.subscribe(topic, handler);
    }
View Full Code Here

        MessageBusConnection messageBusConnection = connect(project, handler);
        messageBusConnection.subscribe(topic, handler);
    }

    public static <T> void subscribe(Topic<T> topic, T handler) {
        MessageBusConnection messageBusConnection = connect(handler);
        messageBusConnection.subscribe(topic, handler);
    }
View Full Code Here

    }

    public static void unsubscribe(Object ... handlers) {
        EventManager eventManager = EventManager.getInstance();
        for (Object handler : handlers) {
            MessageBusConnection connection = eventManager.connectionCache.remove(handler);
            if (connection != null) {
                connection.disconnect();
            }
        }
    }
View Full Code Here

        }
      }
    });

    // clear caches after modules roots were changed
    final MessageBusConnection connection = project.getMessageBus().connect();
    connection.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() {
      final List<VirtualFile> myPreviousStepDefsProviders = new ArrayList<VirtualFile>();

      public void beforeRootsChange(ModuleRootEvent event) {
        myPreviousStepDefsProviders.clear();
View Full Code Here

    return "OsmorcProjectComponent";
  }

  @Override
  public void initComponent() {
    MessageBusConnection appBus = myApplication.getMessageBus().connect(myProject);
    appBus.subscribe(FrameworkDefinitionListener.TOPIC, new MyFrameworkDefinitionListener());

    myProjectSettings.addProjectSettingsListener(this);

    MessageBusConnection projectBus = myProject.getMessageBus().connect(myProject);
    projectBus.subscribe(ProjectTopics.PROJECT_ROOTS, new MyModuleRootListener());
    projectBus.subscribe(ProjectTopics.MODULES, new MyModuleRenameHandler());
  }
View Full Code Here

    }

    public OpenEditorTracker startTracking() {
      ProjectManager.getInstance().addProjectManagerListener(new ProjectManagerAdapter() {
        @Override public void projectOpened(final Project project) {
                    MessageBusConnection connection = project.getMessageBus().connect();
                    connection.subscribe(FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() {
                        @Override
                        public void selectionChanged(@NotNull FileEditorManagerEvent event) {
                            VirtualFile virtualFile = event.getNewFile();
                            if (virtualFile == null) return;

                            if (fileSystem.isScratch(virtualFile)) {
                                allowAccessToNonProjectFile_HACK(virtualFile, project);
                                mrScratchManager.userOpenedScratch(virtualFile.getName());
                            }
                        }
                    });
                    connectionsByProject.put(project, connection);
                }

        @Override public void projectClosed(Project project) {
          MessageBusConnection connection = connectionsByProject.remove(project);
          if (connection != null) connection.disconnect();
        }
      });
      return this;
    }
View Full Code Here

TOP

Related Classes of com.intellij.util.messages.MessageBusConnection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.