use of com.intellij.openapi.fileEditor.FileEditorManagerEvent in project intellij-community by JetBrains.
the class LineEndingsManager method updateStatusBar.
private void updateStatusBar() {
ApplicationManager.getApplication().invokeLater(() -> {
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);
}
});
}
use of com.intellij.openapi.fileEditor.FileEditorManagerEvent in project android by JetBrains.
the class FloatingToolWindowManagerTest method testSwitchingBetweenTwoEditorsWithDifferentFloatingToolWindows.
@Test
@SuppressWarnings("unchecked")
public void testSwitchingBetweenTwoEditorsWithDifferentFloatingToolWindows() {
when(myKeyboardFocusManager.getFocusOwner()).thenReturn(myWorkBench1, myWorkBench2);
myListener.fileOpened(myEditorManager, myVirtualFile);
verify(myFloatingToolWindow1).show(eq(myAttachedToolWindow1));
myListener.fileOpened(myEditorManager, myVirtualFile);
verify(myFloatingToolWindow1).hide();
verify(myFloatingToolWindow2).show(eq(myAttachedToolWindow2));
FileEditorManagerEvent event1 = new FileEditorManagerEvent(myEditorManager, null, null, null, myFileEditor1);
FileEditorManagerEvent event2 = new FileEditorManagerEvent(myEditorManager, null, null, null, myFileEditor2);
myListener.selectionChanged(event1);
verify(myFloatingToolWindow2).hide();
verify(myFloatingToolWindow1, times(2)).show(eq(myAttachedToolWindow1));
myListener.selectionChanged(event2);
verify(myFloatingToolWindow1, times(2)).hide();
verify(myFloatingToolWindow2, times(2)).show(eq(myAttachedToolWindow2));
// Now unregister one of them:
myManager.unregister(myFileEditor1);
myListener.selectionChanged(event1);
verify(myFloatingToolWindow1, times(3)).hide();
verify(myFloatingToolWindow2, times(2)).hide();
}
use of com.intellij.openapi.fileEditor.FileEditorManagerEvent in project intellij-plugins by JetBrains.
the class DartServerHighlightingTest method testServerDataLifecycle.
public void testServerDataLifecycle() throws Exception {
myFixture.configureByText("firstFile.dart", "class Foo { toString(){ return super.toString(); } }");
final VirtualFile firstFile = getFile().getVirtualFile();
final VirtualFile secondFile = myFixture.addFileToProject("secondFile.dart", "class Bar { toString(){ return super.toString(); } }").getVirtualFile();
final DartAnalysisServerService service = DartAnalysisServerService.getInstance(getProject());
myFixture.doHighlighting();
assertNotEmpty(service.getHighlight(firstFile));
assertNotEmpty(service.getNavigation(firstFile));
assertNotEmpty(service.getOverrideMembers(firstFile));
myFixture.openFileInEditor(secondFile);
// TestFileEditorManager doesn't notify listeners itself;
// we need any notification to trigger DartAnalysisserverService.updateVisibleFiles()
final FileEditorManagerEvent event = new FileEditorManagerEvent(FileEditorManager.getInstance(getProject()), firstFile, null, secondFile, null);
getProject().getMessageBus().syncPublisher(FileEditorManagerListener.FILE_EDITOR_MANAGER).selectionChanged(event);
myFixture.doHighlighting();
assertNotEmpty(service.getHighlight(firstFile));
assertNotEmpty(service.getNavigation(firstFile));
assertNotEmpty(service.getOverrideMembers(firstFile));
assertNotEmpty(service.getHighlight(secondFile));
assertNotEmpty(service.getNavigation(secondFile));
assertNotEmpty(service.getOverrideMembers(secondFile));
getProject().getMessageBus().syncPublisher(FileEditorManagerListener.FILE_EDITOR_MANAGER).fileClosed(FileEditorManager.getInstance(getProject()), firstFile);
assertNotEmpty(service.getHighlight(firstFile));
assertNotEmpty(service.getNavigation(firstFile));
assertNotEmpty(service.getOverrideMembers(firstFile));
assertNotEmpty(service.getHighlight(secondFile));
assertNotEmpty(service.getNavigation(secondFile));
assertNotEmpty(service.getOverrideMembers(secondFile));
FileEditorManager.getInstance(getProject()).closeFile(firstFile);
getProject().getMessageBus().syncPublisher(FileEditorManagerListener.FILE_EDITOR_MANAGER).fileClosed(FileEditorManager.getInstance(getProject()), firstFile);
assertEmpty(service.getHighlight(firstFile));
assertEmpty(service.getNavigation(firstFile));
assertEmpty(service.getOverrideMembers(firstFile));
assertNotEmpty(service.getHighlight(secondFile));
assertNotEmpty(service.getNavigation(secondFile));
assertNotEmpty(service.getOverrideMembers(secondFile));
}
use of com.intellij.openapi.fileEditor.FileEditorManagerEvent in project intellij-plugins by StepicOrg.
the class StudyBasePluginConfigurator method getFileEditorManagerListener.
@NotNull
@Override
public FileEditorManagerListener getFileEditorManagerListener(@NotNull Project project) {
return new FileEditorManagerAdapter() {
@Override
public void selectionChanged(@NotNull FileEditorManagerEvent event) {
VirtualFile file = event.getNewFile();
if (file == null) {
return;
}
StudyNode stepNode = StudyUtils.getStudyNode(project, file);
if (stepNode != null) {
StepikProjectManager.setSelected(project, stepNode);
}
}
};
}
Aggregations