Java 类com.intellij.openapi.editor.EditorSettings 实例源码

项目:json2java4idea    文件:SettingsPanel.java   
private void createUIComponents() {
    final EditorFactory editorFactory = EditorFactory.getInstance();
    previewDocument = editorFactory.createDocument(EMPTY_TEXT);
    previewEditor = editorFactory.createEditor(previewDocument, null, JavaFileType.INSTANCE, true);

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

    previewPanel = (JPanel) previewEditor.getComponent();
    previewPanel.setName(PREVIEW_PANEL_NAME);
    previewPanel.setPreferredSize(new Dimension(PREFERRED_PREVIEW_WIDTH, PREFERRED_PREVIEW_HEIGHT));
}
项目:json2java4idea    文件:NewClassDialog.java   
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();
}
项目:ApiDebugger    文件:ResponseBodyWidget.java   
private Editor createEditor() {
    PsiFile myFile = null;
    EditorFactory editorFactory = EditorFactory.getInstance();
    Document doc = myFile == null
            ? editorFactory.createDocument("")
            : PsiDocumentManager.getInstance(mProject).getDocument(myFile);
    Editor editor = editorFactory.createEditor(doc, mProject);
    EditorSettings editorSettings = editor.getSettings();
    editorSettings.setVirtualSpace(false);
    editorSettings.setLineMarkerAreaShown(false);
    editorSettings.setIndentGuidesShown(false);
    editorSettings.setFoldingOutlineShown(true);
    editorSettings.setAdditionalColumnsCount(3);
    editorSettings.setAdditionalLinesCount(3);
    editorSettings.setLineNumbersShown(true);
    editorSettings.setCaretRowShown(true);

    editor.getDocument().addDocumentListener(new DocumentAdapter() {
        @Override
        public void documentChanged(DocumentEvent e) {
        }
    });
    ((EditorEx) editor).setHighlighter(createHighlighter(FileTypes.PLAIN_TEXT));
    return editor;
}
项目:intellij-ce-playground    文件:ExportToFileUtil.java   
protected JComponent createCenterPanel() {
  final Document document = ((EditorFactoryImpl)EditorFactory.getInstance()).createDocument(true);
  ((DocumentImpl)document).setAcceptSlashR(true);

  myTextArea = EditorFactory.getInstance().createEditor(document, myProject, FileTypes.PLAIN_TEXT, true);
  final EditorSettings settings = myTextArea.getSettings();
  settings.setLineNumbersShown(false);
  settings.setLineMarkerAreaShown(false);
  settings.setFoldingOutlineShown(false);
  settings.setRightMarginShown(false);
  settings.setAdditionalLinesCount(0);
  settings.setAdditionalColumnsCount(0);
  settings.setAdditionalPageAtBottom(false);
  ((EditorEx)myTextArea).setBackgroundColor(UIUtil.getInactiveTextFieldBackgroundColor());
  myTextArea.getComponent().setPreferredSize(new Dimension(700, 400));
  return myTextArea.getComponent();
}
项目:intellij-ce-playground    文件:EditorActionTest.java   
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);
  }
}
项目:intellij-ce-playground    文件:EditVarConstraintsDialog.java   
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;
}
项目:intellij-ce-playground    文件:TemplateEditorUtil.java   
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;
}
项目:intellij-ce-playground    文件:AnalyzeStacktraceUtil.java   
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;
}
项目:intellij-ce-playground    文件:CommandConsole.java   
/**
 * @param module                     module console runs on
 * @param title                      console title
 * @param commandsAndDefaultExecutor List of commands (to be injected into {@link CommandLineFile}) if any
 *                                   and executor to be used when user executes unknown command.
 *                                   Both may be null. Execution is passed to command if command exist, passed to default executor
 *                                   otherwise. With out of commands default executor will always be used.
 *                                   With out of executor, no execution would be possible at all.
 */
private CommandConsole(@NotNull final Module module,
                       @NotNull final String title,
                       @Nullable final Pair<List<Command>, CommandExecutor> commandsAndDefaultExecutor) {
  super(new Helper(module.getProject(), new LightVirtualFile(title, CommandLineLanguage.INSTANCE, "")) {
    @Override
    public void setupEditor(@NotNull EditorEx editor) {
      super.setupEditor(editor);
      // We do not need spaces here, because it leads to PY-15557
      EditorSettings editorSettings = editor.getSettings();
      editorSettings.setAdditionalLinesCount(0);
      editorSettings.setAdditionalColumnsCount(0);
    }
  });
  myCommandsAndDefaultExecutor = commandsAndDefaultExecutor;
  myModule = module;
}
项目:PHPStorm-plugin    文件:EditorDetails.java   
public static String getTabChar()
{
    int indentSpaces = generateTestName.DEFAULT_INDENT_SPACES;
    boolean useTabCharacter = false;

    try {
        Editor editor = EditorIntegration.getEditor();
        EditorSettings settings = editor.getSettings();
        Project project = editor.getProject();

        useTabCharacter = settings.isUseTabCharacter(project);
        indentSpaces = settings.getTabSize(project);

    } catch (Exception e) {
        // will default to using spaces
    }

    if (useTabCharacter) {
        return "\t";
    }

    char[] charArray = new char[indentSpaces];
    Arrays.fill(charArray, ' ');
    return new String(charArray);
}
项目:android-codegenerator-plugin-intellij    文件:TemplateConfigurable.java   
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;
}
项目:tools-idea    文件:ConsoleViewUtil.java   
public static void setupConsoleEditor(final EditorEx editor, final boolean foldingOutlineShown, final boolean lineMarkerAreaShown) {
  ApplicationManager.getApplication().runReadAction(new Runnable() {
    public void run() {
      editor.setSoftWrapAppliancePlace(SoftWrapAppliancePlaces.CONSOLE);

      final EditorSettings editorSettings = editor.getSettings();
      editorSettings.setLineMarkerAreaShown(lineMarkerAreaShown);
      editorSettings.setIndentGuidesShown(false);
      editorSettings.setLineNumbersShown(false);
      editorSettings.setFoldingOutlineShown(foldingOutlineShown);
      editorSettings.setAdditionalPageAtBottom(false);
      editorSettings.setAdditionalColumnsCount(0);
      editorSettings.setAdditionalLinesCount(0);

      editor.putUserData(EDITOR_IS_CONSOLE_VIEW, true);

      final DelegateColorScheme scheme = updateConsoleColorScheme(editor.getColorsScheme());
      editor.setColorsScheme(scheme);
      scheme.setColor(EditorColors.CARET_ROW_COLOR, null);
      scheme.setColor(EditorColors.RIGHT_MARGIN_COLOR, null);
    }
  });
}
项目:tools-idea    文件:ExportToFileUtil.java   
protected JComponent createCenterPanel() {
  final Document document = ((EditorFactoryImpl)EditorFactory.getInstance()).createDocument(true);
  ((DocumentImpl)document).setAcceptSlashR(true);

  myTextArea = EditorFactory.getInstance().createEditor(document, myProject, StdFileTypes.PLAIN_TEXT, true);
  final EditorSettings settings = myTextArea.getSettings();
  settings.setLineNumbersShown(false);
  settings.setLineMarkerAreaShown(false);
  settings.setFoldingOutlineShown(false);
  settings.setRightMarginShown(false);
  settings.setAdditionalLinesCount(0);
  settings.setAdditionalColumnsCount(0);
  settings.setAdditionalPageAtBottom(false);
  ((EditorEx)myTextArea).setBackgroundColor(UIUtil.getInactiveTextFieldBackgroundColor());
  return myTextArea.getComponent();
}
项目:tools-idea    文件:TemplateEditorUtil.java   
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;
}
项目:tools-idea    文件:AnalyzeStacktraceUtil.java   
public static StacktraceEditorPanel createEditorPanel(Project project, @NotNull Disposable parentDisposable) {
  EditorFactory editorFactory = EditorFactory.getInstance();
  Document document = editorFactory.createDocument("");
  Editor editor = editorFactory.createEditor(document);
  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;
}
项目:idea-gitignore    文件:Utils.java   
/**
 * 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;
}
项目:consulo    文件:ExportToFileUtil.java   
@Override
protected JComponent createCenterPanel() {
  final Document document = ((EditorFactoryImpl)EditorFactory.getInstance()).createDocument(true);
  ((DocumentImpl)document).setAcceptSlashR(true);

  myTextArea = EditorFactory.getInstance().createEditor(document, myProject, PlainTextFileType.INSTANCE, true);
  final EditorSettings settings = myTextArea.getSettings();
  settings.setLineNumbersShown(false);
  settings.setLineMarkerAreaShown(false);
  settings.setFoldingOutlineShown(false);
  settings.setRightMarginShown(false);
  settings.setAdditionalLinesCount(0);
  settings.setAdditionalColumnsCount(0);
  settings.setAdditionalPageAtBottom(false);
  ((EditorEx)myTextArea).setBackgroundColor(UIUtil.getInactiveTextFieldBackgroundColor());
  return myTextArea.getComponent();
}
项目:consulo    文件:TemplateEditorUtil.java   
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;
}
项目:consulo    文件:AnalyzeStacktraceUtil.java   
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;
}
项目:CodeGen    文件:TemplateEditorUI.java   
/**
 * 创建编辑器
 *
 * @param template
 * @param extension
 * @return
 */
private Editor createEditor(String template, String extension) {
    template = StringUtils.isEmpty(template) ? "" : template;
    extension = StringUtils.isEmpty(extension) ? "vm" : extension;

    Document velocityTemplate = factory.createDocument(template);
    Editor editor = factory.createEditor(velocityTemplate, null, FileTypeManager.getInstance()
            .getFileTypeByExtension(extension), false);

    EditorSettings editorSettings = editor.getSettings();
    editorSettings.setLineNumbersShown(true);
    return editor;
}
项目:MultiHighlight    文件:ColorPreviewPanel.java   
public ColorPreviewPanel() {
    final EditorFactory editorFactory = EditorFactory.getInstance();
    myEditor = (EditorEx) editorFactory.createViewer(editorFactory.createDocument(""));

    final EditorSettings settings = myEditor.getSettings();
    settings.setLineNumbersShown(true);
    settings.setWhitespacesShown(true);
    settings.setLineMarkerAreaShown(false);
    settings.setIndentGuidesShown(false);
    settings.setFoldingOutlineShown(false);
    settings.setAdditionalColumnsCount(0);
    settings.setAdditionalLinesCount(0);
    settings.setRightMarginShown(true);
    settings.setRightMargin(60);

    /** {@link FontEditorPreview#installTrafficLights(EditorEx)} */
    TrafficLightRenderer renderer = new TrafficLightRenderer(null, null, null) {

        private final DaemonCodeAnalyzerStatus status = new DaemonCodeAnalyzerStatus();

        {
            status.errorAnalyzingFinished = true;
            status.errorCount = new int[]{ 0 };
        }

        @NotNull
        @Override
        protected DaemonCodeAnalyzerStatus getDaemonCodeAnalyzerStatus(
                @NotNull SeverityRegistrar severityRegistrar) {
            return status;
        }
    };

    Disposer.register((Disposable) myEditor.getCaretModel(), renderer);
    EditorMarkupModel markupModel = (EditorMarkupModel) myEditor.getMarkupModel();
    markupModel.setErrorStripeRenderer(renderer);
    markupModel.setErrorStripeVisible(true);
}
项目:intellij-ce-playground    文件:EditorActionTest.java   
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);
  }
}
项目:intellij-ce-playground    文件:ProjectLevelVcsManagerImpl.java   
private Content getOrCreateConsoleContent(final ContentManager contentManager) {
  final String displayName = VcsBundle.message("vcs.console.toolwindow.display.name");
  Content content = contentManager.findContent(displayName);
  if (content == null) {
    releaseEditor();
    final EditorFactory editorFactory = EditorFactory.getInstance();
    final Editor editor = editorFactory.createViewer(editorFactory.createDocument(""), myProject);
    EditorSettings editorSettings = editor.getSettings();
    editorSettings.setLineMarkerAreaShown(false);
    editorSettings.setIndentGuidesShown(false);
    editorSettings.setLineNumbersShown(false);
    editorSettings.setFoldingOutlineShown(false);

    ((EditorEx)editor).getScrollPane().setBorder(null);
    myEditorAdapter = new EditorAdapter(editor, myProject, false);
    final JPanel panel = new JPanel(new BorderLayout());
    panel.add(editor.getComponent(), BorderLayout.CENTER);

    content = ContentFactory.SERVICE.getInstance().createContent(panel, displayName, true);
    contentManager.addContent(content);

    for (Pair<String, TextAttributes> pair : myPendingOutput) {
      myEditorAdapter.appendString(pair.first, pair.second);
    }
    myPendingOutput.clear();
  }
  return content;
}
项目:intellij-ce-playground    文件:ProblematicWhitespaceInspection.java   
@Override
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
  final FileEditorManager editorManager = FileEditorManager.getInstance(project);
  final Editor editor = editorManager.getSelectedTextEditor();
  if (editor == null) {
    return;
  }
  final EditorSettings settings = editor.getSettings();
  settings.setWhitespacesShown(!settings.isWhitespacesShown());
  editor.getComponent().repaint();
}
项目:intellij-ce-playground    文件:IpnbEditorUtil.java   
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);
}
项目:intellij-ce-playground    文件:CvsTabbedWindow.java   
@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;
}
项目:intellij-ce-playground    文件:SvnPropertiesDiffViewer.java   
private SvnPropertiesDiffViewer(@NotNull DiffContext context, @NotNull WrapperRequest request, @NotNull List<DiffChange> diffChanges) {
  super(context, request);
  myWrapperRequest = request;
  myDiffChanges = diffChanges;

  for (EditorEx editor : getEditors()) {
    if (editor == null) continue;
    EditorSettings settings = editor.getSettings();

    settings.setAdditionalLinesCount(0);
    settings.setAdditionalColumnsCount(1);
    settings.setRightMarginShown(false);
    settings.setFoldingOutlineShown(false);
    settings.setLineNumbersShown(false);
    settings.setLineMarkerAreaShown(false);
    settings.setIndentGuidesShown(false);
    settings.setVirtualSpace(false);
    settings.setWheelFontChangeEnabled(false);
    settings.setAdditionalPageAtBottom(false);
    settings.setCaretRowShown(false);
    settings.setUseSoftWraps(false);
    editor.reinitSettings();
  }

  for (DiffChange change : myDiffChanges) {
    DiffDrawUtil.createBorderLineMarker(getEditor(Side.LEFT), change.myEndLine1, SeparatorPlacement.TOP);
    DiffDrawUtil.createBorderLineMarker(getEditor(Side.RIGHT), change.myEndLine2, SeparatorPlacement.TOP);
  }

  DiffSplitter splitter = myContentPanel.getSplitter();
  splitter.setDividerWidth(120);
  splitter.setShowDividerIcon(false);
}
项目:intellij    文件:ProjectViewUi.java   
private static EditorEx createEditor(String tooltip) {
  Project project = getProject();
  LightVirtualFile virtualFile =
      new LightVirtualFile("mockProjectViewFile", ProjectViewLanguage.INSTANCE, "");
  final Document document =
      ((EditorFactoryImpl) EditorFactory.getInstance()).createDocument(true);
  ((DocumentImpl) document).setAcceptSlashR(true);
  FileDocumentManagerImpl.registerDocument(document, virtualFile);

  FileManager fileManager = ((PsiManagerEx) PsiManager.getInstance(project)).getFileManager();
  fileManager.setViewProvider(virtualFile, fileManager.createFileViewProvider(virtualFile, true));

  if (project.isDefault()) {
    // Undo-redo doesn't work with the default project.
    // Explicitly turn it off to avoid error dialogs.
    UndoUtil.disableUndoFor(document);
  }

  EditorEx editor =
      (EditorEx)
          EditorFactory.getInstance()
              .createEditor(document, project, ProjectViewFileType.INSTANCE, false);
  final EditorSettings settings = editor.getSettings();
  settings.setLineNumbersShown(false);
  settings.setLineMarkerAreaShown(false);
  settings.setFoldingOutlineShown(false);
  settings.setRightMarginShown(false);
  settings.setAdditionalPageAtBottom(false);
  editor.getComponent().setMinimumSize(getEditorSize());
  editor.getComponent().setPreferredSize(getEditorSize());
  editor.getComponent().setToolTipText(tooltip);
  editor.getComponent().setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, null);
  editor.getComponent().setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, null);
  return editor;
}
项目:tools-idea    文件:FileTemplateConfigurable.java   
private Editor createEditor() {
  EditorFactory editorFactory = EditorFactory.getInstance();
  Document doc = myFile == null ? editorFactory.createDocument(myTemplate == null ? "" : myTemplate.getText()) : PsiDocumentManager.getInstance(myFile.getProject()).getDocument(myFile);
  Editor editor = myProject == null ? editorFactory.createEditor(doc) : 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);

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

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

  ((EditorEx)editor).setHighlighter(createHighlighter());
  mySplitter.setFirstComponent(editor.getComponent());
  return editor;
}
项目:tools-idea    文件:CvsOperationExecutor.java   
@NotNull private static Editor createView(Project project) {
  EditorFactory editorFactory = EditorFactory.getInstance();
  Document document = editorFactory.createDocument("");
  Editor result = editorFactory.createViewer(document, project);

  EditorSettings editorSettings = result.getSettings();
  editorSettings.setLineMarkerAreaShown(false);
  editorSettings.setLineNumbersShown(false);
  editorSettings.setIndentGuidesShown(false);
  editorSettings.setFoldingOutlineShown(false);
  return result;
}
项目:nosql4idea    文件:QueryPanel.java   
private static void fillEditorSettings(final EditorSettings editorSettings) {
    editorSettings.setWhitespacesShown(true);
    editorSettings.setLineMarkerAreaShown(false);
    editorSettings.setIndentGuidesShown(false);
    editorSettings.setLineNumbersShown(false);
    editorSettings.setAllowSingleLogicalLineFolding(true);
    editorSettings.setAdditionalColumnsCount(0);
    editorSettings.setAdditionalLinesCount(1);
    editorSettings.setUseSoftWraps(true);
    editorSettings.setUseTabCharacter(false);
    editorSettings.setCaretInsideTabs(false);
    editorSettings.setVirtualSpace(false);
}
项目:consulo    文件:AbstractToggleUseSoftWrapsAction.java   
@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);
}
项目:consulo    文件:CopyrightConfigurable.java   
static void setupEditor(Editor editor) {
  EditorSettings settings = editor.getSettings();
  settings.setLineNumbersShown(false);
  settings.setFoldingOutlineShown(false);
  settings.setIndentGuidesShown(false);
  settings.setLineMarkerAreaShown(false);
}
项目:consulo-java    文件:ByteCodeViewerComponent.java   
public ByteCodeViewerComponent(Project project, AnAction[] additionalActions)
{
    super(new BorderLayout());
    final EditorFactory factory = EditorFactory.getInstance();
    final Document doc = factory.createDocument("");
    doc.setReadOnly(true);
    myEditor = factory.createEditor(doc, project);
    EditorHighlighterFactory editorHighlighterFactory = EditorHighlighterFactory.getInstance();
    final SyntaxHighlighter syntaxHighlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(PlainTextFileType.INSTANCE, project, null);
    ((EditorEx) myEditor).setHighlighter(editorHighlighterFactory.createEditorHighlighter(syntaxHighlighter,
            EditorColorsManager.getInstance().getGlobalScheme()));
    ((EditorEx) myEditor).setBackgroundColor(EditorFragmentComponent.getBackgroundColor(myEditor));
    myEditor.getColorsScheme().setColor(EditorColors.CARET_ROW_COLOR, LightColors.SLIGHTLY_GRAY);
    ((EditorEx) myEditor).setCaretVisible(true);

    final EditorSettings settings = myEditor.getSettings();
    settings.setLineMarkerAreaShown(false);
    settings.setIndentGuidesShown(false);
    settings.setLineNumbersShown(false);
    settings.setFoldingOutlineShown(false);

    myEditor.setBorder(null);
    add(myEditor.getComponent(), BorderLayout.CENTER);
    final ActionManager actionManager = ActionManager.getInstance();
    final DefaultActionGroup actions = new DefaultActionGroup();
    if(additionalActions != null)
    {
        for(final AnAction action : additionalActions)
        {
            actions.add(action);
        }
    }
    add(actionManager.createActionToolbar(ActionPlaces.JAVADOC_TOOLBAR, actions, true).getComponent(), BorderLayout.NORTH);
}
项目:livescript-idea    文件:LiveScriptCompiledPreviewForm.java   
private Editor createEditor(@NotNull PsiFile psiFile, @NotNull Project project) {
    if (psiFile == null)
        throw new IllegalArgumentException("Argument 0 for @NotNull parameter of org/livescriptidea/compiler/LiveScriptCompiledPreviewForm.createEditor must not be null");
    if (project == null)
        throw new IllegalArgumentException("Argument 1 for @NotNull parameter of org/livescriptidea/compiler/LiveScriptCompiledPreviewForm.createEditor must not be null");
    Document document = new DocumentImpl(psiFile.getText());
    EditorFactory editorFactory = EditorFactory.getInstance();
    Editor result = editorFactory.createEditor(document, project, psiFile.getFileType(), true);

    EditorSettings editorSettings = result.getSettings();
    editorSettings.setLineMarkerAreaShown(true);
    editorSettings.setLineNumbersShown(true);
    editorSettings.setIndentGuidesShown(true);
    return result;
}
项目:intellij-ce-playground    文件:UIUtil.java   
@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;
}
项目:intellij-ce-playground    文件:EditorTextFieldProviderImpl.java   
private static void applyDefaultSettings(EditorEx ex) {
  EditorSettings settings = ex.getSettings();
  settings.setAdditionalColumnsCount(3);
  settings.setVirtualSpace(false);
}
项目:ultimate-pastebin-intellij-plugin    文件:CreatePasteForm.java   
public CreatePasteForm(@Nullable Project project, Paste paste, FileType fileType) {
  super(project);

  logger.debug("Initializing create paste form");

  Objects.requireNonNull(paste);

  this.paste = paste;
  logger.debug("Paste: " + paste);

  setTitle(getMessage("ultimatepastebin.createpaste.form.title"));
  setAutoAdjustable(true);
  setModal(false);

  Arrays.stream(PasteHighLight.values()).forEach(pasteHighlight::addItem);

  if (paste.getHighLight() != null) {
    setSelectedPasteHighlight(paste.getHighLight());
  } else {
    setSelectedPasteHighlight(PasteHighLight.TEXT);
  }

  pasteExpiration.addItem(getMessage("ultimatepastebin.paste.expiration.never"));
  pasteExpiration.addItem(getMessage("ultimatepastebin.paste.expiration.tenminutes"));
  pasteExpiration.addItem(getMessage("ultimatepastebin.paste.expiration.onehour"));
  pasteExpiration.addItem(getMessage("ultimatepastebin.paste.expiration.oneday"));
  pasteExpiration.addItem(getMessage("ultimatepastebin.paste.expiration.oneweek"));
  pasteExpiration.addItem(getMessage("ultimatepastebin.paste.expiration.twoweeks"));
  pasteExpiration.addItem(getMessage("ultimatepastebin.paste.expiration.onemonth"));

  pasteVisibility.addItem(getMessage("ultimatepastebin.paste.visibility.public"));
  pasteVisibility.addItem(getMessage("ultimatepastebin.paste.visibility.private"));
  pasteVisibility.addItem(getMessage("ultimatepastebin.paste.visibility.unlisted"));

  init();

  String pasteContent = paste.getContent() != null ? paste.getContent() : "";

  final Document content = createDocument(pasteContent);

  codeEditor = new EditorTextField(content, project, fileType, false, false) {
    @Override
    protected EditorEx createEditor() {
      EditorEx editor = (EditorEx) EditorFactory.getInstance().createEditor(content, project, fileType, false);

      editor.setHorizontalScrollbarVisible(true);
      editor.setVerticalScrollbarVisible(true);

      EditorSettings settings = editor.getSettings();
      settings.setLineNumbersShown(true);

      customizedEditor = editor;

      return editor;
    }
  };

  // Copied from the generated code
  pasteContentPanel.add(codeEditor,
                        new GridConstraints(0,
                                            0,
                                            1,
                                            1,
                                            GridConstraints.ANCHOR_CENTER,
                                            GridConstraints.FILL_BOTH,
                                            GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                            GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                            null,
                                            new Dimension(600, 325),
                                            null,
                                            0,
                                            false));
  pasteContentPanel.setMinimumSize(new Dimension(600, 325));

  pasteTitle.requestFocusInWindow();
}
项目:tools-idea    文件:EditorTextFieldProviderImpl.java   
private static void applyDefaultSettings(EditorEx ex) {
  EditorSettings settings = ex.getSettings();
  settings.setAdditionalColumnsCount(3);
  settings.setVirtualSpace(false);
}
项目:intellij-plugin-v4    文件:InputPanel.java   
public Editor createPreviewEditor(final VirtualFile grammarFile, Document doc) {
        LOG.info("createEditor: create new editor for "+grammarFile.getPath()+" "+previewPanel.project.getName());
        final EditorFactory factory = EditorFactory.getInstance();
        doc.addDocumentListener(
            new DocumentAdapter() {
                VirtualFile grammarFileForThisPreviewEditor;

                {
                    { // faux ctor
                        this.grammarFileForThisPreviewEditor = grammarFile;
                    }
                }

                @Override
                public void documentChanged(DocumentEvent event) {
                    previewPanel.updateParseTreeFromDoc(grammarFileForThisPreviewEditor);
                }
            }
                               );
        final Editor editor = factory.createEditor(doc, previewPanel.project);
        // force right margin
        ((EditorMarkupModel) editor.getMarkupModel()).setErrorStripeVisible(true);
        EditorSettings settings = editor.getSettings();
        settings.setWhitespacesShown(true);
        settings.setLineNumbersShown(true);
        settings.setLineMarkerAreaShown(true);
        installListeners(editor);

//      EditorGutter gutter = editor.getGutter();
//      gutter.registerTextAnnotation(
//          new TextAnnotationGutterProvider() {
//              @Nullable
//              @Override
//              public String getLineText(int line, Editor editor) {
//                  return "foo";
//              }
//
//              @Nullable
//              @Override
//              public String getToolTip(int line, Editor editor) {
//                  return "tool tip";
//              }
//
//              @Override
//              public EditorFontType getStyle(int line, Editor editor) {
//                  return null;
//              }
//
//              @Nullable
//              @Override
//              public ColorKey getColor(int line, Editor editor) {
//                  return EditorColors.MODIFIED_LINES_COLOR;
//              }
//
//              @Nullable
//              @Override
//              public Color getBgColor(int line, Editor editor) {
//                  return JBColor.WHITE;
//              }
//
//              @Override
//              public List<AnAction> getPopupActions(int line, Editor editor) {
//                  return null;
//              }
//
//              @Override
//              public void gutterClosed() {
//
//              }
//          }
//      );

        return editor;
    }