Search in sources :

Example 26 with TextEditor

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

the class RunIdeConsoleAction method configureConsole.

public static void configureConsole(@NotNull VirtualFile file, @NotNull FileEditorManager source) {
    MyRunAction runAction = new MyRunAction();
    for (FileEditor fileEditor : source.getEditors(file)) {
        if (!(fileEditor instanceof TextEditor))
            continue;
        Editor editor = ((TextEditor) fileEditor).getEditor();
        runAction.registerCustomShortcutSet(CommonShortcuts.CTRL_ENTER, editor.getComponent());
    }
}
Also used : FileEditor(com.intellij.openapi.fileEditor.FileEditor) TextEditor(com.intellij.openapi.fileEditor.TextEditor) TextEditor(com.intellij.openapi.fileEditor.TextEditor) Editor(com.intellij.openapi.editor.Editor) FileEditor(com.intellij.openapi.fileEditor.FileEditor)

Example 27 with TextEditor

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

the class FindManagerImpl method findNextUsageInFile.

private boolean findNextUsageInFile(@NotNull FileEditor fileEditor, @NotNull SearchResults.Direction direction) {
    if (fileEditor instanceof TextEditor) {
        TextEditor textEditor = (TextEditor) fileEditor;
        Editor editor = textEditor.getEditor();
        editor.getCaretModel().removeSecondaryCarets();
        if (tryToFindNextUsageViaEditorSearchComponent(editor, direction)) {
            return true;
        }
        RangeHighlighter[] highlighters = ((HighlightManagerImpl) HighlightManager.getInstance(myProject)).getHighlighters(editor);
        if (highlighters.length > 0) {
            return highlightNextHighlighter(highlighters, editor, editor.getCaretModel().getOffset(), direction == SearchResults.Direction.DOWN, false);
        }
    }
    if (direction == SearchResults.Direction.DOWN) {
        return myFindUsagesManager.findNextUsageInFile(fileEditor);
    }
    return myFindUsagesManager.findPreviousUsageInFile(fileEditor);
}
Also used : RangeHighlighter(com.intellij.openapi.editor.markup.RangeHighlighter) TextEditor(com.intellij.openapi.fileEditor.TextEditor) TextEditor(com.intellij.openapi.fileEditor.TextEditor) FileEditor(com.intellij.openapi.fileEditor.FileEditor) HighlightManagerImpl(com.intellij.codeInsight.highlighting.HighlightManagerImpl)

Example 28 with TextEditor

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

the class FindManagerImpl method findUsagesInEditor.

@Override
public void findUsagesInEditor(@NotNull PsiElement element, @NotNull FileEditor fileEditor) {
    if (fileEditor instanceof TextEditor) {
        TextEditor textEditor = (TextEditor) fileEditor;
        Editor editor = textEditor.getEditor();
        Document document = editor.getDocument();
        PsiFile psiFile = PsiDocumentManager.getInstance(myProject).getPsiFile(document);
        myFindUsagesManager.findUsages(element, psiFile, fileEditor, false, null);
    }
}
Also used : TextEditor(com.intellij.openapi.fileEditor.TextEditor) TextEditor(com.intellij.openapi.fileEditor.TextEditor) FileEditor(com.intellij.openapi.fileEditor.FileEditor)

Example 29 with TextEditor

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

the class IntentionWrapper method applyFix.

@Override
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
    VirtualFile virtualFile = myFile.getVirtualFile();
    if (virtualFile != null) {
        FileEditor editor = FileEditorManager.getInstance(project).getSelectedEditor(virtualFile);
        myAction.invoke(project, editor instanceof TextEditor ? ((TextEditor) editor).getEditor() : null, myFile);
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) FileEditor(com.intellij.openapi.fileEditor.FileEditor) TextEditor(com.intellij.openapi.fileEditor.TextEditor)

Example 30 with TextEditor

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

the class EditorOptionsPanel method clearAllIdentifierHighlighters.

private static void clearAllIdentifierHighlighters() {
    for (Project project : ProjectManager.getInstance().getOpenProjects()) {
        for (FileEditor fileEditor : FileEditorManager.getInstance(project).getAllEditors()) {
            if (fileEditor instanceof TextEditor) {
                Document document = ((TextEditor) fileEditor).getEditor().getDocument();
                IdentifierHighlighterPass.clearMyHighlights(document, project);
            }
        }
    }
}
Also used : Project(com.intellij.openapi.project.Project) FileEditor(com.intellij.openapi.fileEditor.FileEditor) TextEditor(com.intellij.openapi.fileEditor.TextEditor) Document(com.intellij.openapi.editor.Document)

Aggregations

TextEditor (com.intellij.openapi.fileEditor.TextEditor)81 FileEditor (com.intellij.openapi.fileEditor.FileEditor)57 Editor (com.intellij.openapi.editor.Editor)32 VirtualFile (com.intellij.openapi.vfs.VirtualFile)28 Project (com.intellij.openapi.project.Project)21 Document (com.intellij.openapi.editor.Document)14 FileEditorManager (com.intellij.openapi.fileEditor.FileEditorManager)13 Nullable (org.jetbrains.annotations.Nullable)13 PsiFile (com.intellij.psi.PsiFile)11 ProcessCanceledException (com.intellij.openapi.progress.ProcessCanceledException)6 NotNull (org.jetbrains.annotations.NotNull)6 Disposable (com.intellij.openapi.Disposable)3 EditorEx (com.intellij.openapi.editor.ex.EditorEx)3 EditorNotificationPanel (com.intellij.ui.EditorNotificationPanel)3 LightweightHint (com.intellij.ui.LightweightHint)3 NonNls (org.jetbrains.annotations.NonNls)3 HighlightingPass (com.intellij.codeHighlighting.HighlightingPass)2 TextEditorHighlightingPass (com.intellij.codeHighlighting.TextEditorHighlightingPass)2 TemplateBuilder (com.intellij.codeInsight.template.TemplateBuilder)2 UndoManager (com.intellij.openapi.command.undo.UndoManager)2