本文整理汇总了Java中com.intellij.openapi.fileEditor.FileEditorManagerEvent类的典型用法代码示例。如果您正苦于以下问题:Java FileEditorManagerEvent类的具体用法?Java FileEditorManagerEvent怎么用?Java FileEditorManagerEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FileEditorManagerEvent类属于com.intellij.openapi.fileEditor包,在下文中一共展示了FileEditorManagerEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: selectionChanged
import com.intellij.openapi.fileEditor.FileEditorManagerEvent; //导入依赖的package包/类
@Override
public void selectionChanged(@NotNull FileEditorManagerEvent fileEditorManagerEvent) {
final Project project = fileEditorManagerEvent.getManager().getProject();
final FileEditorManagerEx manager = FileEditorManagerEx.getInstanceEx(project);
final FileColorManager fileColorManager = FileColorManager.getInstance(project);
final HighlighterSettingsConfig highlighterSettingsConfig = HighlighterSettingsConfig.getInstance(project);
final VirtualFile oldFile = fileEditorManagerEvent.getOldFile();
final VirtualFile newFile = fileEditorManagerEvent.getNewFile();
for (EditorWindow editorWindow : manager.getWindows()) {
setUnfocusedTabWithColorManagerDefaultColor(fileColorManager, oldFile, editorWindow);
setFocusedTabHighlighterColor(highlighterSettingsConfig, newFile, editorWindow);
}
}
示例2: install
import com.intellij.openapi.fileEditor.FileEditorManagerEvent; //导入依赖的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: selectionChanged
import com.intellij.openapi.fileEditor.FileEditorManagerEvent; //导入依赖的package包/类
@Override
public void selectionChanged(@NotNull FileEditorManagerEvent event) {
}
});
myFocusListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if ("focusOwner".equals(evt.getPropertyName())) {
myUpdateHeadersAlarm.cancelAllRequests();
myUpdateHeadersAlarm.addRequest(myUpdateHeadersRunnable, 50);
}
}
};
KeyboardFocusManager.getCurrentKeyboardFocusManager().addPropertyChangeListener(myFocusListener);
}
示例4: projectOpened
import com.intellij.openapi.fileEditor.FileEditorManagerEvent; //导入依赖的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.FileEditorManagerEvent; //导入依赖的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.FileEditorManagerEvent; //导入依赖的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: updateStatusBar
import com.intellij.openapi.fileEditor.FileEditorManagerEvent; //导入依赖的package包/类
private void updateStatusBar() {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
IdeFrame frame = WindowManager.getInstance().getIdeFrame(myProject);
StatusBar statusBar = frame != null ? frame.getStatusBar() : null;
StatusBarWidget widget = statusBar != null ? statusBar.getWidget("LineSeparator") : null;
if (widget instanceof LineSeparatorPanel) {
FileEditorManagerEvent event = new FileEditorManagerEvent(FileEditorManager.getInstance(myProject),
null, null, null, null);
((LineSeparatorPanel)widget).selectionChanged(event);
}
}
});
}
示例8: projectOpened
import com.intellij.openapi.fileEditor.FileEditorManagerEvent; //导入依赖的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);
}
});
}
示例9: StatusBarUpdater
import com.intellij.openapi.fileEditor.FileEditorManagerEvent; //导入依赖的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() {
}
});
}
示例10: updateStatusBar
import com.intellij.openapi.fileEditor.FileEditorManagerEvent; //导入依赖的package包/类
private void updateStatusBar() {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
IdeFrame frame = WindowManager.getInstance().getIdeFrame(project);
StatusBar statusBar = frame.getStatusBar();
StatusBarWidget widget = statusBar != null ? statusBar.getWidget("LineSeparator") : null;
if (widget instanceof LineSeparatorPanel) {
FileEditorManagerEvent event = new FileEditorManagerEvent(FileEditorManager.getInstance(project),
null, null, null, null);
((LineSeparatorPanel)widget).selectionChanged(event);
}
}
});
}
示例11: install
import com.intellij.openapi.fileEditor.FileEditorManagerEvent; //导入依赖的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.FileEditorManagerEvent; //导入依赖的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.FileEditorManagerEvent; //导入依赖的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: CurrentFileTodosPanel
import com.intellij.openapi.fileEditor.FileEditorManagerEvent; //导入依赖的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));
}
});
}
示例15: selectionChanged
import com.intellij.openapi.fileEditor.FileEditorManagerEvent; //导入依赖的package包/类
public void selectionChanged(@NotNull FileEditorManagerEvent event) {
VirtualFile fileNew = event.getNewFile();
Editor rootEditor = event.getManager().getSelectedTextEditor();
if (rootEditor == null) {
return;
}
Document rootDocument = rootEditor.getDocument();
if (fileNew != null) {
if (!isFeatureFile(fileNew))
return;
String pathNewFile = getRelativePath(fileNew.getPath());
if (openedGherkinFiles.stream().noneMatch(f -> f.equals(pathNewFile))) {
openedGherkinFiles.add(pathNewFile);
GherkinIconUtils gherkinIconUtils = new GherkinIconUtils(pathNewFile);
gherkinIconUtils.generateGherkinRunIcons(rootDocument, rootEditor);
GherkinDocumentListener listener = new GherkinDocumentListener(pathNewFile, rootEditor);
rootDocument.addDocumentListener(listener);
documentListeners.add(listener);
}
}
}