List of usage examples for com.intellij.openapi.fileEditor FileEditorManagerEvent FileEditorManagerEvent
public FileEditorManagerEvent(@NotNull FileEditorManager source, @Nullable VirtualFile oldFile,
@Nullable FileEditor oldEditor, @Nullable VirtualFile newFile, @Nullable FileEditor newEditor)
From source file:com.android.tools.adtui.workbench.FloatingToolWindowManagerTest.java
License:Apache License
@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);//from w w w .j a v a 2 s. c om 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(); }
From source file:org.sonarlint.intellij.trigger.FileEditorTriggerTest.java
License:Open Source License
@Test public void should_do_nothing_closed() { VirtualFile f1 = mock(VirtualFile.class); FileEditorManager mock = mock(FileEditorManager.class); editorTrigger.fileClosed(mock, f1);//from w ww . ja va 2 s . c o m editorTrigger.selectionChanged(new FileEditorManagerEvent(mock, null, null, null, null)); }