public String getDescription() { FunctionStatement f = getFunctionStatement(getScriptFile(), getProblemStartIdx()); ISourceModule sourceModule = DLTKCore.createSourceModuleFrom(getScriptFile()); try { String functionString = sourceModule.getBuffer().getText(f.sourceStart(), f.sourceEnd() - f.sourceStart()); int lineEnd = functionString.indexOf('\n'); StringBuilder sb = new StringBuilder(lineEnd + 100); sb.append("<html><body> *<b>"); sb.append(getAnnotation()); sb.append("</b><br/> */<br/>"); sb.append(functionString.substring(0, lineEnd)); sb.append("</body></html>"); return sb.toString(); } catch (ModelException e) { } return getLabel(); }
protected MultiTextEdit getTextEdit(final IFile scriptFile, final int position) { MultiTextEdit textEdit = new MultiTextEdit(); FunctionStatement fs = getFunctionStatement(scriptFile, position); if (fs != null) { // TODO identation should be get.. int insertOffset = -1; Comment documentation = fs.getDocumentation(); if (documentation != null && documentation.isDocumentation()) { insertOffset = documentation.sourceEnd() - 2; InsertEdit suppressTextEdit = new InsertEdit( insertOffset, "* " + getAnnotation() + "\n "); // $NON-NLS-1$ //$NON-NLS-2$ textEdit.addChild(suppressTextEdit); } else { textEdit.addChild( new InsertEdit(fs.sourceStart(), "/**\n * " + getAnnotation() + "\n*/\n")); } } return textEdit; }