in = annotatable.getAnnotations(); } catch (Exception e) { return out;
@Override public void consumeAnnotation() { if (!(this.element instanceof IAnnotatable)) return; int size = this.types.size(); if (size == 0) return; IJavaElement annotationType = ((JavaElementFinder) this.types.get(size-1)).element; this.element = ((IAnnotatable) this.element).getAnnotation(annotationType.getElementName()); }
public void consumeAnnotation() { if (!(this.element instanceof IAnnotatable)) return; int size = this.types.size(); if (size == 0) return; IJavaElement annotationType = ((JavaElementFinder) this.types.get(size-1)).element; this.element = ((IAnnotatable) this.element).getAnnotation(annotationType.getElementName()); }
public static boolean isHiddenGeneratedElement(IJavaElement element) { // generated elements are annotated with @Generated and they need to be filtered out if (element instanceof IAnnotatable) { try { IAnnotation[] annotations = ((IAnnotatable) element).getAnnotations(); if (annotations.length != 0) { for (IAnnotation annotation : annotations) { if (isSilencedGeneratedAnnotation(annotation)) { return true; } } } } catch (JavaModelException e) { //ignore } } return false; }
public void consumeAnnotation() { if (!(this.element instanceof IAnnotatable)) return; int size = this.types.size(); if (size == 0) return; IJavaElement annotationType = ((JavaElementFinder) this.types.get(size-1)).element; this.element = ((IAnnotatable) this.element).getAnnotation(annotationType.getElementName()); }
/** Replies the annotation with the given qualified name. * * @param element the annoted element. * @param qualifiedName the qualified name of the element. * @return the annotation, or <code>null</code> if the element is not annoted. */ public IAnnotation getAnnotation(IAnnotatable element, String qualifiedName) { if (element != null) { try { final int separator = qualifiedName.lastIndexOf('.'); final String simpleName; if (separator >= 0 && separator < (qualifiedName.length() - 1)) { simpleName = qualifiedName.substring(separator + 1, qualifiedName.length()); } else { simpleName = qualifiedName; } for (final IAnnotation annotation : element.getAnnotations()) { final String name = annotation.getElementName(); if (name.equals(simpleName) || name.equals(qualifiedName)) { return annotation; } } } catch (JavaModelException e) { // } } return null; }
public void consumeAnnotation() { if (!(this.element instanceof IAnnotatable)) return; int size = this.types.size(); if (size == 0) return; IJavaElement annotationType = ((JavaElementFinder) this.types.get(size-1)).element; this.element = ((IAnnotatable) this.element).getAnnotation(annotationType.getElementName()); }
/** * Create an handle for a local variable declaration (may be a local variable or type parameter). */ protected IJavaElement createHandle(Annotation annotation, IAnnotatable parent) { if (parent == null) return null; TypeReference typeRef = annotation.type; char[][] typeName = typeRef.getTypeName(); String name = new String(typeName[typeName.length-1]); try { IAnnotation[] annotations = parent.getAnnotations(); int length = annotations == null ? 0 : annotations.length; for (int i=0; i<length; i++) { if (annotations[i].getElementName().equals(name)) { return annotations[i]; } } } catch (JavaModelException jme) { // skip } return null; } /*
public void consumeAnnotation() { if (!(this.element instanceof IAnnotatable)) return; int size = this.types.size(); if (size == 0) return; IJavaElement annotationType = ((JavaElementFinder) this.types.get(size-1)).element; this.element = ((IAnnotatable) this.element).getAnnotation(annotationType.getElementName()); }
private static 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= getHoveredNodeBinding(element, editorInputElement, hoverRegion); 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, annotations[i], true); buf.append("<br>"); //$NON-NLS-1$ } return buf.toString(); }
public void consumeAnnotation() { if (!(this.element instanceof IAnnotatable)) return; int size = this.types.size(); if (size == 0) return; IJavaElement annotationType = ((JavaElementFinder) this.types.get(size-1)).element; this.element = ((IAnnotatable) this.element).getAnnotation(annotationType.getElementName()); }
String name = new String(typeName[typeName.length-1]); try { IAnnotation[] annotations = parent.getAnnotations(); int length = annotations == null ? 0 : annotations.length; for (int i=0; i<length; i++) {
public void consumeAnnotation() { if (!(this.element instanceof IAnnotatable)) return; int size = this.types.size(); if (size == 0) return; IJavaElement annotationType = ((JavaElementFinder) this.types.get(size-1)).element; this.element = ((IAnnotatable) this.element).getAnnotation(annotationType.getElementName()); }
String name = new String(typeName[typeName.length-1]); try { IAnnotation[] annotations = parent.getAnnotations(); int length = annotations == null ? 0 : annotations.length; for (int i=0; i<length; i++) {
protected IAnnotation transplantHandle(IAnnotatable parent, IAnnotation element) { return parent.getAnnotation(element.getElementName()); }
String name = new String(typeName[typeName.length-1]); try { IAnnotation[] annotations = parent.getAnnotations(); int length = annotations == null ? 0 : annotations.length; for (int i=0; i<length; i++) {
protected IAnnotation transplantHandle(IAnnotatable parent, IAnnotation element) { return parent.getAnnotation(element.getElementName()); }
String name = new String(typeName[typeName.length-1]); try { IAnnotation[] annotations = parent.getAnnotations(); int length = annotations == null ? 0 : annotations.length; for (int i=0; i<length; i++) {
protected IAnnotation transplantHandle(IAnnotatable parent, IAnnotation element) { return parent.getAnnotation(element.getElementName()); }
String name = new String(typeName[typeName.length-1]); try { IAnnotation[] annotations = parent.getAnnotations(); int length = annotations == null ? 0 : annotations.length; for (int i=0; i<length; i++) {