Search in sources :

Example 11 with EditorFactory

use of com.intellij.openapi.editor.EditorFactory in project intellij-community by JetBrains.

the class CallerChooserBase method createEditor.

private Editor createEditor() {
    final EditorFactory editorFactory = EditorFactory.getInstance();
    final Document document = editorFactory.createDocument("");
    final Editor editor = editorFactory.createViewer(document, myProject);
    ((EditorEx) editor).setHighlighter(HighlighterFactory.createHighlighter(myProject, myFileName));
    return editor;
}
Also used : EditorFactory(com.intellij.openapi.editor.EditorFactory) EditorEx(com.intellij.openapi.editor.ex.EditorEx) Document(com.intellij.openapi.editor.Document) Editor(com.intellij.openapi.editor.Editor)

Example 12 with EditorFactory

use of com.intellij.openapi.editor.EditorFactory in project intellij-community by JetBrains.

the class QuickDocOnMouseOverManager method setEnabled.

/**
   * Instructs the manager to enable or disable 'show quick doc automatically when the mouse goes over an editor element' mode.
   *
   * @param enabled  flag that identifies if quick doc should be automatically shown
   */
public void setEnabled(boolean enabled) {
    myEnabled = enabled;
    myApplicationActive = enabled;
    if (!enabled) {
        closeQuickDocIfPossible();
        myAlarm.cancelAllRequests();
    }
    EditorFactory factory = EditorFactory.getInstance();
    if (factory == null) {
        return;
    }
    for (Editor editor : factory.getAllEditors()) {
        if (enabled) {
            registerListeners(editor);
        } else {
            unRegisterListeners(editor);
        }
    }
}
Also used : EditorFactory(com.intellij.openapi.editor.EditorFactory) Editor(com.intellij.openapi.editor.Editor)

Example 13 with EditorFactory

use of com.intellij.openapi.editor.EditorFactory in project intellij-community by JetBrains.

the class AnalyzeStacktraceUtil method createEditorPanel.

public static StacktraceEditorPanel createEditorPanel(Project project, @NotNull Disposable parentDisposable) {
    EditorFactory editorFactory = EditorFactory.getInstance();
    Document document = editorFactory.createDocument("");
    Editor editor = editorFactory.createEditor(document, project);
    EditorSettings settings = editor.getSettings();
    settings.setFoldingOutlineShown(false);
    settings.setLineMarkerAreaShown(false);
    settings.setIndentGuidesShown(false);
    settings.setLineNumbersShown(false);
    settings.setRightMarginShown(false);
    StacktraceEditorPanel editorPanel = new StacktraceEditorPanel(project, editor);
    editorPanel.setPreferredSize(JBUI.size(600, 400));
    Disposer.register(parentDisposable, editorPanel);
    return editorPanel;
}
Also used : EditorFactory(com.intellij.openapi.editor.EditorFactory) EditorSettings(com.intellij.openapi.editor.EditorSettings) Document(com.intellij.openapi.editor.Document) Editor(com.intellij.openapi.editor.Editor)

Example 14 with EditorFactory

use of com.intellij.openapi.editor.EditorFactory in project intellij-plugins by JetBrains.

the class MarkdownCssSettingsForm method createEditor.

@NotNull
private static Editor createEditor() {
    EditorFactory editorFactory = EditorFactory.getInstance();
    Document editorDocument = editorFactory.createDocument("");
    EditorEx editor = (EditorEx) editorFactory.createEditor(editorDocument);
    fillEditorSettings(editor.getSettings());
    setHighlighting(editor);
    return editor;
}
Also used : EditorFactory(com.intellij.openapi.editor.EditorFactory) EditorEx(com.intellij.openapi.editor.ex.EditorEx) Document(com.intellij.openapi.editor.Document) NotNull(org.jetbrains.annotations.NotNull)

Example 15 with EditorFactory

use of com.intellij.openapi.editor.EditorFactory in project intellij-community by JetBrains.

the class DiffUtil method createEditor.

public static EditorEx createEditor(Document document, Project project, boolean isViewer, @Nullable FileType fileType) {
    EditorFactory factory = EditorFactory.getInstance();
    EditorEx editor = (EditorEx) (isViewer ? factory.createViewer(document, project) : factory.createEditor(document, project));
    editor.putUserData(DiffManagerImpl.EDITOR_IS_DIFF_KEY, Boolean.TRUE);
    editor.getGutterComponentEx().revalidateMarkup();
    if (fileType != null && project != null && !project.isDisposed()) {
        CodeStyleFacade codeStyleFacade = CodeStyleFacade.getInstance(project);
        editor.getSettings().setTabSize(codeStyleFacade.getTabSize(fileType));
        editor.getSettings().setUseTabCharacter(codeStyleFacade.useTabCharacter(fileType));
    }
    return editor;
}
Also used : CodeStyleFacade(com.intellij.codeStyle.CodeStyleFacade) EditorFactory(com.intellij.openapi.editor.EditorFactory) EditorEx(com.intellij.openapi.editor.ex.EditorEx)

Aggregations

EditorFactory (com.intellij.openapi.editor.EditorFactory)21 Document (com.intellij.openapi.editor.Document)15 EditorEx (com.intellij.openapi.editor.ex.EditorEx)11 Editor (com.intellij.openapi.editor.Editor)10 Disposable (com.intellij.openapi.Disposable)5 EditorSettings (com.intellij.openapi.editor.EditorSettings)4 VirtualFile (com.intellij.openapi.vfs.VirtualFile)4 NotNull (org.jetbrains.annotations.NotNull)3 DocumentEvent (com.intellij.openapi.editor.event.DocumentEvent)2 EmptyBorder (javax.swing.border.EmptyBorder)2 CodeStyleFacade (com.intellij.codeStyle.CodeStyleFacade)1 CommanderPanel (com.intellij.ide.commander.CommanderPanel)1 XmlFileHighlighter (com.intellij.ide.highlighter.XmlFileHighlighter)1 StartupManagerImpl (com.intellij.ide.startup.impl.StartupManagerImpl)1 StructureViewBuilder (com.intellij.ide.structureView.StructureViewBuilder)1 StructureViewModel (com.intellij.ide.structureView.StructureViewModel)1 TreeBasedStructureViewBuilder (com.intellij.ide.structureView.TreeBasedStructureViewBuilder)1 FileStructureDialog (com.intellij.ide.util.FileStructureDialog)1 com.intellij.lang (com.intellij.lang)1 Language (com.intellij.lang.Language)1