Java Code Examples for com.intellij.openapi.editor.Editor#getSettings()

The following examples show how to use com.intellij.openapi.editor.Editor#getSettings() . 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: TemplateConfigurable.java    From android-codegenerator-plugin-intellij with Apache License 2.0 6 votes vote down vote up
private Editor createEditorInPanel(String string) {
    EditorFactory editorFactory = EditorFactory.getInstance();
    Editor editor = editorFactory.createEditor(editorFactory.createDocument(string));

    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);

    editor.getDocument().addDocumentListener(new DocumentAdapter() {
        @Override
        public void documentChanged(DocumentEvent e) {
            onTextChanged();
        }
    });

    ((EditorEx) editor).setHighlighter(getEditorHighlighter());

    addEditorToPanel(editor);

    return editor;
}
 
Example 2
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 3
Source File: AnalyzeStacktraceUtil.java    From consulo with Apache License 2.0 6 votes vote down vote up
public static StacktraceEditorPanel createEditorPanel(Project project, @Nonnull 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(new Dimension(600, 400));
  Disposer.register(parentDisposable, editorPanel);
  return editorPanel;
}
 
Example 4
Source File: TemplateEditorUI.java    From CodeGen with MIT License 5 votes vote down vote up
/**
 * 创建编辑器
 */
private Editor createEditor(String template, String extension) {
    Document velocityTemplate = factory.createDocument(template);
    Editor editor = factory.createEditor(velocityTemplate,
            null, FileProviderFactory.getFileType(extension), false);

    EditorSettings editorSettings = editor.getSettings();
    editorSettings.setLineNumbersShown(true);
    return editor;
}
 
Example 5
Source File: AbstractToggleUseSoftWrapsAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void update(@Nonnull AnActionEvent e) {
  if (myGlobal) {
    Editor editor = getEditor(e);
    if (editor != null) {
      EditorSettings settings = editor.getSettings();
      if (settings instanceof SettingsImpl && ((SettingsImpl)settings).getSoftWrapAppliancePlace() != myAppliancePlace) {
        e.getPresentation().setEnabledAndVisible(false);
        return;
      }
    }
  }
  super.update(e);
}
 
Example 6
Source File: CopyrightConfigurable.java    From consulo with Apache License 2.0 5 votes vote down vote up
static void setupEditor(Editor editor) {
  EditorSettings settings = editor.getSettings();
  settings.setLineNumbersShown(false);
  settings.setFoldingOutlineShown(false);
  settings.setIndentGuidesShown(false);
  settings.setLineMarkerAreaShown(false);
}