List of usage examples for com.intellij.openapi.ui TextFieldWithBrowseButton setText
@Override public void setText(@Nullable String text)
From source file:org.jetbrains.tfsIntegration.ui.FieldWithButtonCellEditor.java
License:Apache License
public FieldWithButtonCellEditor(boolean pathCompletion, final Helper<T> helper) { super(new JTextField()); setClickCountToStart(1);//from w w w . j a va 2 s. c om final TextFieldWithBrowseButton field = pathCompletion ? new TextFieldWithBrowseButton() : new TextFieldWithBrowseButton.NoPathCompletion(); field.setOpaque(false); field.getTextField().setBorder(BorderFactory.createEmptyBorder()); field.getButton().addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { String result = helper.processButtonClick(field.getText()); if (result != null) { field.setText(result); } } }); delegate = new EditorDelegate() { public void setValue(Object value) { //noinspection unchecked field.setText(helper.toStringRepresentation((T) value)); } @Nullable public Object getCellEditorValue() { return helper.fromStringRepresentation(field.getText()); } public boolean shouldSelectCell(EventObject anEvent) { if (anEvent instanceof MouseEvent) { MouseEvent e = (MouseEvent) anEvent; return e.getID() != MouseEvent.MOUSE_DRAGGED; } return true; } }; editorComponent = field; }