Java Code Examples for com.intellij.openapi.editor.colors.EditorColorsScheme#setColor()

The following examples show how to use com.intellij.openapi.editor.colors.EditorColorsScheme#setColor() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NewClassDialog.java    From json2java4idea with Apache License 2.0 6 votes vote down vote up
private void createUIComponents() {
    final EditorFactory editorFactory = EditorFactory.getInstance();
    jsonDocument = editorFactory.createDocument(EMPTY_TEXT);
    jsonEditor = editorFactory.createEditor(jsonDocument, project, JsonFileType.INSTANCE, false);

    final EditorSettings settings = jsonEditor.getSettings();
    settings.setWhitespacesShown(true);
    settings.setLineMarkerAreaShown(false);
    settings.setIndentGuidesShown(false);
    settings.setLineNumbersShown(true);
    settings.setFoldingOutlineShown(false);
    settings.setRightMarginShown(false);
    settings.setVirtualSpace(false);
    settings.setWheelFontChangeEnabled(false);
    settings.setUseSoftWraps(false);
    settings.setAdditionalColumnsCount(0);
    settings.setAdditionalLinesCount(1);

    final EditorColorsScheme colorsScheme = jsonEditor.getColorsScheme();
    colorsScheme.setColor(EditorColors.CARET_ROW_COLOR, null);

    jsonEditor.getContentComponent().setFocusable(true);
    jsonPanel = (JPanel) jsonEditor.getComponent();
}
 
Example 2
Source File: Utils.java    From idea-gitignore with MIT License 6 votes vote down vote up
/**
 * Creates and configures template preview editor.
 *
 * @param document virtual editor document
 * @param project  current project
 * @return editor
 */
@NotNull
public static Editor createPreviewEditor(@NotNull Document document, @Nullable Project project, boolean isViewer) {
    EditorEx editor = (EditorEx) EditorFactory.getInstance().createEditor(document, project,
            IgnoreFileType.INSTANCE, isViewer);
    editor.setCaretEnabled(!isViewer);

    final EditorSettings settings = editor.getSettings();
    settings.setLineNumbersShown(false);
    settings.setAdditionalColumnsCount(1);
    settings.setAdditionalLinesCount(0);
    settings.setRightMarginShown(false);
    settings.setFoldingOutlineShown(false);
    settings.setLineMarkerAreaShown(false);
    settings.setIndentGuidesShown(false);
    settings.setVirtualSpace(false);
    settings.setWheelFontChangeEnabled(false);

    EditorColorsScheme colorsScheme = editor.getColorsScheme();
    colorsScheme.setColor(EditorColors.CARET_ROW_COLOR, null);

    return editor;
}
 
Example 3
Source File: TemplateEditorUtil.java    From consulo with Apache License 2.0 6 votes vote down vote up
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));

  EditorSettings editorSettings = editor.getSettings();
  editorSettings.setVirtualSpace(false);
  editorSettings.setLineMarkerAreaShown(false);
  editorSettings.setIndentGuidesShown(false);
  editorSettings.setLineNumbersShown(false);
  editorSettings.setFoldingOutlineShown(false);

  EditorColorsScheme scheme = editor.getColorsScheme();
  scheme.setColor(EditorColors.CARET_ROW_COLOR, null);

  VirtualFile file = FileDocumentManager.getInstance().getFile(document);
  if (file != null) {
    EditorHighlighter highlighter = EditorHighlighterFactory.getInstance().createEditorHighlighter(file, scheme, project);
    ((EditorEx) editor).setHighlighter(highlighter);
  }

  return editor;
}
 
Example 4
Source File: QueryPanel.java    From nosql4idea with Apache License 2.0 4 votes vote down vote up
private void attachHighlighter(final EditorEx editor) {
    EditorColorsScheme scheme = editor.getColorsScheme();
    scheme.setColor(EditorColors.CARET_ROW_COLOR, null);
    editor.setHighlighter(createHighlighter(scheme));
}
 
Example 5
Source File: ColorAndFontOptions.java    From consulo with Apache License 2.0 4 votes vote down vote up
public void apply(EditorColorsScheme scheme) {
  if (scheme == null) scheme = myScheme;
  scheme.setColor(myKey, myColor);
}