コード例 #1
0
  protected GoIntroduceVariableDialog(GoIntroduceOperation operation) {
    super(operation.getProject(), true);
    myOperation = operation;
    myOccurrencesCount = operation.getOccurrences().size();

    setTitle(RefactoringBundle.message("introduce.variable.title"));
    setModal(true);
    init();
  }
コード例 #2
0
  private JComponent createNamePanel() {
    JPanel panel = new JPanel(new BorderLayout());

    String[] names = ArrayUtil.toStringArray(myOperation.getSuggestedNames());
    myNameField = new NameSuggestionsField(names, myOperation.getProject(), GoFileType.INSTANCE);
    myNameField.setBorder(IdeBorderFactory.createEmptyBorder(3, 5, 2, 3));
    myNameField.addDataChangedListener(
        new NameSuggestionsField.DataChanged() {
          @Override
          public void dataChanged() {
            validateButtons();
          }
        });

    JLabel label =
        new JLabel(UIUtil.replaceMnemonicAmpersand(RefactoringBundle.message("name.prompt")));
    label.setLabelFor(myNameField);

    panel.add(myNameField, BorderLayout.CENTER);
    panel.add(label, BorderLayout.WEST);
    return panel;
  }