Methods Summary |
---|
public void | addText(java.lang.String msg)
if (message == null) {
message = "";
}
// we must manually replace properties for nested text
message += ProjectHelper.replaceProperties(
getProject(), msg, getProject().getProperties());
|
public void | execute()
validateAttributes();
log("optionType = " + optionType, Project.MSG_DEBUG);
if (optionType == -1) {
JOptionPane.showMessageDialog(
null, // parent
message,
title,
JOptionPane.INFORMATION_MESSAGE);
} else {
int response = JOptionPane.showConfirmDialog(
null, // parent
message,
title,
optionType,
JOptionPane.QUESTION_MESSAGE);
if (propertyName != null) {
String responseText = formatResponseCode(response);
log("Setting " + propertyName + " to " + responseText,
Project.MSG_VERBOSE);
getProject().setProperty(propertyName, responseText);
}
}
|
private java.lang.String | formatResponseCode(int optionPaneResponse)
switch (optionPaneResponse) {
// note: JOptionPane.OK_OPTION is the same as YES_OPTION
case JOptionPane.YES_OPTION:
return "yes";
case JOptionPane.NO_OPTION:
return "no";
case JOptionPane.CANCEL_OPTION:
case JOptionPane.CLOSED_OPTION:
return "cancel";
default:
throw new BuildException("Internal error: Unknown option " +
"pane response: " + optionPaneResponse);
}
|
public void | setMessage(java.lang.String msg)
// ant always replaces properties for attributes
message = msg;
|
public void | setOptiontype(com.oreilly.javaxp.ant.DialogBoxTask$OptionType ot)
log("Calling setOptionType: " + ot.getValue(),
Project.MSG_DEBUG);
String value = ot.getValue();
if ("ok".equals(value)) {
optionType = -1;
} else if ("ok_cancel".equals(value)) {
optionType = JOptionPane.OK_CANCEL_OPTION;
} else if ("yes_no".equals(value)) {
optionType = JOptionPane.YES_NO_OPTION;
} else {
// only remaining possibility
optionType = JOptionPane.YES_NO_CANCEL_OPTION;
}
|
public void | setProperty(java.lang.String propertyName)
this.propertyName = propertyName;
|
public void | setTitle(java.lang.String title)
this.title = title;
|
protected void | validateAttributes()
if (message == null) {
throw new BuildException("Message must be specified using the "
+ "message attribute or nested text.");
}
if (optionType == -1 && propertyName != null) {
throw new BuildException(
"Cannot specify property unless optionType is "
+ "'ok_cancel', 'yes_no', or 'yes_no_cancel'");
}
|