Search in sources :

Example 1 with EditorSettings

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

the class StudyToolWindow method enterEditingMode.

public void enterEditingMode(VirtualFile taskFile, Project project) {
    final EditorFactory factory = EditorFactory.getInstance();
    Document document = FileDocumentManager.getInstance().getDocument(taskFile);
    if (document == null) {
        return;
    }
    WebBrowserManager.getInstance().setShowBrowserHover(false);
    final EditorEx createdEditor = (EditorEx) factory.createEditor(document, project, taskFile, false);
    Disposer.register(project, new Disposable() {

        public void dispose() {
            factory.releaseEditor(createdEditor);
        }
    });
    JComponent editorComponent = createdEditor.getComponent();
    editorComponent.setBorder(new EmptyBorder(10, 20, 0, 10));
    editorComponent.setBackground(EditorColorsManager.getInstance().getGlobalScheme().getDefaultBackground());
    EditorSettings editorSettings = createdEditor.getSettings();
    editorSettings.setLineMarkerAreaShown(false);
    editorSettings.setLineNumbersShown(false);
    editorSettings.setFoldingOutlineShown(false);
    mySplitPane.setFirstComponent(editorComponent);
    mySplitPane.repaint();
    StudyTaskManager.getInstance(project).setToolWindowMode(StudyToolWindowMode.EDITING);
}
Also used : Disposable(com.intellij.openapi.Disposable) EditorFactory(com.intellij.openapi.editor.EditorFactory) EditorSettings(com.intellij.openapi.editor.EditorSettings) EditorEx(com.intellij.openapi.editor.ex.EditorEx) Document(com.intellij.openapi.editor.Document) EmptyBorder(javax.swing.border.EmptyBorder)

Example 2 with EditorSettings

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

the class EditVarConstraintsDialog method createEditor.

private static Editor createEditor(final Project project, final String text, final String fileName) {
    final FileType fileType = getFileType(fileName);
    final Document doc = createDocument(fileName, fileType, text);
    final Editor editor = EditorFactory.getInstance().createEditor(doc, project);
    ((EditorEx) editor).setEmbeddedIntoDialogWrapper(true);
    final EditorSettings settings = editor.getSettings();
    settings.setLineNumbersShown(false);
    settings.setFoldingOutlineShown(false);
    settings.setRightMarginShown(false);
    settings.setLineMarkerAreaShown(false);
    settings.setIndentGuidesShown(false);
    ((EditorEx) editor).setHighlighter(HighlighterFactory.createHighlighter(fileType, DefaultColorSchemesManager.getInstance().getFirstScheme(), project));
    return editor;
}
Also used : EditorSettings(com.intellij.openapi.editor.EditorSettings) EditorEx(com.intellij.openapi.editor.ex.EditorEx) FileType(com.intellij.openapi.fileTypes.FileType) Document(com.intellij.openapi.editor.Document) Editor(com.intellij.openapi.editor.Editor)

Example 3 with EditorSettings

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

the class UIUtil method createEditor.

@NotNull
public static Editor createEditor(@NotNull Document doc, final Project project, boolean editable, boolean addToolTipForVariableHandler, @Nullable TemplateContextType contextType) {
    final Editor editor = editable ? EditorFactory.getInstance().createEditor(doc, project) : EditorFactory.getInstance().createViewer(doc, project);
    EditorSettings editorSettings = editor.getSettings();
    editorSettings.setVirtualSpace(false);
    editorSettings.setLineMarkerAreaShown(false);
    editorSettings.setIndentGuidesShown(false);
    editorSettings.setLineNumbersShown(false);
    editorSettings.setFoldingOutlineShown(false);
    editorSettings.setCaretRowShown(false);
    if (!editable) {
        final EditorColorsScheme globalScheme = EditorColorsManager.getInstance().getGlobalScheme();
        Color c = globalScheme.getColor(EditorColors.READONLY_BACKGROUND_COLOR);
        if (c == null) {
            c = globalScheme.getDefaultBackground();
        }
        ((EditorEx) editor).setBackgroundColor(c);
    } else {
        ((EditorEx) editor).setEmbeddedIntoDialogWrapper(true);
    }
    TemplateEditorUtil.setHighlighter(editor, contextType);
    if (addToolTipForVariableHandler) {
        SubstitutionShortInfoHandler handler = new SubstitutionShortInfoHandler(editor);
        editor.addEditorMouseMotionListener(handler);
        editor.getDocument().addDocumentListener(handler);
        editor.getCaretModel().addCaretListener(handler);
        editor.putUserData(LISTENER_KEY, handler);
    }
    return editor;
}
Also used : 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) NotNull(org.jetbrains.annotations.NotNull)

Example 4 with EditorSettings

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

the class CvsTabbedWindow method createOutputEditor.

@NotNull
private static Editor createOutputEditor(Project project) {
    final Editor result = EditorFactory.getInstance().createViewer(EditorFactory.getInstance().createDocument(""), project);
    final EditorSettings editorSettings = result.getSettings();
    editorSettings.setLineMarkerAreaShown(false);
    editorSettings.setLineNumbersShown(false);
    editorSettings.setIndentGuidesShown(false);
    editorSettings.setFoldingOutlineShown(false);
    return result;
}
Also used : EditorSettings(com.intellij.openapi.editor.EditorSettings) Editor(com.intellij.openapi.editor.Editor) CvsConfigurationsListEditor(com.intellij.cvsSupport2.config.ui.CvsConfigurationsListEditor) NotNull(org.jetbrains.annotations.NotNull)

Example 5 with EditorSettings

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

the class EditorActionTest method testPageDownWithSelectionWhenCaretsAreAllowedInsideTabs.

public void testPageDownWithSelectionWhenCaretsAreAllowedInsideTabs() throws Exception {
    init("<caret>line 1\n" + "line 2", TestFileType.TEXT);
    setEditorVisibleSize(100, 100);
    final EditorSettings editorSettings = myEditor.getSettings();
    final boolean old = editorSettings.isCaretInsideTabs();
    try {
        editorSettings.setCaretInsideTabs(true);
        executeAction("EditorPageDownWithSelection");
        checkResultByText("<selection>line 1\n" + "line 2<caret></selection>");
    } finally {
        editorSettings.setCaretInsideTabs(old);
    }
}
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