use of com.intellij.refactoring.util.ParameterTablePanel in project intellij-community by JetBrains.
the class IntroduceParameterObjectDialog method createParametersPanel.
protected ParameterTablePanel createParametersPanel() {
final PsiParameterList parameterList = mySourceMethod.getParameterList();
final PsiParameter[] parameters = parameterList.getParameters();
VariableData[] parameterInfo = new VariableData[parameters.length];
for (int i = 0; i < parameterInfo.length; i++) {
parameterInfo[i] = new VariableData(parameters[i]);
parameterInfo[i].name = parameters[i].getName();
parameterInfo[i].passAsParameter = true;
}
return new ParameterTablePanel(myProject, parameterInfo) {
protected void updateSignature() {
}
protected void doEnterAction() {
}
protected void doCancelAction() {
IntroduceParameterObjectDialog.this.doCancelAction();
}
};
}
use of com.intellij.refactoring.util.ParameterTablePanel in project intellij-community by JetBrains.
the class MakeParameterizedStaticDialog method createCenterPanel.
protected JComponent createCenterPanel() {
GridBagConstraints gbConstraints = new GridBagConstraints();
JPanel panel = new JPanel(new GridBagLayout());
gbConstraints.insets = JBUI.insets(4, 8);
gbConstraints.weighty = 0;
gbConstraints.weightx = 0;
gbConstraints.gridx = 0;
gbConstraints.gridy = GridBagConstraints.RELATIVE;
gbConstraints.gridwidth = GridBagConstraints.REMAINDER;
gbConstraints.fill = GridBagConstraints.NONE;
gbConstraints.anchor = GridBagConstraints.WEST;
panel.add(createDescriptionLabel(), gbConstraints);
gbConstraints.weighty = 0;
gbConstraints.weightx = 0;
gbConstraints.gridwidth = GridBagConstraints.REMAINDER;
gbConstraints.fill = GridBagConstraints.NONE;
gbConstraints.anchor = GridBagConstraints.WEST;
String text = myMember instanceof PsiMethod ? RefactoringBundle.message("add.object.as.a.parameter.with.name") : RefactoringBundle.message("add.object.as.a.parameter.to.constructors.with.name");
myMakeClassParameter.setText(text);
panel.add(myMakeClassParameter, gbConstraints);
myMakeClassParameter.setSelected(myAnyNonFieldMembersUsed);
gbConstraints.insets = JBUI.insets(0, 8, 4, 8);
gbConstraints.weighty = 0;
gbConstraints.weightx = 1;
gbConstraints.gridwidth = 2;
gbConstraints.fill = GridBagConstraints.HORIZONTAL;
gbConstraints.anchor = GridBagConstraints.NORTHWEST;
if (myNameSuggestions.length > 1) {
myClassParameterNameInputField = createComboBoxForName();
} else {
JTextField textField = new JTextField();
textField.setText(myNameSuggestions[0]);
textField.getDocument().addDocumentListener(new DocumentAdapter() {
public void textChanged(DocumentEvent event) {
updateControls();
}
});
myClassParameterNameInputField = textField;
}
panel.add(myClassParameterNameInputField, gbConstraints);
gbConstraints.gridwidth = GridBagConstraints.REMAINDER;
if (myVariableData.length > 0) {
gbConstraints.insets = JBUI.insets(4, 8);
gbConstraints.weighty = 0;
gbConstraints.weightx = 0;
gbConstraints.gridheight = 1;
gbConstraints.fill = GridBagConstraints.NONE;
gbConstraints.anchor = GridBagConstraints.WEST;
text = myMember instanceof PsiMethod ? RefactoringBundle.message("add.parameters.for.fields") : RefactoringBundle.message("add.parameters.for.fields.to.constructors");
myMakeFieldParameters.setText(text);
panel.add(myMakeFieldParameters, gbConstraints);
myMakeFieldParameters.setSelected(!myAnyNonFieldMembersUsed);
myParameterPanel = new ParameterTablePanel(myProject, myVariableData, myMember) {
protected void updateSignature() {
}
protected void doEnterAction() {
clickDefaultButton();
}
protected void doCancelAction() {
}
};
gbConstraints.insets = JBUI.insets(0, 8, 4, 8);
gbConstraints.gridwidth = 2;
gbConstraints.fill = GridBagConstraints.BOTH;
gbConstraints.weighty = 1;
panel.add(myParameterPanel, gbConstraints);
}
ActionListener inputFieldValidator = new ActionListener() {
public void actionPerformed(ActionEvent e) {
updateControls();
}
};
myMakeClassParameter.addActionListener(inputFieldValidator);
myMakeFieldParameters.addActionListener(inputFieldValidator);
if (myMember instanceof PsiMethod) {
myGenerateDelegateCb = new JCheckBox(RefactoringBundle.message("delegation.panel.delegate.via.overloading.method"));
panel.add(myGenerateDelegateCb, gbConstraints);
}
updateControls();
return panel;
}
Aggregations