@Override public Documentation createDocumentation(CCDocHtmlFormatter locationHeader) { assert locationHeader != null; return Documentation.create(String.format("%s%s", locationHeader.getText(), description), url); //NOI18N }
@NonNull public static Documentation create(@NonNull String content) { Parameters.notNull("content", content); return new Documentation(content, null); }
@Override public String document(ParserResult info, ElementHandle element) { return Optional.ofNullable(documentElement(info, element, ()->false)) .map((doc)->doc.getContent()) .orElse(null); }
@Override public ElementHandle resolveLink(String link, ElementHandle originalHandle) { if (originalHandle.getKind() == ElementKind.KEYWORD) { return Optional.ofNullable(Command.forHandle(originalHandle)) .map((cmd) -> cmd.getDocumentation(null)) .map((doc) -> doc.getUrl()) .map((url) -> { try { return url.toURI(); } catch (URISyntaxException e) { return null; } }) .map((uri) -> { try { return uri.resolve(new URI(link)); } catch (URISyntaxException e) { return null; } }) .map((uri) -> new DocHandle(uri)) .orElse(null); } return null; }
@Override public Documentation createDocumentation(CCDocHtmlFormatter locationHeader) { return Documentation.create(String.format("%s%s", locationHeader.getText(), Bundle.PHPDocNotFound())); //NOI18N } };
@NonNull public static Documentation create(@NonNull String content, URL url) { Parameters.notNull("content", content); return new Documentation(content, url); }
public static Collection<JsObject> readModel(BufferedReader reader, JsObject parent, @NullAllowed String sourceLabel, URL defaultDocUrl) throws IOException { String line = null; StringBuilder pushback = new StringBuilder(); List<JsObject> ret = new ArrayList<JsObject>(); while (pushback.length() > 0 || (line = reader.readLine()) != null) { if (pushback.length() > 0) { line = pushback.toString(); pushback.setLength(0); } if (line.trim().isEmpty()) { continue; } ret.add(readObject(parent, line, 0, reader, pushback, false, sourceLabel, defaultDocUrl == null ? null : Documentation.create(Bundle.LBL_DefaultDocContentForURL(), defaultDocUrl))); } return ret; }
public class DocumentationConverter implements Converter { public boolean canConvert(Class clazz) { return clazz.equals(Documentation.class); } public void marshal(Object value, HierarchicalStreamWriter writer, MarshallingContext context) { Documentation documentation = (Documentation) value; writer.addAttribute("language", documentation.getLanguage()); writer.setValue(documentation.getValue()); } public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) { Documentation documentation = new Documentation(); reader.moveDown(); documentation.setLanguage(reader.getAttribute("language")); documentation.setValue(reader.getValue()); reader.moveUp(); return documentation; } }
res.put( cmd, Documentation.create( section, new URL(String.format("%s#%s", //NOI18N
case DOCUMETATION_URL: ((JsObjectImpl) object).setDocumentation( Documentation.create(Bundle.LBL_DefaultDocContentForURL(), new URL(line.trim()))); break; case RETURN:
return Documentation.create(result[0]);
/** * Gets documentation for given Node. * @param node of the javaScript code * @return documentation text if any {@code null} otherwise */ public Documentation getDocumentation(Node node) { JsComment comment = getCommentForOffset(node.getStart(), getCommentBlocks()); if (comment != null) { String content = JsDocumentationPrinter.printDocumentation(comment); if (!content.isEmpty()) { return Documentation.create(content); } } return null; }
static Documentation document(ParserResult info, ElementHandle element) { if (element instanceof PHPDOCTagElement) { PHPDOCTagElement pHPDOCTagElement = (PHPDOCTagElement) element; String doc = pHPDOCTagElement.getDoc(); return Documentation.create(doc == null ? Bundle.PHPDocNotFound() : doc); } if (element instanceof PredefinedSymbolElement) { PredefinedSymbolElement predefinedSymbolElement = (PredefinedSymbolElement) element; String doc = predefinedSymbolElement.getDoc(); return Documentation.create(doc == null ? Bundle.PHPDocNotFound() : doc); } if (element instanceof PhpElement) { return documentIndexedElement((PhpElement) element); } if (element instanceof TypeMemberElement) { TypeMemberElement indexedClassMember = (TypeMemberElement) element; return documentIndexedElement(indexedClassMember); } return null; }
private JsObject createProperty(final ModelElementFactory factory, final JsObject parent, final JSONObject jsonObject) { String propertyName = getJSONStringProperty(jsonObject, NAME); if (propertyName != null) { JsObject object = factory.newObject(parent, propertyName, OffsetRange.NONE, true, NodeJsUtils.NODEJS_NAME); parent.addProperty(object.getName(), object); String doc = getJSONStringProperty(jsonObject, DESCRIPTION); object.setDocumentation(Documentation.create(doc, getDocumentationURL(propertyName))); return object; } return null; }
@Override public Documentation documentElement(ParserResult info, ElementHandle element, Callable<Boolean> cancel) { Documentation result; if (element instanceof ModelElement) { ModelElement mElem = (ModelElement) element; ModelElement parentElem = mElem.getInScope(); FileObject fileObject = mElem.getFileObject(); String fName = fileObject == null ? "?" : fileObject.getNameExt(); //NOI18N String tooltip; if (parentElem instanceof TypeScope) { tooltip = mElem.getPhpElementKind() + ": " + parentElem.getName() + "<b> " + mElem.getName() + " </b>" + "(" + fName + ")"; //NOI18N } else { tooltip = mElem.getPhpElementKind() + ":<b> " + mElem.getName() + " </b>" + "(" + fName + ")"; //NOI18N } result = Documentation.create(String.format("<div align=\"right\"><font size=-1>%s</font></div>", tooltip)); //NOI18N } else { result = ((element instanceof MethodElement) && ((MethodElement) element).isMagic()) ? null : DocRenderer.document(info, element); } return result; }
object.setDocumentation(Documentation.create(doc, getDocumentationURL(methodName, paramNames))); toObject.addProperty(object.getName(), object); addProperties(factory, object, (DeclarationScope) object, method);
object.addProperty(jsProperty.getName(), jsProperty); types = docProperty.getParamTypes(); jsProperty.setDocumentation(Documentation.create(docProperty.getParamDescription())); assignOffset = docProperty.getParamName().getOffsetRange().getEnd(); for (Type type : types) { JsTokenId.JAVASCRIPT_MIME_TYPE, null); parentObject.addProperty(callBackFunction.getName(), callBackFunction); callBackFunction.setDocumentation(Documentation.create(comment.getDocumentation())); callBackFunction.setJsKind(JsElement.Kind.CALLBACK); List<DocParameter> docParameters = comment.getParameters();