Search in sources :

Example 6 with EditorSettings

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

the class TemplateEditorUtil method createEditor.

private static Editor createEditor(boolean isReadOnly, final Document document, final Project project) {
    EditorFactory editorFactory = EditorFactory.getInstance();
    Editor editor = (isReadOnly ? editorFactory.createViewer(document, project) : editorFactory.createEditor(document, project));
    editor.getContentComponent().setFocusable(!isReadOnly);
    EditorSettings editorSettings = editor.getSettings();
    editorSettings.setVirtualSpace(false);
    editorSettings.setLineMarkerAreaShown(false);
    editorSettings.setIndentGuidesShown(false);
    editorSettings.setLineNumbersShown(false);
    editorSettings.setFoldingOutlineShown(false);
    editorSettings.setCaretRowShown(false);
    EditorColorsScheme scheme = editor.getColorsScheme();
    VirtualFile file = FileDocumentManager.getInstance().getFile(document);
    if (file != null) {
        EditorHighlighter highlighter = EditorHighlighterFactory.getInstance().createEditorHighlighter(file, scheme, project);
        ((EditorEx) editor).setHighlighter(highlighter);
    }
    return editor;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) EditorFactory(com.intellij.openapi.editor.EditorFactory) EditorSettings(com.intellij.openapi.editor.EditorSettings) EditorEx(com.intellij.openapi.editor.ex.EditorEx) EditorColorsScheme(com.intellij.openapi.editor.colors.EditorColorsScheme) Editor(com.intellij.openapi.editor.Editor) LayeredLexerEditorHighlighter(com.intellij.openapi.editor.ex.util.LayeredLexerEditorHighlighter) EditorHighlighter(com.intellij.openapi.editor.highlighter.EditorHighlighter)

Example 7 with EditorSettings

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

the class FileTemplateConfigurable method createEditor.

private Editor createEditor() {
    EditorFactory editorFactory = EditorFactory.getInstance();
    Document doc = myFile == null ? editorFactory.createDocument(myTemplate == null ? "" : myTemplate.getText()) : PsiDocumentManager.getInstance(myFile.getProject()).getDocument(myFile);
    assert doc != null;
    Editor editor = editorFactory.createEditor(doc, myProject);
    EditorSettings editorSettings = editor.getSettings();
    editorSettings.setVirtualSpace(false);
    editorSettings.setLineMarkerAreaShown(false);
    editorSettings.setIndentGuidesShown(false);
    editorSettings.setLineNumbersShown(false);
    editorSettings.setFoldingOutlineShown(false);
    editorSettings.setAdditionalColumnsCount(3);
    editorSettings.setAdditionalLinesCount(3);
    editorSettings.setCaretRowShown(false);
    editor.getDocument().addDocumentListener(new DocumentAdapter() {

        @Override
        public void documentChanged(DocumentEvent e) {
            onTextChanged();
        }
    });
    ((EditorEx) editor).setHighlighter(createHighlighter());
    JPanel topPanel = new JPanel(new BorderLayout());
    JPanel southPanel = new JPanel(new HorizontalLayout(40));
    southPanel.add(myAdjustBox);
    southPanel.add(myLiveTemplateBox);
    topPanel.add(southPanel, BorderLayout.SOUTH);
    topPanel.add(editor.getComponent(), BorderLayout.CENTER);
    mySplitter.setFirstComponent(topPanel);
    return editor;
}
Also used : EditorFactory(com.intellij.openapi.editor.EditorFactory) EditorSettings(com.intellij.openapi.editor.EditorSettings) EditorEx(com.intellij.openapi.editor.ex.EditorEx) DocumentAdapter(com.intellij.openapi.editor.event.DocumentAdapter) Document(com.intellij.openapi.editor.Document) Editor(com.intellij.openapi.editor.Editor) DocumentEvent(com.intellij.openapi.editor.event.DocumentEvent) HorizontalLayout(com.intellij.ui.components.panels.HorizontalLayout)

Example 8 with EditorSettings

use of com.intellij.openapi.editor.EditorSettings 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 9 with EditorSettings

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

the class EditorActionTest method testDownWithSelectionWhenCaretsAreAllowedInsideTabs.

public void testDownWithSelectionWhenCaretsAreAllowedInsideTabs() throws Exception {
    init("<caret>text", TestFileType.TEXT);
    final EditorSettings editorSettings = myEditor.getSettings();
    final boolean old = editorSettings.isCaretInsideTabs();
    try {
        editorSettings.setCaretInsideTabs(true);
        executeAction("EditorDownWithSelection");
        checkResultByText("<selection>text<caret></selection>");
    } finally {
        editorSettings.setCaretInsideTabs(old);
    }
}
Also used : EditorSettings(com.intellij.openapi.editor.EditorSettings)

Example 10 with EditorSettings

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

the class IpnbEditorUtil method setupEditor.

private static void setupEditor(@NotNull final EditorEx editor) {
    editor.setBackgroundColor(getEditablePanelBackground());
    noScrolling(editor);
    editor.getScrollPane().setBorder(null);
    final EditorSettings editorSettings = editor.getSettings();
    editorSettings.setLineMarkerAreaShown(false);
    editorSettings.setIndentGuidesShown(false);
    editorSettings.setLineNumbersShown(false);
    editorSettings.setFoldingOutlineShown(false);
    editorSettings.setAdditionalPageAtBottom(false);
    editorSettings.setAdditionalColumnsCount(0);
    editorSettings.setAdditionalLinesCount(0);
    editorSettings.setRightMarginShown(false);
}
Also used : EditorSettings(com.intellij.openapi.editor.EditorSettings)

Aggregations

EditorSettings (com.intellij.openapi.editor.EditorSettings)11 Editor (com.intellij.openapi.editor.Editor)6 EditorEx (com.intellij.openapi.editor.ex.EditorEx)6 Document (com.intellij.openapi.editor.Document)5 EditorFactory (com.intellij.openapi.editor.EditorFactory)4 EditorColorsScheme (com.intellij.openapi.editor.colors.EditorColorsScheme)2 NotNull (org.jetbrains.annotations.NotNull)2 CvsConfigurationsListEditor (com.intellij.cvsSupport2.config.ui.CvsConfigurationsListEditor)1 Disposable (com.intellij.openapi.Disposable)1 DocumentAdapter (com.intellij.openapi.editor.event.DocumentAdapter)1 DocumentEvent (com.intellij.openapi.editor.event.DocumentEvent)1 LayeredLexerEditorHighlighter (com.intellij.openapi.editor.ex.util.LayeredLexerEditorHighlighter)1 EditorHighlighter (com.intellij.openapi.editor.highlighter.EditorHighlighter)1 DocumentImpl (com.intellij.openapi.editor.impl.DocumentImpl)1 EditorFactoryImpl (com.intellij.openapi.editor.impl.EditorFactoryImpl)1 FileType (com.intellij.openapi.fileTypes.FileType)1 Project (com.intellij.openapi.project.Project)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 PsiManagerEx (com.intellij.psi.impl.PsiManagerEx)1 FileManager (com.intellij.psi.impl.file.impl.FileManager)1