Java Code Examples for com.intellij.ui.EditorTextField#addSettingsProvider()
The following examples show how to use
com.intellij.ui.EditorTextField#addSettingsProvider() .
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: ParameterNameHintsConfigurable.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull private static EditorTextField createEditorField(@Nonnull String text, @Nullable TextRange rangeToSelect) { Document document = EditorFactory.getInstance().createDocument(text); EditorTextField field = new EditorTextField(document, null, PlainTextFileType.INSTANCE, false, false); field.setPreferredSize(new Dimension(200, 350)); field.addSettingsProvider(editor -> { editor.setVerticalScrollbarVisible(true); editor.setHorizontalScrollbarVisible(true); editor.getSettings().setAdditionalLinesCount(2); if (rangeToSelect != null) { editor.getCaretModel().moveToOffset(rangeToSelect.getStartOffset()); editor.getScrollingModel().scrollVertically(document.getTextLength() - 1); editor.getSelectionModel().setSelection(rangeToSelect.getStartOffset(), rangeToSelect.getEndOffset()); } }); return field; }
Example 2
Source File: UIHelper.java From PackageTemplates with Apache License 2.0 | 4 votes |
public static void addHighlightListener(Project project, EditorTextField etfName) { etfName.addSettingsProvider(editor -> { HighlightHelper.addHighlightListener(project, etfName, editor, StringTools.PATTERN_ATTRIBUTE); HighlightHelper.applyHighlightRange(HighlightHelper.findResults(etfName.getText(), StringTools.PATTERN_ATTRIBUTE), project, editor); }); }