@Override public void buildUI(Container container) { TextFieldWithAutoCompletion<String> textField = CompletionUtil.createTextFieldWithAutoCompletion(context, input); component = new ComponentWithBrowseButton<>(textField, createBrowseButtonActionListener(textField)); inputField = component.getChildComponent(); inputField.setToolTipText(input.getDescription()); component.setToolTipText(input.getDescription()); inputField .getDocument() .addDocumentListener( new DocumentListener() { @Override public void beforeDocumentChange(DocumentEvent event) {} @Override public void documentChanged(DocumentEvent event) { PluginService.getInstance() .submitFormUpdate( new FormUpdateCallback( converterFactory, input, getValue(), valueChangeListener)); } }); container.add(component); component.setToolTipText(input.getDescription()); addNoteLabel(container, component).setText(input.getNote()); }
@Override public void updateState() { component.setEnabled(input.isEnabled()); component.setToolTipText(input.getDescription()); inputField.setToolTipText(input.getDescription()); if (!getValue().equals(getInputValue())) { reloadValue(); } if (CompletionUtil.hasCompletions(input)) { inputField.setVariants(getCompletions()); } updateNote(component, input.getNote()); }
private List<String> getCompletions() { return CompletionUtil.getCompletions( converterFactory, context, input, component != null ? inputField.getText() : null); }