本文整理匯總了Java中com.intellij.util.messages.MessageBusConnection.subscribe方法的典型用法代碼示例。如果您正苦於以下問題:Java MessageBusConnection.subscribe方法的具體用法?Java MessageBusConnection.subscribe怎麽用?Java MessageBusConnection.subscribe使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.util.messages.MessageBusConnection
的用法示例。
在下文中一共展示了MessageBusConnection.subscribe方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initFacet
import com.intellij.util.messages.MessageBusConnection; //導入方法依賴的package包/類
@Override
public void initFacet() {
MessageBusConnection connection = getModule().getMessageBus().connect(this);
connection.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
@Override
public void rootsChanged(ModuleRootEvent event) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
if (!isDisposed()) {
PsiDocumentManager.getInstance(getModule().getProject()).commitAllDocuments();
updateConfiguration();
}
}
});
}
});
updateConfiguration();
}
示例2: EditorNotificationsImpl
import com.intellij.util.messages.MessageBusConnection; //導入方法依賴的package包/類
public EditorNotificationsImpl(Project project) {
super(project);
myUpdateMerger = new MergingUpdateQueue("EditorNotifications update merger", 100, true, null, project);
MessageBusConnection connection = project.getMessageBus().connect(project);
connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() {
@Override
public void fileOpened(@NotNull FileEditorManager source, @NotNull VirtualFile file) {
updateNotifications(file);
}
});
connection.subscribe(DumbService.DUMB_MODE, new DumbService.DumbModeListener() {
@Override
public void enteredDumbMode() {
updateAllNotifications();
}
@Override
public void exitDumbMode() {
updateAllNotifications();
}
});
}
示例3: AndroidProjectTreeBuilder
import com.intellij.util.messages.MessageBusConnection; //導入方法依賴的package包/類
public AndroidProjectTreeBuilder(@NotNull Project project,
@NotNull JTree tree,
@NotNull DefaultTreeModel treeModel,
@Nullable Comparator<NodeDescriptor> comparator,
@NotNull ProjectAbstractTreeStructureBase treeStructure) {
super(project, tree, treeModel, comparator, treeStructure);
MessageBusConnection connection = project.getMessageBus().connect(project);
connection.subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener.Adapter() {
@Override
public void after(@NotNull List<? extends VFileEvent> events) {
for (VFileEvent e : events) {
if (e instanceof VFileDeleteEvent) {
removeMapping(e.getFile());
}
}
}
});
}
示例4: installListeners
import com.intellij.util.messages.MessageBusConnection; //導入方法依賴的package包/類
public void installListeners() {
LOG.info("installListeners " + project.getName());
// Listen for .stg file saves
VirtualFileManager.getInstance().addVirtualFileListener(myVirtualFileListener);
// Listen for editor window changes
MessageBusConnection msgBus = project.getMessageBus().connect(project);
msgBus.subscribe(
FileEditorManagerListener.FILE_EDITOR_MANAGER,
myFileEditorManagerListener
);
// Listen for editor creation and release so that we can install
// keyboard listeners that notify us when to reanalyze the file.
// listener should be removed by Intellij when project is disposed
// per doc.
EditorFactory factory = EditorFactory.getInstance();
factory.addEditorFactoryListener(new MyEditorFactoryListener(), project);
}
示例5: doViewSwitch
import com.intellij.util.messages.MessageBusConnection; //導入方法依賴的package包/類
private void doViewSwitch(@NotNull ExternalSystemTaskId id, @NotNull String projectPath) {
Project ideProject = id.findProject();
if (ideProject == null) {
return;
}
// Disable zooming on subsequent project resolves/refreshes,
// i.e. a project that already has existing modules, because it may zoom at a module
// that is going to be replaced by the current resolve.
if (ModuleManager.getInstance(ideProject).getModules().length > 0) {
return;
}
MessageBusConnection messageBusConnection = ideProject.getMessageBus().connect();
messageBusConnection.subscribe(
ProjectTopics.PROJECT_ROOTS,
new ModuleRootListener() {
@Override
public void rootsChanged(ModuleRootEvent event) {
// Initiate view switch only when project modules have been created.
new ViewSwitchProcessor(ideProject, projectPath).asyncViewSwitch();
}
}
);
}
示例6: projectOpened
import com.intellij.util.messages.MessageBusConnection; //導入方法依賴的package包/類
@Override
public void projectOpened() {
super.projectOpened();
if (myProject.isDefault() || !PantsUtil.isPantsProject(myProject)) {
return;
}
final MessageBusConnection connection = myProject.getMessageBus().connect(this);
connection.subscribe(
ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() {
@Override
public void rootsChanged(ModuleRootEvent event) {
myProjectRoots = null;
}
}
);
}
示例7: ExternalAnnotationsManagerImpl
import com.intellij.util.messages.MessageBusConnection; //導入方法依賴的package包/類
public ExternalAnnotationsManagerImpl(@NotNull final Project project, final PsiManager psiManager) {
super(psiManager);
myBus = project.getMessageBus();
final MessageBusConnection connection = myBus.connect(project);
connection.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
@Override
public void rootsChanged(ModuleRootEvent event) {
dropCache();
}
});
final MyVirtualFileListener fileListener = new MyVirtualFileListener();
VirtualFileManager.getInstance().addVirtualFileListener(fileListener);
Disposer.register(myPsiManager.getProject(), new Disposable() {
@Override
public void dispose() {
VirtualFileManager.getInstance().removeVirtualFileListener(fileListener);
}
});
}
示例8: TodoView
import com.intellij.util.messages.MessageBusConnection; //導入方法依賴的package包/類
TodoView(Project project, ProjectLevelVcsManager manager){
myProject=project;
myVCSManager = manager;
myCurrentPanelSettings=new TodoPanelSettings();
myAllPanelSettings=new TodoPanelSettings();
myChangeListTodosPanelSettings = new TodoPanelSettings();
myPanels = new ArrayList<TodoPanel>();
myNotAddedContent = new ArrayList<Content>();
myVCSManager.addVcsListener(myVcsListener);
final MyPropertyChangeListener myPropertyChangeListener = new MyPropertyChangeListener();
TodoConfiguration.getInstance().addPropertyChangeListener(myPropertyChangeListener,this);
MessageBusConnection connection = myProject.getMessageBus().connect(this);
connection.subscribe(FileTypeManager.TOPIC, new MyFileTypeListener());
}
示例9: install
import com.intellij.util.messages.MessageBusConnection; //導入方法依賴的package包/類
public void install() {
final MessageBusConnection connection = myProject.getMessageBus().connect(myProject);
connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() {
@Override
public void selectionChanged(@NotNull FileEditorManagerEvent event) {
final FileEditor editor = event.getNewEditor();
if (editor != null && myComponent.isShowing() && isAutoScrollEnabled()) {
myAlarm.cancelAllRequests();
myAlarm.addRequest(new Runnable() {
@Override
public void run() {
selectElementFromEditor(editor);
}
}, getAlarmDelay(), getModalityState());
}
}
});
}
示例10: makeDumbAware
import com.intellij.util.messages.MessageBusConnection; //導入方法依賴的package包/類
public void makeDumbAware(final Project project) {
AccessToken accessToken = ReadAction.start();
try {
MessageBusConnection connection = project.getMessageBus().connect(this);
connection.subscribe(DumbService.DUMB_MODE, new DumbService.DumbModeListener() {
public void enteredDumbMode() {
suspend();
}
public void exitDumbMode() {
resume();
}
});
if (DumbService.getInstance(project).isDumb()) {
suspend();
}
}
finally {
accessToken.finish();
}
}
示例11: projectOpened
import com.intellij.util.messages.MessageBusConnection; //導入方法依賴的package包/類
@Override
public void projectOpened() {
MessageBusConnection connection = myProject.getMessageBus().connect(myProject);
connection.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
@Override
public void rootsChanged(ModuleRootEvent event) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
if (myProject.isDisposed()) return;
VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
}
}, ModalityState.NON_MODAL);
}
});
final WolfTheProblemSolver.ProblemListener myProblemListener = new MyProblemListener();
WolfTheProblemSolver.getInstance(myProject).addProblemListener(myProblemListener,myProject);
}
示例12: VcsLogContentProvider
import com.intellij.util.messages.MessageBusConnection; //導入方法依賴的package包/類
public VcsLogContentProvider(@Nonnull Project project, @Nonnull VcsProjectLog projectLog) {
myProject = project;
myProjectLog = projectLog;
MessageBusConnection connection = project.getMessageBus().connect(project);
connection.subscribe(VcsProjectLog.VCS_PROJECT_LOG_CHANGED, new VcsProjectLog.ProjectLogListener() {
@Override
public void logCreated() {
addLogUi();
}
@Override
public void logDisposed() {
myContainer.removeAll();
closeLogTabs();
}
});
if (myProjectLog.getLogManager() != null) {
addLogUi();
}
}
示例13: runActivity
import com.intellij.util.messages.MessageBusConnection; //導入方法依賴的package包/類
@Override
public void runActivity(@Nonnull UIAccess uiAccess, @Nonnull Project project) {
if (project.isDefault() || ApplicationManager.getApplication().isUnitTestMode() || project.isDisposed()) {
return;
}
MessageBusConnection connection = project.getMessageBus().connect();
connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new MyFileEditorManagerListener());
connection.subscribe(FileTypeManager.TOPIC, new FileTypeListener() {
@Override
public void fileTypesChanged(@Nonnull FileTypeEvent event) {
reinitBreadcrumbsInAllEditors(project);
}
});
VirtualFileManager.getInstance().addVirtualFileListener(new MyVirtualFileListener(project), project);
connection.subscribe(UISettingsListener.TOPIC, uiSettings -> reinitBreadcrumbsInAllEditors(project));
}
示例14: TodoView
import com.intellij.util.messages.MessageBusConnection; //導入方法依賴的package包/類
@RequiredReadAction
public TodoView(@Nonnull Project project) {
myProject = project;
state.all.isAutoScrollToSource = true;
state.current.isAutoScrollToSource = true;
TodoConfiguration.getInstance().addPropertyChangeListener(new MyPropertyChangeListener(), this);
MessageBusConnection connection = project.getMessageBus().connect(this);
connection.subscribe(FileTypeManager.TOPIC, new MyFileTypeListener());
connection.subscribe(ProjectLevelVcsManager.VCS_CONFIGURATION_CHANGED, myVcsListener);
connection.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() {
@Override
@RequiredReadAction
public void rootsChanged(ModuleRootEvent event) {
validateSettings();
}
});
}
示例15: EditorNotificationsImpl
import com.intellij.util.messages.MessageBusConnection; //導入方法依賴的package包/類
public EditorNotificationsImpl(Project project) {
myProject = project;
myUpdateMerger = new MergingUpdateQueue("EditorNotifications update merger", 100, true, null, project);
MessageBusConnection connection = project.getMessageBus().connect(project);
connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() {
@Override
public void fileOpened(@Nonnull FileEditorManager source, @Nonnull VirtualFile file) {
updateNotifications(file);
}
});
connection.subscribe(DumbService.DUMB_MODE, new DumbService.DumbModeListener() {
@Override
public void enteredDumbMode() {
updateAllNotifications();
}
@Override
public void exitDumbMode() {
updateAllNotifications();
}
});
}