use of org.eclipse.jdt.core.dom.Javadoc in project flux by eclipse.
the class SimilarElementsRequestor method findSimilarElement.
public static SimilarElement[] findSimilarElement(ICompilationUnit cu, Name name, int kind) throws JavaModelException {
int pos = name.getStartPosition();
int nArguments = -1;
String identifier = ASTNodes.getSimpleNameIdentifier(name);
String returnType = null;
ICompilationUnit preparedCU = null;
try {
if (name.isQualifiedName()) {
pos = ((QualifiedName) name).getName().getStartPosition();
} else {
// first letter must be included, other
pos = name.getStartPosition() + 1;
}
Javadoc javadoc = (Javadoc) ASTNodes.getParent(name, ASTNode.JAVADOC);
if (javadoc != null) {
preparedCU = createPreparedCU(cu, javadoc, name.getStartPosition());
cu = preparedCU;
}
SimilarElementsRequestor requestor = new SimilarElementsRequestor(identifier, kind, nArguments, returnType);
requestor.setIgnored(CompletionProposal.ANONYMOUS_CLASS_DECLARATION, true);
requestor.setIgnored(CompletionProposal.ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION, true);
requestor.setIgnored(CompletionProposal.KEYWORD, true);
requestor.setIgnored(CompletionProposal.LABEL_REF, true);
requestor.setIgnored(CompletionProposal.METHOD_DECLARATION, true);
requestor.setIgnored(CompletionProposal.PACKAGE_REF, true);
requestor.setIgnored(CompletionProposal.VARIABLE_DECLARATION, true);
requestor.setIgnored(CompletionProposal.METHOD_REF, true);
requestor.setIgnored(CompletionProposal.CONSTRUCTOR_INVOCATION, true);
requestor.setIgnored(CompletionProposal.METHOD_REF_WITH_CASTED_RECEIVER, true);
requestor.setIgnored(CompletionProposal.FIELD_REF, true);
requestor.setIgnored(CompletionProposal.FIELD_REF_WITH_CASTED_RECEIVER, true);
requestor.setIgnored(CompletionProposal.LOCAL_VARIABLE_REF, true);
requestor.setIgnored(CompletionProposal.VARIABLE_DECLARATION, true);
requestor.setIgnored(CompletionProposal.VARIABLE_DECLARATION, true);
requestor.setIgnored(CompletionProposal.POTENTIAL_METHOD_DECLARATION, true);
requestor.setIgnored(CompletionProposal.METHOD_NAME_REFERENCE, true);
return requestor.process(cu, pos);
} finally {
if (preparedCU != null) {
preparedCU.discardWorkingCopy();
}
}
}
use of org.eclipse.jdt.core.dom.Javadoc in project generator by mybatis.
the class ExistingJavaFileVisitor method isGenerated.
@SuppressWarnings("unchecked")
private boolean isGenerated(BodyDeclaration node) {
boolean rc = false;
Javadoc jd = node.getJavadoc();
if (jd != null) {
List<TagElement> tags = jd.tags();
for (TagElement tag : tags) {
String tagName = tag.getTagName();
if (tagName == null) {
continue;
}
for (String javadocTag : javadocTags) {
if (tagName.equals(javadocTag)) {
String string = tag.toString();
if (string.contains("do_not_delete_during_merge")) {
if (node.getNodeType() == ASTNode.TYPE_DECLARATION) {
String name = ((TypeDeclaration) node).getName().getFullyQualifiedName();
generatedInnerClassesToKeep.add(name);
}
} else {
rc = true;
}
break;
}
}
}
}
return rc;
}
Aggregations