List of usage examples for org.eclipse.jdt.internal.core JavadocConstants ANCHOR_PREFIX_END
String ANCHOR_PREFIX_END
To view the source code for org.eclipse.jdt.internal.core JavadocConstants ANCHOR_PREFIX_END.
Click Source Link
From source file:com.codenvy.ide.ext.java.server.internal.core.JavadocContents.java
License:Open Source License
private int[] computeFieldRange(IField field) throws JavaModelException { if (!this.hasComputedChildrenSections) { computeChildrenSections();// ww w. ja va2 s .co m } StringBuffer buffer = new StringBuffer(field.getElementName()); buffer.append(JavadocConstants.ANCHOR_PREFIX_END); char[] anchor = String.valueOf(buffer).toCharArray(); int[] range = null; if (this.indexOfFieldDetails == -1 || this.indexOfFieldsBottom == -1) { // the detail section has no top or bottom, so the doc has an unknown format if (this.unknownFormatAnchorIndexes == null) { this.unknownFormatAnchorIndexes = new int[this.type.getChildren().length]; this.unknownFormatAnchorIndexesCount = 0; this.unknownFormatLastAnchorFoundIndex = this.childrenStart; } this.tempAnchorIndexes = this.unknownFormatAnchorIndexes; this.tempAnchorIndexesCount = this.unknownFormatAnchorIndexesCount; this.tempLastAnchorFoundIndex = this.unknownFormatLastAnchorFoundIndex; range = computeChildRange(anchor, this.indexOfFieldsBottom); this.unknownFormatLastAnchorFoundIndex = this.tempLastAnchorFoundIndex; this.unknownFormatAnchorIndexesCount = this.tempAnchorIndexesCount; this.unknownFormatAnchorIndexes = this.tempAnchorIndexes; } else { if (this.fieldAnchorIndexes == null) { this.fieldAnchorIndexes = new int[this.type.getFields().length]; this.fieldAnchorIndexesCount = 0; this.fieldLastAnchorFoundIndex = this.indexOfFieldDetails; } this.tempAnchorIndexes = this.fieldAnchorIndexes; this.tempAnchorIndexesCount = this.fieldAnchorIndexesCount; this.tempLastAnchorFoundIndex = this.fieldLastAnchorFoundIndex; range = computeChildRange(anchor, this.indexOfFieldsBottom); this.fieldLastAnchorFoundIndex = this.tempLastAnchorFoundIndex; this.fieldAnchorIndexesCount = this.tempAnchorIndexesCount; this.fieldAnchorIndexes = this.tempAnchorIndexes; } return range; }
From source file:com.codenvy.ide.ext.java.server.internal.core.JavadocContents.java
License:Open Source License
private String computeMethodAnchorPrefixEnd(BinaryMethod method) throws JavaModelException { String typeQualifiedName = null; if (this.type.isMember()) { IType currentType = this.type; StringBuffer buffer = new StringBuffer(); while (currentType != null) { buffer.insert(0, currentType.getElementName()); currentType = currentType.getDeclaringType(); if (currentType != null) { buffer.insert(0, '.'); }//from w w w . j a v a 2 s . c o m } typeQualifiedName = new String(buffer.toString()); } else { typeQualifiedName = this.type.getElementName(); } String methodName = method.getElementName(); if (method.isConstructor()) { methodName = typeQualifiedName; } IBinaryMethod info = (IBinaryMethod) method.getElementInfo(); char[] genericSignature = info.getGenericSignature(); String anchor = null; if (genericSignature != null) { genericSignature = CharOperation.replaceOnCopy(genericSignature, '/', '.'); anchor = Util.toAnchor(0, genericSignature, methodName, Flags.isVarargs(method.getFlags())); if (anchor == null) throw new JavaModelException( new JavaModelStatus(IJavaModelStatusConstants.UNKNOWN_JAVADOC_FORMAT, method)); } else { anchor = Signature.toString(method.getSignature().replace('/', '.'), methodName, null, true, false, Flags.isVarargs(method.getFlags())); } IType declaringType = this.type; if (declaringType.isMember()) { // might need to remove a part of the signature corresponding to the synthetic argument (only for constructor) if (method.isConstructor() && !Flags.isStatic(declaringType.getFlags())) { int indexOfOpeningParen = anchor.indexOf('('); if (indexOfOpeningParen == -1) { // should not happen as this is a method signature return null; } int index = indexOfOpeningParen; indexOfOpeningParen++; int indexOfComma = anchor.indexOf(',', index); if (indexOfComma != -1) { index = indexOfComma + 2; } else { // no argument, but a synthetic argument index = anchor.indexOf(')', index); } anchor = anchor.substring(0, indexOfOpeningParen) + anchor.substring(index); } } return anchor + JavadocConstants.ANCHOR_PREFIX_END; }