final org.eclipse.uml2.uml.Package finalTopPackage = topPackage;
//test the presence of the "ProxyRequirement" Package
Package proxyPackage = (Package)topPackage.getPackagedElement(PROXY_PACKAGE_NAME);
//test if already present, if not need creation
if (proxyPackage == null){
//means that the package have to be created
RecordingCommand PackCMD = new RecordingCommand(domain) {
@Override
protected void doExecute() {
org.eclipse.uml2.uml.Package tempPackage = UMLFactory.eINSTANCE.createPackage();
tempPackage.setName(PROXY_PACKAGE_NAME);
finalTopPackage.getPackagedElements().add(tempPackage);
}
};
domain.getCommandStack().execute(PackCMD);
}
final Package finalProxyPackage = (Package)topPackage.getPackagedElement(PROXY_PACKAGE_NAME);
RecordingCommand ReqCMD = new RequirementCreateCommand(domain, finalProxyPackage, requirement.getIdentifier(), requirement.getDesc());
domain.getCommandStack().execute(ReqCMD);
org.eclipse.uml2.uml.Class proxyreq = (org.eclipse.uml2.uml.Class)finalProxyPackage.getPackagedElement(requirement.getIdentifier());
RecordingCommand SatCMD = new SatisfyCreateCommand(domain, (NamedElement)UmlElement, (NamedElement)proxyreq, trace.getIdentifier());
domain.getCommandStack().execute(SatCMD);