本文整理汇总了Java中com.intellij.util.messages.MessageBus类的典型用法代码示例。如果您正苦于以下问题:Java MessageBus类的具体用法?Java MessageBus怎么用?Java MessageBus使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MessageBus类属于com.intellij.util.messages包,在下文中一共展示了MessageBus类的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: actionPerformed
import com.intellij.util.messages.MessageBus; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
if (e.getProject() != null) {
ScanManager scanManager = ScanManagerFactory.getScanManager(e.getProject());
if (scanManager == null) {
// Check if the project is supported now
ScanManagerFactory scanManagerFactory = ServiceManager.getService(e.getProject(), ScanManagerFactory.class);
scanManagerFactory.initScanManager(e.getProject());
scanManager = ScanManagerFactory.getScanManager(e.getProject());
if (scanManager == null) {
return;
}
MessageBus messageBus = ApplicationManager.getApplication().getMessageBus();
messageBus.syncPublisher(Events.ON_IDEA_FRAMEWORK_CHANGE).update();
}
scanManager.asyncScanAndUpdateResults(false);
}
}
示例4: importData
import com.intellij.util.messages.MessageBus; //导入依赖的package包/类
/**
* This function is called after change in the build.gradle file or refresh gradle dependencies call.
* @param toImport the project dependencies
* @param projectData the project data
* @param project the current project
* @param modelsProvider contains the project modules
*/
@Override
public void importData(@NotNull Collection<DataNode<LibraryDependencyData>> toImport,
@Nullable ProjectData projectData,
@NotNull Project project,
@NotNull IdeModifiableModelsProvider modelsProvider) {
if (projectData == null || !projectData.getOwner().equals(GradleConstants.SYSTEM_ID)) {
return;
}
ScanManager scanManager = ScanManagerFactory.getScanManager(project);
if (scanManager == null) {
ScanManagerFactory scanManagerFactory = ServiceManager.getService(project, ScanManagerFactory.class);
scanManagerFactory.initScanManager(project);
scanManager = ScanManagerFactory.getScanManager(project);
if (scanManager == null) {
return;
}
MessageBus messageBus = ApplicationManager.getApplication().getMessageBus();
messageBus.syncPublisher(Events.ON_IDEA_FRAMEWORK_CHANGE).update();
}
if (GlobalSettings.getInstance().isCredentialsSet()) {
scanManager.asyncScanAndUpdateResults(true, toImport);
}
}
示例5: _do
import com.intellij.util.messages.MessageBus; //导入依赖的package包/类
public static void _do(@NotNull final ConfigurationError error, @NotNull final Project project,
@NotNull final PairProcessor<ConfigurationErrors, ConfigurationError> fun) {
if (!project.isInitialized()) {
StartupManager.getInstance(project).runWhenProjectIsInitialized(new Runnable() {
@Override
public void run() {
fun.process(project.getMessageBus().syncPublisher(TOPIC), error);
}
});
return;
}
final MessageBus bus = project.getMessageBus();
if (EventQueue.isDispatchThread()) fun.process(bus.syncPublisher(TOPIC), error);
else {
//noinspection SSBasedInspection
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
fun.process(bus.syncPublisher(TOPIC), error);
}
});
}
}
示例6: set
import com.intellij.util.messages.MessageBus; //导入依赖的package包/类
public static void set(@Nullable final String text, @Nullable final Project project, @Nullable final String requestor) {
if (project != null) {
if (project.isDisposed()) return;
if (!project.isInitialized()) {
StartupManager.getInstance(project).runWhenProjectIsInitialized(new Runnable() {
public void run() {
project.getMessageBus().syncPublisher(TOPIC).setInfo(text, requestor);
}
});
return;
}
}
final MessageBus bus = project == null ? ApplicationManager.getApplication().getMessageBus() : project.getMessageBus();
bus.syncPublisher(TOPIC).setInfo(text, requestor);
}
示例7: PsiModificationTrackerImpl
import com.intellij.util.messages.MessageBus; //导入依赖的package包/类
public PsiModificationTrackerImpl(Project project) {
final MessageBus bus = project.getMessageBus();
myPublisher = bus.syncPublisher(TOPIC);
bus.connect().subscribe(DumbService.DUMB_MODE, new DumbService.DumbModeListener() {
private void doIncCounter() {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
incCounter();
}
});
}
@Override
public void enteredDumbMode() {
doIncCounter();
}
@Override
public void exitDumbMode() {
doIncCounter();
}
});
}
示例8: IncomingChangesViewProvider
import com.intellij.util.messages.MessageBus; //导入依赖的package包/类
public IncomingChangesViewProvider(final Project project, final MessageBus bus) {
myProject = project;
myBus = bus;
myListConsumer = new Consumer<List<CommittedChangeList>>() {
@Override
public void consume(final List<CommittedChangeList> lists) {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
myBrowser.getEmptyText().setText(VcsBundle.message("incoming.changes.empty.message"));
myBrowser.setItems(lists, CommittedChangesBrowserUseCase.INCOMING);
}
});
}
};
}
示例9: OutdatedVersionNotifier
import com.intellij.util.messages.MessageBus; //导入依赖的package包/类
public OutdatedVersionNotifier(FileEditorManager fileEditorManager,
CommittedChangesCache cache,
MessageBus messageBus, Project project) {
myFileEditorManager = fileEditorManager;
myCache = cache;
myProject = project;
messageBus.connect().subscribe(CommittedChangesCache.COMMITTED_TOPIC, new CommittedChangesAdapter() {
public void incomingChangesUpdated(@Nullable final List<CommittedChangeList> receivedChanges) {
if (myCache.getCachedIncomingChanges() == null) {
requestLoadIncomingChanges();
}
else {
updateAllEditorsLater();
}
}
@Override
public void changesCleared() {
updateAllEditorsLater();
}
});
}
示例10: PsiAwareFileEditorManagerImpl
import com.intellij.util.messages.MessageBus; //导入依赖的package包/类
public PsiAwareFileEditorManagerImpl(final Project project,
final PsiManager psiManager,
final WolfTheProblemSolver problemSolver,
DockManager dockManager,
MessageBus messageBus,
EditorHistoryManager editorHistoryManager) {
super(project, dockManager, editorHistoryManager);
myPsiManager = psiManager;
myProblemSolver = problemSolver;
myPsiTreeChangeListener = new MyPsiTreeChangeListener();
myProblemListener = new MyProblemListener();
registerExtraEditorDataProvider(new TextEditorPsiDataProvider(), null);
// reinit syntax highlighter for Groovy. In power save mode keywords are highlighted by GroovySyntaxHighlighter insteadof
// GrKeywordAndDeclarationHighlighter. So we need to drop caches for token types attributes in LayeredLexerEditorHighlighter
messageBus.connect().subscribe(PowerSaveMode.TOPIC, new PowerSaveMode.Listener() {
@Override
public void powerSaveStateChanged() {
for (Editor editor : EditorFactory.getInstance().getAllEditors()) {
((EditorEx)editor).reinitSettings();
}
}
});
}
示例11: 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);
}
示例12: PyModuleListener
import com.intellij.util.messages.MessageBus; //导入依赖的package包/类
public PyModuleListener(MessageBus messageBus) {
messageBus.connect().subscribe(ProjectTopics.MODULES, new ModuleAdapter() {
@Override
public void beforeModuleRemoved(@NotNull Project project, @NotNull Module module) {
final RunManagerEx runManager = RunManagerEx.getInstanceEx(project);
final Collection<RunnerAndConfigurationSettings> configurations = new ArrayList<RunnerAndConfigurationSettings>(runManager.getSortedConfigurations());
for (RunnerAndConfigurationSettings configuration : configurations) {
if (configuration.getConfiguration() instanceof AbstractPythonRunConfiguration) {
final Module configModule = ((AbstractPythonRunConfiguration)configuration.getConfiguration()).getModule();
if (configModule == module) {
runManager.removeConfiguration(configuration);
}
}
}
}
});
}
示例13: executeChunked
import com.intellij.util.messages.MessageBus; //导入依赖的package包/类
@Override
protected void executeChunked(@NotNull List<List<String>> chunkedCommits) throws HgCommandException, VcsException {
if (chunkedCommits.isEmpty()) {
executeQNew(ContainerUtil.<String>emptyList());
}
else {
int size = chunkedCommits.size();
int i = 0;
if (!myAmend) {
executeQNew(chunkedCommits.get(0));
i = 1;
}
for (; i < size; i++) {
executeQRefresh(chunkedCommits.get(i));
}
}
myRepository.update();
final MessageBus messageBus = myProject.getMessageBus();
messageBus.syncPublisher(HgVcs.REMOTE_TOPIC).update(myProject, null);
}
示例14: execute
import com.intellij.util.messages.MessageBus; //导入依赖的package包/类
public void execute() throws HgCommandException, VcsException {
if (StringUtil.isEmptyOrSpaces(myMessage)) {
throw new HgCommandException(HgVcsMessages.message("hg4idea.commit.error.messageEmpty"));
}
if (myFiles.isEmpty()) {
executeChunked(Collections.<List<String>>emptyList());
}
else {
List<String> relativePaths = ContainerUtil.map2List(myFiles, new Function<HgFile, String>() {
@Override
public String fun(HgFile file) {
return file.getRelativePath();
}
});
List<List<String>> chunkedCommits = VcsFileUtil.chunkRelativePaths(relativePaths);
executeChunked(chunkedCommits);
}
myRepository.update();
final MessageBus messageBus = myProject.getMessageBus();
messageBus.syncPublisher(HgVcs.REMOTE_TOPIC).update(myProject, null);
}
示例15: 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();
}
});
}