[Uml-devel] branches/KDE/3.5/kdesdk/umbrello/umbrello/clipboard
Oliver Kellogg
okellogg at users.sourceforge.net
Sun Feb 4 12:36:23 UTC 2007
SVN commit 630088 by okellogg:
pasteClip5(): If the target attribute or operation already exists then assign
a new name via UMLCanvasObject::uniqChildName().
M +18 -10 umlclipboard.cpp
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/clipboard/umlclipboard.cpp #630087:630088
@@ -579,7 +579,6 @@
return false;
}
- bool objectAlreadyExists = false;
UMLObject *obj = 0;
UMLObjectListIt object_it(objects);
doc->setModified(true);
@@ -590,20 +589,33 @@
switch(obj->getBaseType()) {
case Uml::ot_Attribute :
{
- if (parent->addAttribute(dynamic_cast<UMLAttribute*>(obj), idchanges)) {
+ UMLObject *exist = parent->findChildObject(obj->getName(), Uml::ot_Attribute);
+ if (exist) {
+ QString newName = parent->uniqChildName(Uml::ot_Attribute, obj->getName());
+ obj->setName(newName);
+ }
+ UMLAttribute *att = static_cast<UMLAttribute*>(obj);
+ if (parent->addAttribute(att, idchanges)) {
//FIXME doc -> signalChildUMLObjectCreated(obj);
} else {
- objectAlreadyExists = true;
+ kError() << "UMLClipboard::pasteClip5: " << parent->getName()
+ << "->addAttribute(" << att->getName() << ") failed" << endl;
}
break;
}
case Uml::ot_Operation :
{
- UMLClassifier * parent = dynamic_cast<UMLClassifier *>(lvitem -> getUMLObject());
- if (parent -> addOperation(dynamic_cast<UMLOperation*>(obj), idchanges)) {
+ UMLOperation *op = static_cast<UMLOperation*>(obj);
+ UMLOperation *exist = parent->checkOperationSignature(op->getName(), op->getParmList());
+ if (exist) {
+ QString newName = parent->uniqChildName(Uml::ot_Operation, obj->getName());
+ op->setName(newName);
+ }
+ if (parent->addOperation(op, idchanges)) {
//FIXME doc -> signalChildUMLObjectCreated(obj);
} else {
- objectAlreadyExists = true;
+ kError() << "UMLClipboard::pasteClip5: " << parent->getName()
+ << "->addOperation(" << op->getName() << ") failed" << endl;
}
break;
}
@@ -614,10 +626,6 @@
++object_it;
}
- if (objectAlreadyExists) {
- pasteItemAlreadyExists();
- }
-
return result;
}
More information about the umbrello-devel
mailing list