while (!condition.evaluate(context, ref)) {
boolean isBadReference = true;
if (condition instanceof ContainsCondition) {
// Attempt to automatically enable the managed object.
ContainsCondition cvc = (ContainsCondition) condition;
app.println();
if (app.confirmAction(
INFO_EDITOR_PROMPT_ENABLED_REFERENCED_COMPONENT.get(rufn,
name, ufn), true)) {
cvc.setPropertyValue(ref);
try {
ref.commit();
// Try to create the command builder
if ((app instanceof DSConfig) && app.isInteractive())
{
DSConfig dsConfig = (DSConfig)app;
String subCommandName = "set-" +
path.getRelationDefinition().getName() + "-prop";
CommandBuilder builder =
dsConfig.getCommandBuilder(subCommandName);
if (path.getRelationDefinition() instanceof
InstantiableRelationDefinition<?, ?>)
{
String argName =
CLIProfile.getInstance().getNamingArgument(
path.getRelationDefinition());
try
{
StringArgument arg = new StringArgument(argName, null,
argName, false, true,
INFO_NAME_PLACEHOLDER.get(),
INFO_DSCFG_DESCRIPTION_NAME.get(
d.getUserFriendlyName()));
arg.addValue(name);
builder.addArgument(arg);
}
catch (Throwable t)
{
// Bug
throw new RuntimeException("Unexpected error: "+t, t);
}
}
try
{
StringArgument arg = new StringArgument(
OPTION_DSCFG_LONG_SET, OPTION_DSCFG_SHORT_SET,
OPTION_DSCFG_LONG_SET, false, true, true,
INFO_VALUE_SET_PLACEHOLDER.get(), null, null,
INFO_DSCFG_DESCRIPTION_PROP_VAL.get());
PropertyDefinition<?> propertyDefinition =
cvc.getPropertyDefinition();
arg.addValue(propertyDefinition.getName()+':'+
castAndGetArgumentValue(propertyDefinition,
cvc.getValue()));
builder.addArgument(arg);
}
catch (Throwable t)
{
// Bug