String display = attName;
StringBuffer replacement = new StringBuffer();
replacement.append(attName);
replacement.append("=\"\"");
int cursorPosAfterReplace = replacement.toString().length() - 1;
ContextInformation contextInfo = Plugin.getDefault().getContextInformationProvider().getAttributeInformation(tag.getName(), attrib.getName(), activeFile);
proposals.add(new TMLCompletionProposal(replacement.toString(), _cursorAbsolute - typed.length(), typed.length(), cursorPosAfterReplace, null, display, contextInfo));
}
}
}
}
} else if (getAttributeNameOfValueCursorPosition() != null) {
// create attribute value proposals
String attribute = getAttributeNameOfValueCursorPosition();
String search = _content.substring(0, _cursorRelative);
int attributeValueStartPos = searchBackwards("\"", search, "=");
String typed = "";
if (attributeValueStartPos != -1) {
typed = _content.substring(attributeValueStartPos + 1, _cursorRelative);
} else {
typed = "";
}
TMLTag tag = TMLTagDefinitions.getInstance(WGADesignStructureHelper.getWGAVersionCompliance(activeFile)).getTagByName(getTagName());
if (tag != null) {
TMLTagAttribute tagAttribute = tag.getAttribute(attribute);
if (tagAttribute != null) {
if (tagAttribute.isTmlscriptExpression()) {
// perform tmlscript code completion
try {
IRegion region = getAttributeValueRegion(attribute);
TMLScriptRegion tmlScriptRegion = TMLScriptRegion.parse(region, _document, _cursorAbsolute, WGADesignStructureHelper.getWGAVersionCompliance(activeFile));
proposals.addAll(tmlScriptRegion.createProposals());
}
catch (BadLocationException e) {
}
} else {
// lookup attribute values
Iterator<String> values = tag.getAttributeValuesByPrefix(attribute, typed, _document, this, viewer, activeFile).iterator();
while (values.hasNext()) {
String value = values.next();
String display = value;
StringBuffer replacement = new StringBuffer();
replacement.append(value);
int cursorPosAfterReplace = replacement.toString().length() + 1;
ContextInformation info = Plugin.getDefault().getContextInformationProvider().getAttributeInformation(tag.getName(), attribute, value,activeFile);
proposals.add(new TMLCompletionProposal(replacement.toString(), _cursorAbsolute - typed.length(), typed.length(), cursorPosAfterReplace, null, display, info));
}
}
}
}