Search in sources :

Example 36 with FileEditorManagerEx

use of com.intellij.openapi.fileEditor.ex.FileEditorManagerEx in project intellij-community by JetBrains.

the class FormOpeningTest method testOpenInDumbMode.

public void testOpenInDumbMode() throws Exception {
    FileEditorManagerEx editorManager = FileEditorManagerEx.getInstanceEx(getProject());
    VirtualFile file = myFixture.copyFileToProject("TestBorder.form");
    DumbServiceImpl dumbService = (DumbServiceImpl) DumbService.getInstance(getProject());
    dumbService.setDumb(true);
    try {
        FileEditor[] editors = editorManager.openFile(file, true);
        assertEquals(1, editors.length);
        assertInstanceOf(editors[0], UIFormEditor.class);
        JComponent component = getEditorComponent();
        assertInstanceOf(component, DumbUnawareHider.class);
        assertEquals(2, component.getComponentCount());
        Component editorComponent = component.getComponents()[0];
        assertInstanceOf(editorComponent, GuiEditor.class);
        assertFalse(editorComponent.isVisible());
        dumbService.setDumb(false);
        assertTrue(editorComponent.isVisible());
    } finally {
        dumbService.setDumb(false);
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) FileEditor(com.intellij.openapi.fileEditor.FileEditor) DumbServiceImpl(com.intellij.openapi.project.DumbServiceImpl) FileEditorManagerEx(com.intellij.openapi.fileEditor.ex.FileEditorManagerEx)

Example 37 with FileEditorManagerEx

use of com.intellij.openapi.fileEditor.ex.FileEditorManagerEx in project intellij-community by JetBrains.

the class CCRenameHandler method invoke.

@Override
public void invoke(@NotNull Project project, Editor editor, PsiFile file, DataContext dataContext) {
    PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(dataContext);
    assert element != null;
    PsiDirectory directory = (PsiDirectory) element;
    Course course = StudyTaskManager.getInstance(project).getCourse();
    if (course == null) {
        return;
    }
    rename(project, course, directory);
    ProjectView.getInstance(project).refresh();
    FileEditorManagerEx managerEx = FileEditorManagerEx.getInstanceEx(project);
    for (VirtualFile virtualFile : managerEx.getOpenFiles()) {
        managerEx.updateFilePresentation(virtualFile);
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) PsiDirectory(com.intellij.psi.PsiDirectory) Course(com.jetbrains.edu.learning.courseFormat.Course) PsiElement(com.intellij.psi.PsiElement) FileEditorManagerEx(com.intellij.openapi.fileEditor.ex.FileEditorManagerEx)

Aggregations

FileEditorManagerEx (com.intellij.openapi.fileEditor.ex.FileEditorManagerEx)37 EditorWindow (com.intellij.openapi.fileEditor.impl.EditorWindow)19 Project (com.intellij.openapi.project.Project)18 VirtualFile (com.intellij.openapi.vfs.VirtualFile)16 FileEditor (com.intellij.openapi.fileEditor.FileEditor)5 CommandProcessor (com.intellij.openapi.command.CommandProcessor)4 ToolWindowManager (com.intellij.openapi.wm.ToolWindowManager)3 NotNull (org.jetbrains.annotations.NotNull)3 Presentation (com.intellij.openapi.actionSystem.Presentation)2 Document (com.intellij.openapi.editor.Document)2 Editor (com.intellij.openapi.editor.Editor)2 TextEditor (com.intellij.openapi.fileEditor.TextEditor)2 Pair (com.intellij.openapi.util.Pair)2 EditorBoundHighlightingPass (com.intellij.codeHighlighting.EditorBoundHighlightingPass)1 HighlightingPass (com.intellij.codeHighlighting.HighlightingPass)1 TextEditorHighlightingPass (com.intellij.codeHighlighting.TextEditorHighlightingPass)1 AllIcons (com.intellij.icons.AllIcons)1 GeneralSettings (com.intellij.ide.GeneralSettings)1 IdeEventQueue (com.intellij.ide.IdeEventQueue)1 CloseAction (com.intellij.ide.actions.CloseAction)1