@Override public int getLayer(Annotation annotation) { if (annotation instanceof IAnnotationPresentation) { IAnnotationPresentation presentation = (IAnnotationPresentation) annotation; return presentation.getLayer(); } AnnotationPreference preference = getAnnotationPreference(annotation); if (preference != null) return preference.getPresentationLayer(); // backward compatibility, ignore exceptions, just return default layer try { Method method = annotation.getClass().getMethod("getLayer"); // $NON-NLS-1$ Integer result = (Integer) method.invoke(annotation); return result.intValue(); } catch (SecurityException x) { } catch (IllegalArgumentException x) { } catch (NoSuchMethodException x) { } catch (IllegalAccessException x) { } catch (InvocationTargetException x) { } return IAnnotationAccessExtension.DEFAULT_LAYER; }