本文整理汇总了Java中com.intellij.openapi.fileEditor.FileEditorManagerListener类的典型用法代码示例。如果您正苦于以下问题:Java FileEditorManagerListener类的具体用法?Java FileEditorManagerListener怎么用?Java FileEditorManagerListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FileEditorManagerListener类属于com.intellij.openapi.fileEditor包,在下文中一共展示了FileEditorManagerListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initComponent
import com.intellij.openapi.fileEditor.FileEditorManagerListener; //导入依赖的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));
}
});
}
示例2: install
import com.intellij.openapi.fileEditor.FileEditorManagerListener; //导入依赖的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());
}
}
});
}
示例3: EditorNotificationsImpl
import com.intellij.openapi.fileEditor.FileEditorManagerListener; //导入依赖的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();
}
});
}
示例4: projectOpened
import com.intellij.openapi.fileEditor.FileEditorManagerListener; //导入依赖的package包/类
@Override
public void projectOpened() {
myIdeFrame = ((WindowManagerEx)myWindowManager).getFrame(myProject);
myProject.getMessageBus().connect(myProject).subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() {
@Override
public void selectionChanged(@NotNull FileEditorManagerEvent event) {
if (myIdeFrame == null || myIdeFrame.getFocusOwner() == null) return;
setActiveWindow(myIdeFrame);
}
});
final MyEditorFactoryListener myEditorFactoryListener = new MyEditorFactoryListener();
myEditorFactory.addEditorFactoryListener(myEditorFactoryListener,myProject);
Disposer.register(myProject, new Disposable() {
@Override
public void dispose() {
myEditorFactoryListener.executeOnRelease(null);
}
});
}
示例5: StatusBarUpdater
import com.intellij.openapi.fileEditor.FileEditorManagerListener; //导入依赖的package包/类
public StatusBarUpdater(Project project) {
myProject = project;
project.getMessageBus().connect(this).subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() {
@Override
public void selectionChanged(@NotNull FileEditorManagerEvent event) {
updateLater();
}
});
project.getMessageBus().connect(this).subscribe(DaemonCodeAnalyzer.DAEMON_EVENT_TOPIC, new DaemonCodeAnalyzer.DaemonListenerAdapter() {
@Override
public void daemonFinished() {
updateLater();
}
});
}
示例6: CurrentFileTodosPanel
import com.intellij.openapi.fileEditor.FileEditorManagerListener; //导入依赖的package包/类
CurrentFileTodosPanel(Project project, TodoPanelSettings settings, Content content) {
super(project, settings, true, content);
VirtualFile[] files = FileEditorManager.getInstance(project).getSelectedFiles();
setFile(files.length == 0 ? null : PsiManager.getInstance(myProject).findFile(files[0]));
// It's important to remove this listener. It prevents invocation of setFile method after the tree builder is disposed
project.getMessageBus().connect(this).subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() {
@Override
public void selectionChanged(@NotNull FileEditorManagerEvent e) {
VirtualFile file = e.getNewFile();
final PsiFile psiFile = file != null && file.isValid() ? PsiManager.getInstance(myProject).findFile(file) : null;
// This invokeLater is required. The problem is setFile does a commit to PSI, but setFile is
// invoked inside PSI change event. It causes an Exception like "Changes to PSI are not allowed inside event processing"
DumbService.getInstance(myProject).smartInvokeLater(new Runnable() {
@Override
public void run() {
setFile(psiFile);
}
});
}
});
}
示例7: createToolWindowContent
import com.intellij.openapi.fileEditor.FileEditorManagerListener; //导入依赖的package包/类
/**
* Initialize the tool window
* @param project the current project
* @param toolWindow the tool window which should be initialized
*/
@Override
public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
this.project = project;
main_panel.setLayout(layout);
project.getMessageBus().connect().subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, this);
Component component = toolWindow.getComponent();
component.getParent().setLayout(new BorderLayout());
component.getParent().add(main_panel);
initCommonViews();
component.getParent().add(test_type, BorderLayout.NORTH);
loadingTests();
initNoTests();
initTests();
testSelector = new TestSelectorEspresso(tests_panel, search_field, project);
loader.start_animation();
populate();
}
示例8: installListeners
import com.intellij.openapi.fileEditor.FileEditorManagerListener; //导入依赖的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);
}
示例9: projectOpened
import com.intellij.openapi.fileEditor.FileEditorManagerListener; //导入依赖的package包/类
@Override
public void projectOpened() {
myIdeFrame = ((WindowManagerEx)myWindowManager).getFrame(myProject);
myProject.getMessageBus().connect(myProject).subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() {
@Override
public void selectionChanged(@NotNull FileEditorManagerEvent event) {
if (myIdeFrame == null || myIdeFrame.getFocusOwner() == null) return;
setActiveWindow(myIdeFrame);
}
});
final MyEditorFactoryListener myEditorFactoryListener = new MyEditorFactoryListener();
myEditorFactory.addEditorFactoryListener(myEditorFactoryListener,myProject);
Disposer.register(myProject, new Disposable() {
@Override
public void dispose() {
myEditorFactoryListener.dispose(null);
}
});
}
示例10: StatusBarUpdater
import com.intellij.openapi.fileEditor.FileEditorManagerListener; //导入依赖的package包/类
public StatusBarUpdater(Project project) {
myProject = project;
project.getMessageBus().connect(this).subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() {
@Override
public void selectionChanged(@NotNull FileEditorManagerEvent event) {
updateLater();
}
});
project.getMessageBus().connect(this).subscribe(DaemonCodeAnalyzer.DAEMON_EVENT_TOPIC, new DaemonCodeAnalyzer.DaemonListener() {
@Override
public void daemonFinished() {
updateLater();
}
@Override
public void daemonCancelEventOccurred() {
}
});
}
示例11: install
import com.intellij.openapi.fileEditor.FileEditorManagerListener; //导入依赖的package包/类
public void install() {
final MessageBusConnection connection = myProject.getMessageBus().connect(myProject);
connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() {
@Override
public void selectionChanged(@Nonnull 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());
}
}
});
}
示例12: projectOpened
import com.intellij.openapi.fileEditor.FileEditorManagerListener; //导入依赖的package包/类
@Override
public void projectOpened() {
myIdeFrame = myWindowManager.getFrame(myProject);
myProject.getMessageBus().connect(myProject).subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() {
@Override
public void selectionChanged(@Nonnull FileEditorManagerEvent event) {
if (myIdeFrame == null || myIdeFrame.getFocusOwner() == null) return;
setActiveWindow(myIdeFrame);
}
});
final MyEditorFactoryListener myEditorFactoryListener = new MyEditorFactoryListener();
myEditorFactory.addEditorFactoryListener(myEditorFactoryListener,myProject);
Disposer.register(myProject, new Disposable() {
@Override
public void dispose() {
myEditorFactoryListener.executeOnRelease(null);
}
});
}
示例13: StatusBarUpdater
import com.intellij.openapi.fileEditor.FileEditorManagerListener; //导入依赖的package包/类
public StatusBarUpdater(Project project) {
myProject = project;
project.getMessageBus().connect(this).subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() {
@Override
public void selectionChanged(@Nonnull FileEditorManagerEvent event) {
updateLater();
}
});
project.getMessageBus().connect(this).subscribe(DaemonCodeAnalyzer.DAEMON_EVENT_TOPIC, new DaemonCodeAnalyzer.DaemonListenerAdapter() {
@Override
public void daemonFinished() {
updateLater();
}
});
}
示例14: runActivity
import com.intellij.openapi.fileEditor.FileEditorManagerListener; //导入依赖的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));
}
示例15: CurrentFileTodosPanel
import com.intellij.openapi.fileEditor.FileEditorManagerListener; //导入依赖的package包/类
CurrentFileTodosPanel(Project project, TodoPanelSettings settings, Content content) {
super(project, settings, true, content);
VirtualFile[] files = FileEditorManager.getInstance(project).getSelectedFiles();
setFile(files.length == 0 ? null : PsiManager.getInstance(myProject).findFile(files[0]));
// It's important to remove this listener. It prevents invocation of setFile method after the tree builder is disposed
project.getMessageBus().connect(this).subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerListener() {
@Override
public void selectionChanged(@Nonnull FileEditorManagerEvent e) {
VirtualFile file = e.getNewFile();
final PsiFile psiFile = file != null && file.isValid() ? PsiManager.getInstance(myProject).findFile(file) : null;
// This invokeLater is required. The problem is setFile does a commit to PSI, but setFile is
// invoked inside PSI change event. It causes an Exception like "Changes to PSI are not allowed inside event processing"
DumbService.getInstance(myProject).smartInvokeLater(() -> setFile(psiFile));
}
});
}