String str = buffer.getString();
if (Strings.containsOnlyWhitespaces(str)) {
return null;
}
TemplateVariable position = findVariable(buffer,
CodeTemplateContextType.TAGS); // look if PHPDoc tags have to
// be added
if (position == null) {
return str;
}
IDocument document = new Document(str);
int[] tagOffsets = position.getOffsets();
for (int i = tagOffsets.length - 1; i >= 0; i--) { // from last to first
try {
insertTag(document, tagOffsets[i], position.getLength(),
paramNames, retTypeSig, typeParameterNames, false,
lineDelimiter, newExceptions);
} catch (BadLocationException e) {
throw new CoreException(new Status(IStatus.ERROR,
PHPUiPlugin.ID, e.getClass().getName(), e));