if (designItem.getDesignItem() instanceof Diagram) {
DiagramElementVisitor dev = new DiagramElementVisitor();
dev.visit((Diagram) designItem.getDesignItem(), new VisitorAction() {
public void visit(DiagramElement de) {
if (de instanceof IdentifiableDiagramElement) {
IdentifiableDiagramElement rde = (IdentifiableDiagramElement) de;
if (rde.getID().startsWith(PROJECT_JAVA_CLASS)) {
createProjectJavaClassReference(designItem, rde);
}
}
}
private void createProjectJavaClassReference(final WorkItem designItem, IdentifiableDiagramElement rde) {
String className = rde.getID().substring(PROJECT_JAVA_CLASS.length());
int slashIndex = className.indexOf("/");
if (slashIndex > -1) {
className = className.substring(0, slashIndex);
}
try {
Class<?> to = getContext().getUserClassLoader().loadClass(className);
addReferenceToClass(designItem, to);
} catch (Exception e) {
getContext().getLogger().error("Could not find class: " + className + " for " + rde.getID());
}
}
});
}
}