if (World.createInjarHierarchy) {
createHierarchyForBinaryAspect(model, advice);
}
IRelationshipMap mapper = model.getRelationshipMap();
IProgramElement targetNode = getNode(model, matchedShadow);
if (targetNode == null) {
return;
}
boolean runtimeTest = advice.hasDynamicTests();
IProgramElement.ExtraInformation extra = new IProgramElement.ExtraInformation();
String adviceHandle = getHandle(model, advice);
if (adviceHandle == null) {
return;
}
extra.setExtraAdviceInformation(advice.getKind().getName());
IProgramElement adviceElement = model.getHierarchy().findElementForHandle(adviceHandle);
if (adviceElement != null) {
adviceElement.setExtraInfo(extra);
}
String targetHandle = targetNode.getHandleIdentifier();
if (advice.getKind().equals(AdviceKind.Softener)) {
IRelationship foreward = mapper.get(adviceHandle, IRelationship.Kind.DECLARE_SOFT, SOFTENS, runtimeTest, true);
if (foreward != null) {
foreward.addTarget(targetHandle);
}
IRelationship back = mapper.get(targetHandle, IRelationship.Kind.DECLARE, SOFTENED_BY, runtimeTest, true);
if (back != null) {
back.addTarget(adviceHandle);
}
} else {
IRelationship foreward = mapper.get(adviceHandle, IRelationship.Kind.ADVICE, ADVISES, runtimeTest, true);
if (foreward != null) {
foreward.addTarget(targetHandle);
}
IRelationship back = mapper.get(targetHandle, IRelationship.Kind.ADVICE, ADVISED_BY, runtimeTest, true);
if (back != null) {
back.addTarget(adviceHandle);
}
}
if (adviceElement.getSourceLocation() != null) {
model.addAspectInEffectThisBuild(adviceElement.getSourceLocation().getSourceFile());
}
}
}