throw new IllegalStateException(
"Unexpected mode: " + proposal.getSyntaxType().getName());
}
}
HtmlProposalWithContext htmlProposal = (HtmlProposalWithContext) proposal;
AutocompleteProposal selectedProposal = proposal.getItem();
String triggeringString = proposal.getContext().getTriggeringString();
String selectedName = selectedProposal.getName();
switch (htmlProposal.getType()) {
case ELEMENT:
if (htmlAttributes.isSelfClosedTag(selectedName)) {
return new DefaultAutocompleteResult(
selectedName + ELEMENT_SELF_CLOSE, triggeringString,
selectedName.length());
}
return new DefaultAutocompleteResult(
selectedName + ELEMENT_SEPARATOR_CLOSE + ELEMENT_SEPARATOR_OPEN_FINISHTAG
+ selectedName + ELEMENT_SEPARATOR_CLOSE, triggeringString,
selectedName.length() + ELEMENT_SEPARATOR_CLOSE.length());
case ATTRIBUTE:
return new DefaultAutocompleteResult(
selectedName + ATTRIBUTE_SEPARATOR_OPEN + ATTRIBUTE_SEPARATOR_CLOSE,
triggeringString, selectedName.length() + ATTRIBUTE_SEPARATOR_OPEN.length());
default:
throw new IllegalStateException(
"Invocation of this method in not allowed for type " + htmlProposal.getType());
}
}