public LogFileCellEditor(LogFileOptions options) { myLogFileOptions = options; myComponent = new CellEditorComponentWithBrowseButton<JTextField>(new TextFieldWithBrowseButton(), this); getChildComponent().setEditable(false); getChildComponent().setBorder(null); myComponent.getComponentWithButton().getButton().addActionListener(new ActionListener() { @Override public void actionPerformed(@NotNull ActionEvent e) { showEditorDialog(myLogFileOptions); JTextField textField = getChildComponent(); textField.setText(myLogFileOptions.getName()); textField.requestFocus(); myModel.fireTableDataChanged(); } }); }
public LogFileCellEditor(LogFileOptions options) { myLogFileOptions = options; myComponent = new CellEditorComponentWithBrowseButton<JTextField>(new TextFieldWithBrowseButton(), this); getChildComponent().setEditable(false); getChildComponent().setBorder(null); myComponent.getComponentWithButton().getButton().addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showEditorDialog(myLogFileOptions); JTextField textField = getChildComponent(); textField.setText(myLogFileOptions.getName()); textField.requestFocus(); myModel.fireTableDataChanged(); } }); }
public LogFileCellEditor(LogFileOptions options) { myLogFileOptions = options; myComponent = new CellEditorComponentWithBrowseButton<JTextField>(new TextFieldWithBrowseButton(), this); getChildComponent().setEditable(false); getChildComponent().setBorder(null); myComponent.getComponentWithButton().getButton().addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showEditorDialog(myLogFileOptions); JTextField textField = getChildComponent(); textField.setText(myLogFileOptions.getName()); IdeFocusManager.getGlobalInstance().doForceFocusWhenFocusSettlesDown(textField); myModel.fireTableDataChanged(); } }); }
public PropertyValueCellEditor() { myComponent = new CellEditorComponentWithBrowseButton<JTextField>(new TextFieldWithBrowseButton(), this); getChildComponent().setBorder(BorderFactory.createLineBorder(Color.black)); FixedSizeButton button = myComponent.getComponentWithButton().getButton(); button.setIcon(IconUtil.getAddIcon()); button.setToolTipText(AntBundle.message("ant.property.value.editor.insert.macro.tooltip.text")); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { MacrosDialog dialog = new MacrosDialog(getChildComponent()); if (dialog.showAndGet() && dialog.getSelectedMacro() != null) { JTextField textField = getChildComponent(); String macro = dialog.getSelectedMacro().getName(); int position = textField.getCaretPosition(); try { textField.getDocument().insertString(position, "$" + macro + "$", null); textField.setCaretPosition(position + macro.length() + 2); } catch (BadLocationException ex) { LOG.error(ex); } textField.requestFocus(); } } }); }
public Component getTableCellEditorComponent(final JTable table, final Object value, final boolean isSelected, final int row, final int column) { final ActionListener listener = new ActionListener() { public void actionPerformed(ActionEvent e) { createBrowserDialog(); } }; component = new CellEditorComponentWithBrowseButton<JTextField>(new TextFieldWithBrowseButton(listener), this); component.getChildComponent().setText((String) value); return component; }
public PropertyValueCellEditor() { myComponent = new CellEditorComponentWithBrowseButton<JTextField>(new TextFieldWithBrowseButton(), this); getChildComponent().setBorder(BorderFactory.createLineBorder(Color.black)); FixedSizeButton button = myComponent.getComponentWithButton().getButton(); button.setIcon(IconUtil.getAddIcon()); button.setToolTipText(AntBundle.message("ant.property.value.editor.insert.macro.tooltip.text")); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { MacrosDialog dialog = new MacrosDialog(getChildComponent()); dialog.show(); if (dialog.isOK() && dialog.getSelectedMacro() != null) { JTextField textField = getChildComponent(); String macro = dialog.getSelectedMacro().getName(); int position = textField.getCaretPosition(); try { textField.getDocument().insertString(position, "$" + macro + "$", null); textField.setCaretPosition(position + macro.length() + 2); } catch (BadLocationException ex) { LOG.error(ex); } textField.requestFocus(); } } }); }
public PropertyValueCellEditor() { myComponent = new CellEditorComponentWithBrowseButton<JTextField>(new TextFieldWithBrowseButton(), this); getChildComponent().setBorder(BorderFactory.createLineBorder(Color.black)); FixedSizeButton button = myComponent.getComponentWithButton().getButton(); button.setIcon(IconUtil.getAddIcon()); button.setToolTipText(AntBundle.message("ant.property.value.editor.insert.macro.tooltip.text")); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { MacrosDialog dialog = new MacrosDialog(getChildComponent()); dialog.show(); if(dialog.isOK() && dialog.getSelectedMacro() != null) { JTextField textField = getChildComponent(); String macro = dialog.getSelectedMacro().getName(); int position = textField.getCaretPosition(); try { textField.getDocument().insertString(position, "$" + macro + "$", null); textField.setCaretPosition(position + macro.length() + 2); } catch(BadLocationException ex) { LOG.error(ex); } textField.requestFocus(); } } }); }