本文整理汇总了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();
}
});
}
示例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));
}
});
}
示例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);
}
示例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();
}
});
}
示例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();
}
示例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);
}
}
示例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));
}
示例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());
}
}
示例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());
}
示例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());
}
示例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);
}
示例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);
}
}
示例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());
}
}
示例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);
}
示例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();
}
});
}