use of com.intellij.util.messages.MessageBus in project ActiveTabHighlighterPlugin by tobszarny.
the class ActiveTabHighlighterComponent method initComponent.
@Override
public void initComponent() {
logger.debug("Initializing component");
MessageBus bus = ApplicationManager.getApplication().getMessageBus();
connection = bus.connect();
connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new TabHighlighterFileEditorListener());
}
use of com.intellij.util.messages.MessageBus in project android by JetBrains.
the class GradleSyncStateIntegrationTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
initMocks(this);
Project project = getProject();
MessageBus messageBus = mock(MessageBus.class);
when(messageBus.syncPublisher(GRADLE_SYNC_TOPIC)).thenReturn(mySyncListener);
mySyncState = new GradleSyncState(project, GradleProjectInfo.getInstance(project), GradleFiles.getInstance(project), messageBus);
}
use of com.intellij.util.messages.MessageBus in project intellij-elixir by KronicDeth.
the class ParsingTestCase method setProjectSdkFromSdkHome.
private void setProjectSdkFromSdkHome(@NotNull String sdkHome) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
MessageBus messageBus = messageBus();
registerProjectFileIndex(messageBus);
ProjectRootManager projectRootManager = registerProjectRootManager();
assertTrue(pathIsValidSdkHome(sdkHome));
registerExtensionPoint(OrderRootType.EP_NAME, OrderRootType.class);
registerExtension(OrderRootType.EP_NAME, new JavadocOrderRootType());
getApplication().addComponent(VirtualFileManager.class, new VirtualFileManagerImpl(new VirtualFileSystem[] { new MockLocalFileSystem() }, messageBus));
ProjectJdkTable projectJdkTable = new ProjectJdkTableImpl();
registerApplicationService(ProjectJdkTable.class, projectJdkTable);
registerExtensionPoint(com.intellij.openapi.projectRoots.SdkType.EP_NAME, com.intellij.openapi.projectRoots.SdkType.class);
registerExtension(com.intellij.openapi.projectRoots.SdkType.EP_NAME, new ElixirSdkType());
Sdk sdk = ElixirSdkType.createMockSdk(sdkHome, elixirSdkRelease());
projectJdkTable.addJdk(sdk);
ExtensionsArea area = Extensions.getArea(myProject);
registerExtensionPoint(area, ProjectExtension.EP_NAME, ProjectExtension.class);
registerExtensionPoint(FilePropertyPusher.EP_NAME, FilePropertyPusher.class);
myProject.addComponent(PushedFilePropertiesUpdater.class, new PushedFilePropertiesUpdaterImpl(myProject));
projectRootManager.setProjectSdk(sdk);
}
use of com.intellij.util.messages.MessageBus in project checkstyle-idea by jshiell.
the class OpLoadConfigurationTest method interceptApplicationNotifications.
private void interceptApplicationNotifications() {
final MessageBus messageBus = mock(MessageBus.class);
when(PROJECT.getMessageBus()).thenReturn(messageBus);
when(messageBus.syncPublisher(Notifications.TOPIC)).thenReturn(notifications);
final Application application = mock(Application.class);
when(application.isUnitTestMode()).thenReturn(true);
when(application.getMessageBus()).thenReturn(messageBus);
ApplicationManager.setApplication(application, mock(Disposable.class));
}
use of com.intellij.util.messages.MessageBus in project Intellij-Discord-Integration by Almighty-Alpaca.
the class DiscordIntegrationApplicationComponent method initComponent.
@Override
public synchronized void initComponent() {
try // Fixes problems that crashes JGroups if those two properties aren't properly set
{
Locale locale = Locale.getDefault();
if (System.getProperty("user.language") == null)
System.setProperty("user.language", locale.getLanguage());
if (System.getProperty("user.country") == null)
System.setProperty("user.country", locale.getCountry());
} catch (Exception e) {
e.printStackTrace();
}
try {
String props = "fast.xml";
LOG.trace("DiscordIntegrationApplicationComponent#initComponent()#props = {}", props);
JChannel channel = new JChannel(props);
channel.setReceiver(this);
this.channel = channel;
channel.connect("JetbrainsDiscordIntegration v" + JetbrainsDiscordIntegration.PROTOCOL_VERSION);
ReplicatedData data = new ReplicatedData(channel, this);
this.data = data;
this.instanceInfo = new InstanceInfo(channel.getAddressAsString(), ApplicationInfo.getInstance());
LOG.trace("DiscordIntegrationApplicationComponent#initComponent()#this.instanceInfo = {}", this.instanceInfo);
data.instanceAdd(System.currentTimeMillis(), this.instanceInfo);
RPC.updatePresence(2, TimeUnit.SECONDS);
} catch (Exception e) {
if (this.channel != null) {
this.channel.close();
this.channel = null;
}
if (this.data != null) {
this.data.close();
this.data = null;
}
RPC.dispose();
throw new RuntimeException(e);
}
MessageBus bus = ApplicationManager.getApplication().getMessageBus();
connection = bus.connect();
connection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerListener());
connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerListener());
EditorEventMulticaster multicaster = EditorFactory.getInstance().getEventMulticaster();
multicaster.addDocumentListener(this.documentListener = new DocumentListener());
multicaster.addEditorMouseListener(this.editorMouseListener = new EditorMouseListener());
checkExperiementalWindowListener();
VirtualFileManager.getInstance().addVirtualFileListener(this.virtualFileListener = new VirtualFileListener());
}
Aggregations