System.out.println(PREFIX_MESSAGE+"Incorrect given element");
return;
// no action taken
}
final Element UmlElement = (Element)element;
TransactionalEditingDomain tempDomain = null;
try {
tempDomain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(UmlElement);
} catch (ServiceException e) {
System.err.println(e);
}
//test for the domain
if (null == tempDomain){
System.out.println(PREFIX_MESSAGE+"Editing Domain is null");
return;
//no action taken
}
final TransactionalEditingDomain domain = tempDomain;
//open a command do allow undo of all command in one undo
RecordingCommand CompleteCMD = new RecordingCommand(domain) {
protected void doExecute() {
//get top package
org.eclipse.uml2.uml.Package topPackage = UmlElement.getNearestPackage();
while (topPackage.getOwner() instanceof Package){
topPackage = (Package)topPackage.getOwner();
//recursively take nearest package until reaching the top
}