Java Code Examples for com.intellij.util.messages.MessageBus#connect()
The following examples show how to use
com.intellij.util.messages.MessageBus#connect() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FlutterSaveActionsManager.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
private FlutterSaveActionsManager(@NotNull Project project) { this.myProject = project; final MessageBus bus = project.getMessageBus(); final MessageBusConnection connection = bus.connect(); connection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerListener() { @Override public void beforeDocumentSaving(@NotNull Document document) { // Don't try and format read only docs. if (!document.isWritable()) { return; } handleBeforeDocumentSaving(document); } }); }
Example 2
Source File: FlutterSaveActionsManager.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
private FlutterSaveActionsManager(@NotNull Project project) { this.myProject = project; final MessageBus bus = project.getMessageBus(); final MessageBusConnection connection = bus.connect(); connection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerListener() { @Override public void beforeDocumentSaving(@NotNull Document document) { // Don't try and format read only docs. if (!document.isWritable()) { return; } handleBeforeDocumentSaving(document); } }); }
Example 3
Source File: Alarm.java From consulo with Apache License 2.0 | 6 votes |
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(@Nonnull IdeFrame ideFrame) { connection.disconnect(); addRequest(request, delay); } }); } else { addRequest(request, delay); } }