当前位置: 首页>>代码示例>>Java>>正文


Java MessageBus.connect方法代码示例

本文整理汇总了Java中com.intellij.util.messages.MessageBus.connect方法的典型用法代码示例。如果您正苦于以下问题:Java MessageBus.connect方法的具体用法?Java MessageBus.connect怎么用?Java MessageBus.connect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.util.messages.MessageBus的用法示例。


在下文中一共展示了MessageBus.connect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createToolWindowContent

import com.intellij.util.messages.MessageBus; //导入方法依赖的package包/类
@Override
public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
    ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
    Set<SelectedExchangeCurrencyPair> selectedExchangeCurrencyPairs = IdeaCurrencyConfig.getInstance().getSelectedExchangeCurrencyPairs();
    if (IdeaCurrencyConfig.getInstance().getActive()) {
        List<TickerDto> data = IdeaCurrencyApp.getInstance().getTickers(selectedExchangeCurrencyPairs);
        fillData(data);
    }
    Content content = contentFactory.createContent(contentPane, "", false);
    toolWindow.getContentManager().addContent(content);

    MessageBus messageBus = project.getMessageBus();
    messageBusConnection = messageBus.connect();
    messageBusConnection.subscribe(ConfigChangeNotifier.CONFIG_TOPIC, active -> {
        if (active) {
            scheduleNextTask();
        }
    });
}
 
开发者ID:semihunaldi,项目名称:IdeaCurrency,代码行数:20,代码来源:IdeaCurrencyToolWindow.java

示例2: initComponent

import com.intellij.util.messages.MessageBus; //导入方法依赖的package包/类
@Override
public void initComponent() {
    MessageBus bus = ApplicationManager.getApplication().getMessageBus();
    connection = bus.connect();

    ProjectManager.getInstance().addProjectManagerListener(new ProjectManagerListener() {
        @Override
        public void projectOpened(Project project) {
            Config config = Config.getInstance(project);

            if(config == null) {
                return;
            }

            if(!config.isConfigFilled()) {
                Notifications.Bus.notify(
                        new Notification("Settings Error", "Gherkin TS Runner", "Settings have to be filled.", NotificationType.WARNING)
                );
                return;
            }

            connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new GherkinFileEditorManagerListener(project));
        }
    });

}
 
开发者ID:KariiO,项目名称:Gherkin-TS-Runner,代码行数:27,代码来源:MainComponent.java

示例3: ScratchFileServiceImpl

import com.intellij.util.messages.MessageBus; //导入方法依赖的package包/类
protected ScratchFileServiceImpl(MessageBus messageBus) {
  myIndex = new LightDirectoryIndex<RootType>(messageBus.connect(), NULL_TYPE) {

    @Override
    protected void collectRoots(@NotNull PairConsumer<VirtualFile, RootType> consumer) {
      LocalFileSystem fileSystem = LocalFileSystem.getInstance();
      for (RootType r : RootType.getAllRootIds()) {
        String root = getRootPath(r);
        VirtualFile rootFile = fileSystem.findFileByPath(root);
        if (rootFile != null) {
          consumer.consume(rootFile, r);
        }
      }
    }
  };
  initFileOpenedListener(messageBus);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ScratchFileServiceImpl.java

示例4: upgradeIfNeeded

import com.intellij.util.messages.MessageBus; //导入方法依赖的package包/类
private void upgradeIfNeeded(final MessageBus bus) {
  final MessageBusConnection connection = bus.connect();
  connection.subscribe(ChangeListManagerImpl.LISTS_LOADED, new LocalChangeListsLoadedListener() {
    @Override
    public void processLoadedLists(final List<LocalChangeList> lists) {
      if (lists.isEmpty()) return;
      try {
        ChangeListManager.getInstance(myProject).setReadOnly(SvnChangeProvider.ourDefaultListName, true);

        if (!myConfiguration.changeListsSynchronized()) {
          processChangeLists(lists);
        }
      }
      catch (ProcessCanceledException e) {
        //
      }
      finally {
        myConfiguration.upgrade();
      }

      connection.disconnect();
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:SvnVcs.java

示例5: IntelliJListener

import com.intellij.util.messages.MessageBus; //导入方法依赖的package包/类
/** Constructor. */
public IntelliJListener(TrackingEventManager trackingEventManager, Project project) {
    this.trackingEventManager = trackingEventManager;
    this.project = project;

    parent = new Disposable() {
        @Override
        public void dispose() {
            // intentionally left empty
        }
    };

    editorWindowListener = new EditorWindowListener(project.getName());

    final MessageBus messageBus = ApplicationManager.getApplication().getMessageBus();
    connection = messageBus.connect();
}
 
开发者ID:TestRoots,项目名称:watchdog,代码行数:18,代码来源:IntelliJListener.java

示例6: addRequest

import com.intellij.util.messages.MessageBus; //导入方法依赖的package包/类
public void addRequest(@Nonnull final Runnable request, final int delay, boolean runWithActiveFrameOnly) {
  if (runWithActiveFrameOnly && !ApplicationManager.getApplication().isActive()) {
    final MessageBus bus = ApplicationManager.getApplication().getMessageBus();
    final MessageBusConnection connection = bus.connect(this);
    connection.subscribe(ApplicationActivationListener.TOPIC, new ApplicationActivationListener() {
      @Override
      public void applicationActivated(IdeFrame ideFrame) {
        connection.disconnect();
        addRequest(request, delay);
      }
    });
  }
  else {
    addRequest(request, delay);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:Alarm.java

示例7: EditorFactoryImpl

import com.intellij.util.messages.MessageBus; //导入方法依赖的package包/类
public EditorFactoryImpl(EditorActionManager editorActionManager) {
  Application application = ApplicationManager.getApplication();
  MessageBus bus = application.getMessageBus();
  MessageBusConnection connect = bus.connect();
  connect.subscribe(ProjectLifecycleListener.TOPIC, new ProjectLifecycleListener() {
    @Override
    public void beforeProjectLoaded(@Nonnull final Project project) {
      // validate all editors are disposed after fireProjectClosed() was called, because it's the place where editor should be released
      Disposer.register(project, () -> {
        final Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
        final boolean isLastProjectClosed = openProjects.length == 0;
        validateEditorsAreReleased(project, isLastProjectClosed);
      });
    }
  });

  ApplicationManager.getApplication().getMessageBus().connect().subscribe(EditorColorsManager.TOPIC, new EditorColorsListener() {
    @Override
    public void globalSchemeChange(EditorColorsScheme scheme) {
      refreshAllEditors();
    }
  });
  TypedAction typedAction = editorActionManager.getTypedAction();
  TypedActionHandler originalHandler = typedAction.getRawHandler();
  typedAction.setupRawHandler(new MyTypedHandler(originalHandler));
}
 
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:EditorFactoryImpl.java

示例8: triggerConfigChange

import com.intellij.util.messages.MessageBus; //导入方法依赖的package包/类
private void triggerConfigChange() {
    DataContext dataContext = DataManager.getInstance().getDataContextFromFocus().getResult();
    Project project = DataKeys.PROJECT.getData(dataContext);
    if (project != null) {
        MessageBus messageBus = project.getMessageBus();
        messageBus.connect();
        ConfigChangeNotifier configChangeNotifier = messageBus.syncPublisher(ConfigChangeNotifier.CONFIG_TOPIC);
        configChangeNotifier.configChanged(activeCheckBox.isSelected());
    }
}
 
开发者ID:semihunaldi,项目名称:IdeaCurrency,代码行数:11,代码来源:IdeaCurrencyConfigUI.java

示例9: initComponent

import com.intellij.util.messages.MessageBus; //导入方法依赖的package包/类
@Override
public void initComponent() {
    logger.debug("Initializing component");
    MessageBus bus = ApplicationManager.getApplication().getMessageBus();
    connection = bus.connect();
    connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new TabHighlighterFileEditorListener());
}
 
开发者ID:tobszarny,项目名称:ActiveTabHighlighterPlugin,代码行数:8,代码来源:ActiveTabsHighlighterComponent.java

示例10: initComponent

import com.intellij.util.messages.MessageBus; //导入方法依赖的package包/类
public void initComponent() {
    LOGGER.debug("phpfmt welcome!", String.format("Debug mode is: %s", settings.isDebug()? "On": "Off"));
    toEventLog(settings.isDebug(), "phpfmt updating phpfmt...", String.format("engine: %s, version: %s.", settings.getEngineChannel(), settings.getEngineVersion()));
    selfUpdate();
    final MessageBus bus = ApplicationManager.getApplication().getMessageBus();
    final MessageBusConnection connection = bus.connect();
    connection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileListener());
}
 
开发者ID:Shaked,项目名称:phpstorm-phpfmt,代码行数:9,代码来源:Component.java

示例11: ConnectionStatusController

import com.intellij.util.messages.MessageBus; //导入方法依赖的package包/类
public ConnectionStatusController(IFrame frame, MessageBus messageBus) {
    this.frame = frame;

    projectConnection = messageBus.connect(this);
    projectConnection.subscribe(IdeaConnectionService.ConnectionStatusListener.TOPIC, this);

    // initialize the error bars if necessary
    IdeaConnectionService connectionService = IdeaSamebugPlugin.getInstance().clientService.getConnectionService();
    if (!connectionService.isConnected()) connectionChange(false);
    else if (!connectionService.isAuthenticated()) authenticationChange(false);
}
 
开发者ID:samebug,项目名称:samebug-idea-plugin,代码行数:12,代码来源:ConnectionStatusController.java

示例12: addRequest

import com.intellij.util.messages.MessageBus; //导入方法依赖的package包/类
public void addRequest(@NotNull final Runnable request, final int delay, boolean runWithActiveFrameOnly) {
  if (runWithActiveFrameOnly && !ApplicationManager.getApplication().isActive()) {
    final MessageBus bus = ApplicationManager.getApplication().getMessageBus();
    final MessageBusConnection connection = bus.connect(this);
    connection.subscribe(ApplicationActivationListener.TOPIC, new ApplicationActivationListener.Adapter() {
      @Override
      public void applicationActivated(IdeFrame ideFrame) {
        connection.disconnect();
        addRequest(request, delay);
      }
    });
  } else {
    addRequest(request, delay);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:Alarm.java

示例13: RecentProjectsManagerBase

import com.intellij.util.messages.MessageBus; //导入方法依赖的package包/类
protected RecentProjectsManagerBase(@NotNull MessageBus messageBus) {
  MessageBusConnection connection = messageBus.connect();
  connection.subscribe(AppLifecycleListener.TOPIC, new MyAppLifecycleListener());
  if (!ApplicationManager.getApplication().isHeadlessEnvironment()) {
    connection.subscribe(ProjectManager.TOPIC, new MyProjectListener());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:RecentProjectsManagerBase.java

示例14: IncomingChangesIndicator

import com.intellij.util.messages.MessageBus; //导入方法依赖的package包/类
public IncomingChangesIndicator(Project project, CommittedChangesCache cache, MessageBus bus) {
  myProject = project;
  myCache = cache;
  final MessageBusConnection connection = bus.connect();
  connection.subscribe(CommittedChangesCache.COMMITTED_TOPIC, new CommittedChangesAdapter() {
    public void incomingChangesUpdated(@Nullable final List<CommittedChangeList> receivedChanges) {
      ApplicationManager.getApplication().invokeLater(new Runnable() {
        public void run() {
          refreshIndicator();
        }
      });
    }
  });
  final VcsListener listener = new VcsListener() {
    @Override
    public void directoryMappingChanged() {
      UIUtil.invokeLaterIfNeeded(new Runnable() {
        @Override
        public void run() {
          updateIndicatorVisibility();
        }
      });
    }
  };
  connection.subscribe(ProjectLevelVcsManager.VCS_CONFIGURATION_CHANGED, listener);
  connection.subscribe(ProjectLevelVcsManager.VCS_CONFIGURATION_CHANGED_IN_PLUGIN, listener);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:IncomingChangesIndicator.java

示例15: IconDeferrerImpl

import com.intellij.util.messages.MessageBus; //导入方法依赖的package包/类
public IconDeferrerImpl(MessageBus bus) {
  final MessageBusConnection connection = bus.connect();
  connection.subscribe(PsiModificationTracker.TOPIC, new PsiModificationTracker.Listener() {
    @Override
    public void modificationCountChanged() {
      clear();
    }
  });
  connection.subscribe(ProjectLifecycleListener.TOPIC, new ProjectLifecycleListener.Adapter() {
    @Override
    public void afterProjectClosed(@NotNull Project project) {
      clear();
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:IconDeferrerImpl.java


注:本文中的com.intellij.util.messages.MessageBus.connect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。