@Nonnull private static EditorTextField createTextField(@Nonnull Project project, Collection<String> values, boolean supportsNegativeValues, @Nonnull String initialValue) { TextFieldWithCompletion textField = new TextFieldWithCompletion(project, new MyCompletionProvider(values, supportsNegativeValues), initialValue, false, true, false) { @Override protected EditorEx createEditor() { EditorEx editor = super.createEditor(); SoftWrapsEditorCustomization.ENABLED.customize(editor); return editor; } }; textField.setBorder(new CompoundBorder(JBUI.Borders.empty(2), textField.getBorder())); return textField; }
@NotNull private static EditorTextField createTextField(@NotNull Project project) { final EditorTextFieldProvider service = ServiceManager.getService(project, EditorTextFieldProvider.class); List<EditorCustomization> features = ContainerUtil.packNullables(SoftWrapsEditorCustomization.ENABLED, SpellCheckingEditorCustomizationProvider.getInstance().getDisabledCustomization()); EditorTextField textField = service.getEditorField(FileTypes.PLAIN_TEXT.getLanguage(), project, features); textField.setBorder(new CompoundBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2), textField.getBorder())); textField.setOneLineMode(false); return textField; }
public static EditorTextField create(Project project, DataProvider dataProvider) { List<EditorCustomization> customizations = Arrays.<EditorCustomization>asList(SoftWrapsEditorCustomization.ENABLED, SpellCheckingEditorCustomization.DISABLED); EditorTextField editorField = ServiceManager.getService(project, EditorTextFieldProvider.class) .getEditorField(FileTypes.PLAIN_TEXT.getLanguage(), project, customizations); new CommaSeparatedTextFieldCompletion(dataProvider).apply(editorField); return editorField; }