@Override protected boolean isHandled(XExpression expression) { // short cut - shaves off around 20% of all calls if (rootedInstances.contains(expression)) { return true; } JvmIdentifiableElement logicalContainer = logicalContainerProvider.getNearestLogicalContainer(expression); if (logicalContainer == null) return false; XExpression associatedExpression = logicalContainerProvider.getAssociatedExpression(logicalContainer); if (associatedExpression != null && EcoreUtil.isAncestor(associatedExpression, expression) && rootedInstances.contains(associatedExpression)) { return true; } // special treatment for annotations EObject root = expression; EObject container = root.eContainer(); while(isPartOfExpressionTree(container)) { root = container; container = root.eContainer(); } if (rootedInstances.contains(root)) { return true; } return false; }
@Override protected boolean isHandled(EObject context) { if (context instanceof XExpression) { return isHandled((XExpression)context); } if (context instanceof JvmIdentifiableElement) { return isHandled((JvmIdentifiableElement)context); } if (isPartOfExpressionTree(context)) { return isHandled((XExpression) context.eContainer()); } JvmIdentifiableElement logicalContainer = logicalContainerProvider.getNearestLogicalContainer(context); if (logicalContainer == null) return false; return isHandled(logicalContainer); }