Java Code Examples for com.intellij.openapi.editor.ex.EditorEx#setHorizontalScrollbarVisible()

The following examples show how to use com.intellij.openapi.editor.ex.EditorEx#setHorizontalScrollbarVisible() . 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: InplaceRefactoring.java    From consulo with Apache License 2.0 6 votes vote down vote up
public static EditorEx createPreviewComponent(Project project, FileType languageFileType) {
  Document document = EditorFactory.getInstance().createDocument("");
  UndoUtil.disableUndoFor(document);
  EditorEx previewEditor = (EditorEx)EditorFactory.getInstance().createEditor(document, project, languageFileType, true);
  previewEditor.setOneLineMode(true);
  final EditorSettings settings = previewEditor.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);
  previewEditor.setHorizontalScrollbarVisible(false);
  previewEditor.setVerticalScrollbarVisible(false);
  previewEditor.setCaretEnabled(false);
  settings.setLineCursorWidth(1);

  final Color bg = previewEditor.getColorsScheme().getColor(EditorColors.CARET_ROW_COLOR);
  previewEditor.setBackgroundColor(bg);
  previewEditor.setBorder(BorderFactory.createCompoundBorder(new DottedBorder(Color.gray), new LineBorder(bg, 2)));

  return previewEditor;
}
 
Example 2
Source File: DocumentIntention.java    From weex-language-support with MIT License 5 votes vote down vote up
private void openSample(Project project, Editor editor) {

        EditorTextField field = new EditorTextField(editor.getDocument(), project, WeexFileType.INSTANCE, true, false) {
            @Override
            protected EditorEx createEditor() {
                EditorEx editor1 = super.createEditor();
                editor1.setVerticalScrollbarVisible(true);
                editor1.setHorizontalScrollbarVisible(true);
                return editor1;

            }
        };

        field.setFont(editor.getContentComponent().getFont());

        JBPopup jbPopup = JBPopupFactory.getInstance().createComponentPopupBuilder(field, null)
                .createPopup();

        jbPopup.setSize(new Dimension(500, 500));
        jbPopup.showInBestPositionFor(editor);
    }
 
Example 3
Source File: PlainTextEditor.java    From netbeans-mmd-plugin with Apache License 2.0 5 votes vote down vote up
@Override
protected EditorEx createEditor() {
  final EditorEx result = super.createEditor();
  result.setVerticalScrollbarVisible(true);
  result.setHorizontalScrollbarVisible(true);
  return result;
}
 
Example 4
Source File: TextViewer.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected EditorEx createEditor() {
  final EditorEx editor = super.createEditor();
  editor.setHorizontalScrollbarVisible(true);
  editor.setCaretEnabled(true);
  editor.setVerticalScrollbarVisible(true);
  editor.setEmbeddedIntoDialogWrapper(myEmbeddedIntoDialogWrapper);
  editor.getComponent().setPreferredSize(null);
  editor.getSettings().setUseSoftWraps(myUseSoftWraps);
  return editor;
}
 
Example 5
Source File: LanguageConsoleImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void setupEditor(@Nonnull EditorEx editor) {
  ConsoleViewUtil.setupConsoleEditor(editor, false, false);
  editor.getContentComponent().setFocusCycleRoot(false);
  editor.setHorizontalScrollbarVisible(true);
  editor.setVerticalScrollbarVisible(true);
  editor.setBorder(null);

  EditorSettings editorSettings = editor.getSettings();
  editorSettings.setAdditionalLinesCount(1);
  editorSettings.setAdditionalColumnsCount(1);

  DataManager.registerDataProvider(editor.getComponent(), (dataId) -> getEditorData(editor, dataId));
}
 
Example 6
Source File: EditorTextFieldProviderImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected EditorEx createEditor() {
  final EditorEx ex = super.createEditor();
  ex.getScrollPane().setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
  ex.setHorizontalScrollbarVisible(true);
  applyDefaultSettings(ex);
  applyCustomizations(ex);
  return ex;
}
 
Example 7
Source File: MethodSignatureComponent.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected EditorEx createEditor() {
  EditorEx editor = super.createEditor();
  final String fileName = getFileName();
  if (fileName != null) {
    editor.setHighlighter(EditorHighlighterFactory.getInstance().createEditorHighlighter(getProject(), fileName));
  }
  editor.getSettings().setWhitespacesShown(false);
  editor.setHorizontalScrollbarVisible(true);
  editor.setVerticalScrollbarVisible(true);
  return editor;
}
 
Example 8
Source File: EditorTextField.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected EditorEx createEditor() {
  LOG.assertTrue(myDocument != null);

  final EditorFactory factory = EditorFactory.getInstance();
  EditorEx editor = (EditorEx)(myIsViewer ? factory.createViewer(myDocument, myProject) : factory.createEditor(myDocument, myProject));

  final EditorSettings settings = editor.getSettings();
  settings.setAdditionalLinesCount(0);
  settings.setAdditionalColumnsCount(1);
  settings.setRightMarginShown(false);
  settings.setRightMargin(-1);
  settings.setFoldingOutlineShown(false);
  settings.setLineNumbersShown(false);
  settings.setLineMarkerAreaShown(false);
  settings.setIndentGuidesShown(false);
  settings.setVirtualSpace(false);
  settings.setWheelFontChangeEnabled(false);
  settings.setAdditionalPageAtBottom(false);
  editor.setHorizontalScrollbarVisible(false);
  editor.setVerticalScrollbarVisible(false);
  editor.setCaretEnabled(!myIsViewer);
  settings.setLineCursorWidth(1);

  JScrollPane scrollPane = editor.getScrollPane();
  scrollPane.setBorder(JBUI.Borders.empty());
  scrollPane.setViewportBorder(JBUI.Borders.empty());

  if (myProject != null) {
    PsiFile psiFile = PsiDocumentManager.getInstance(myProject).getPsiFile(editor.getDocument());
    if (psiFile != null) {
      DaemonCodeAnalyzer.getInstance(myProject).setHighlightingEnabled(psiFile, !myIsViewer);
    }
  }

  if (myProject != null && myFileType != null) {
    editor.setHighlighter(EditorHighlighterFactory.getInstance().createEditorHighlighter(myProject, myFileType));
  }

  editor.getSettings().setCaretRowShown(false);

  editor.setOneLineMode(myOneLineMode);
  editor.getCaretModel().moveToOffset(myDocument.getTextLength());

  if (myIsViewer) {
    editor.getSelectionModel().removeSelection();
  }
  else if (myWholeTextSelected) {
    doSelectAll(editor);
    myWholeTextSelected = false;
  }

  editor.putUserData(SUPPLEMENTARY_KEY, myIsSupplementary);
  editor.getContentComponent().setFocusCycleRoot(false);
  editor.getContentComponent().addFocusListener(myProxyListeners);
  editor.getContentComponent().addMouseListener(myProxyListeners);

  editor.setPlaceholder(myHintText);

  initOneLineMode(editor);

  if (myIsRendererWithSelection) {
    ((DesktopEditorImpl)editor).setPaintSelection(true);
    editor.getColorsScheme().setColor(EditorColors.SELECTION_BACKGROUND_COLOR, myRendererBg);
    editor.getColorsScheme().setColor(EditorColors.SELECTION_FOREGROUND_COLOR, myRendererFg);
    editor.getSelectionModel().setSelection(0, myDocument.getTextLength());
    editor.setBackgroundColor(myRendererBg);
  }

  for (EditorSettingsProvider provider : mySettingsProviders) {
    provider.customizeSettings(editor);
  }

  return editor;
}
 
Example 9
Source File: HorizontalScrollBarEditorCustomization.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void customize(@Nonnull EditorEx editor) {
  editor.setHorizontalScrollbarVisible(isEnabled());
}