[Uml-devel] kdesdk/umbrello/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Wed Mar 23 14:25:00 UTC 2005
CVS commit by okellogg:
showOpDlg(): Consider ancestors before creating a new operation.
M +14 -5 floatingtext.cpp 1.73
--- kdesdk/umbrello/umbrello/floatingtext.cpp #1.72:1.73
@@ -272,10 +272,19 @@ void FloatingText::showOpDlg() {
Umbrello::Parse_Status st = Umbrello::parseOperation(opText, od, c);
if (st == Umbrello::PS_OK) {
- bool isExistingOp = false;
- UMLObject *o = c->createOperation(od.m_name, &isExistingOp, &od.m_args);
- UMLOperation *op = static_cast<UMLOperation*>(o);
- if (od.m_pReturnType) {
- op->setType(od.m_pReturnType);
+ UMLClassifierList selfAndAncestors = c->findSuperClassConcepts();
+ selfAndAncestors.prepend(c);
+ UMLOperation *op = NULL;
+ for (UMLClassifier *cl = selfAndAncestors.first(); cl; cl = selfAndAncestors.next()) {
+ op = cl->findOperation(od.m_name, od.m_args);
+ if (op != NULL)
+ break;
}
+ if (op == NULL) {
+ // The op does not yet exist. Create a new one.
+ UMLObject *o = c->createOperation(od.m_name, NULL, &od.m_args);
+ op = static_cast<UMLOperation*>(o);
+ }
+ if (od.m_pReturnType)
+ op->setType(od.m_pReturnType);
m_pLink->setOperation(op);
opText = QString::null;
More information about the umbrello-devel
mailing list