Query query = new Query();
query.addChoice("delete", "Parameter to delete", attributeNames,
null, false);
ComponentDialog dialog = new ComponentDialog(_owner,
"Delete a parameter for " + _target.getFullName(), query,
null);
// If the OK button was pressed, then queue a mutation
// to delete the parameter.
String deleteName = query.getStringValue("delete");
if (dialog.buttonPressed().equals("OK") && !deleteName.equals("")) {
String moml = "<deleteProperty name=\"" + deleteName + "\"/>";
_target.addChangeListener(this);
MoMLChangeRequest request = new MoMLChangeRequest(this,
_target, moml);
request.setUndoable(true);
_target.requestChange(request);
}
} else if (buttonPressed().equals("Restore Defaults")) {
((Configurer) contents).restoreToDefaults();
// Open a new dialog (a modal dialog).
new EditParametersDialog(_owner, _target);
} else if (buttonPressed().equals("Preferences")) {
// Create a dialog for setting parameter styles.
try {
StyleConfigurer panel = new StyleConfigurer(target);
ComponentDialog dialog = new ComponentDialog(_owner,
"Edit preferences for " + target.getName(), panel);
if (!(dialog.buttonPressed().equals("OK"))) {
// Restore original parameter values.
panel.restore();
}
new EditParametersDialog(_owner, _target);