* the control
* @param constant
* the constant, as mentioned in aQute.bnd.osgi.Constants
*/
static public void setupMessageAndToolTipFromSyntax(Control control, String constant) {
Syntax syntax = Syntax.HELP.get(constant);
if (syntax == null) {
logger.logError("No bnd syntax found for " + constant, null);
syntax = new Syntax(constant, "Description of " + constant, constant + ": Example for " + constant, null, null);
}
String values = syntax.getValues();
if (values != null) {
/* filter out macros */
values = values.replaceAll("\\$\\{[^\\}]*\\}", "");
values = values.replaceAll(",\\s*,", ",");
values = values.replaceAll("(^,|,$)", "");
}
if ((values == null) || (values.trim().length() == 0)) {
values = "";
} else {
values = "\n\nProposed Values:\n" + values.trim().replaceAll("\\s*,\\s*", ", ");
}
String examples = getStrippedExample(syntax, constant);
if (examples == null) {
examples = "";
} else {
examples = "\n\nExample:\n" + examples;
}
String tt = syntax.getLead() + values + examples;
control.setToolTipText(tt);
}