use of org.eclipse.jdt.core.IAnnotatable in project che by eclipse.
the class StubCreator method appendFlags.
protected void appendFlags(final IMember member) throws JavaModelException {
if (member instanceof IAnnotatable)
for (IAnnotation annotation : ((IAnnotatable) member).getAnnotations()) {
appendAnnotation(annotation);
}
int flags = member.getFlags();
final int kind = member.getElementType();
if (kind == IJavaElement.TYPE) {
flags &= ~Flags.AccSuper;
final IType type = (IType) member;
if (!type.isMember())
flags &= ~Flags.AccPrivate;
if (Flags.isEnum(flags))
flags &= ~Flags.AccAbstract;
}
if (Flags.isEnum(flags))
flags &= ~Flags.AccFinal;
if (kind == IJavaElement.METHOD) {
flags &= ~Flags.AccVarargs;
flags &= ~Flags.AccBridge;
}
if (flags != 0)
fBuffer.append(Flags.toString(flags));
}
use of org.eclipse.jdt.core.IAnnotatable in project che by eclipse.
the class JavadocFinder method getAnnotations.
private String getAnnotations(IJavaElement element, ITypeRoot editorInputElement, IRegion hoverRegion) throws URISyntaxException, JavaModelException {
if (!(element instanceof IPackageFragment)) {
if (!(element instanceof IAnnotatable))
return null;
if (((IAnnotatable) element).getAnnotations().length == 0)
return null;
}
IBinding binding = null;
//TODO
//getHoveredASTNode(editorInputElement, hoverRegion);
ASTNode node = null;
if (node == null) {
//todo use ast ported parser,that uses our java model
// ASTParser p = ASTParser.newParser(ASTProvider.SHARED_AST_LEVEL);
// p.setProject(element.getJavaProject());
// p.setBindingsRecovery(true);
// try {
// binding = p.createBindings(new IJavaElement[]{element}, null)[0];
// } catch (OperationCanceledException e) {
// return null;
// }
} else {
binding = resolveBinding(node);
}
if (binding == null)
return null;
IAnnotationBinding[] annotations = binding.getAnnotations();
if (annotations.length == 0)
return null;
StringBuffer buf = new StringBuffer();
for (int i = 0; i < annotations.length; i++) {
//TODO: skip annotations that don't have an @Documented annotation?
addAnnotation(buf, element, annotations[i]);
//$NON-NLS-1$
buf.append("<br>");
}
return buf.toString();
}
Aggregations