use of com.avaloq.tools.ddk.checkcfg.ICheckCfgPropertySpecification in project dsl-devkit by dsldevkit.
the class CheckCfgProposalProvider method completeConfiguredParameter_NewValue.
@Override
public // CHECKSTYLE:OFF
void completeConfiguredParameter_NewValue(final EObject model, final Assignment assignment, final ContentAssistContext context, final ICompletionProposalAcceptor acceptor) {
// CHECKSTYLE:ON
// TODO filter depending on type of linked parameter
FormalParameter parameter = ((ConfiguredParameter) model).getParameter();
ICheckCfgPropertySpecification propertySpecification = null;
String[] validValues = null;
if (parameter != null) {
propertySpecification = CheckCfgUtil.getPropertySpecification(parameter.getName());
if (propertySpecification != null) {
validValues = propertySpecification.getExpectedValues();
}
}
if (validValues != null && validValues.length > 0) {
String info = propertySpecification.getInfo();
for (String validValue : validValues) {
ICompletionProposal proposal = createCompletionProposal(String.format("\"%s\"", validValue), new StyledString(validValue), getImage(model), 0, context.getPrefix(), context);
if (proposal instanceof ConfigurableCompletionProposal) {
((ConfigurableCompletionProposal) proposal).setAdditionalProposalInfo(info);
}
acceptor.accept(proposal);
}
return;
}
super.completeConfiguredParameter_NewValue(model, assignment, context, acceptor);
}
Aggregations