Java 类com.intellij.util.ui.CellEditorComponentWithBrowseButton 实例源码

项目:intellij-ce-playground    文件:LogConfigurationPanel.java   
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();
    }
  });
}
项目:tools-idea    文件:LogConfigurationPanel.java   
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();
    }
  });
}
项目:consulo    文件:LogConfigurationPanel.java   
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();
    }
  });
}
项目:intellij-ce-playground    文件:AntUIUtil.java   
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();
      }
    }
  });
}
项目:vso-intellij    文件:ServerPathCellEditor.java   
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;
}
项目:tools-idea    文件:AntUIUtil.java   
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();
      }
    }
  });
}
项目:consulo-apache-ant    文件:AntUIUtil.java   
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();
            }
        }
    });
}