[Uml-devel] kdesdk/umbrello/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Sat Jan 3 20:15:42 UTC 2004
CVS commit by okellogg:
loadUMLObjectFromXMI: Add missing UMLAssociation for generalizations.
Add code for XMI_NEST_PACKAGES (in development.)
M +15 -15 umldoc.cpp 1.115
--- kdesdk/umbrello/umbrello/umldoc.cpp #1.114:1.115
@@ -915,5 +915,5 @@ void UMLDoc::removeAssociation (UMLAssoc
// emit sigObjectRemoved(object);
- setModified(true, false);
+ //setModified(true, false);
}
@@ -1374,4 +1374,5 @@ bool UMLDoc::saveToXMI(QIODevice& file)
QDomElement objectsElement = doc.createElement( "UML:Model" );
+#ifndef XMI_NEST_PACKAGES
// Save packages first so that when loading they are known first.
// This simplifies the establishing of cross reference links from
@@ -1384,7 +1385,7 @@ bool UMLDoc::saveToXMI(QIODevice& file)
status = false;
}
+#endif
- // Save everything else, but excluding operations, attributes, and
- // associations.
+ // Save everything except operations, attributes, and associations.
// Operations and attributes are owned by classifiers and will show up
// as their child nodes.
@@ -1392,17 +1393,16 @@ bool UMLDoc::saveToXMI(QIODevice& file)
for (UMLObject *o = objectList.first(); o; o = objectList.next() ) {
UMLObject_Type t = o->getBaseType();
-
+#if defined (XMI_NEST_PACKAGES)
+ // Under construction:
+ // Objects contained in a package are already saved by
+ // UMLPackage::saveToXMI().
+ if (o->getUMLPackage())
+ continue;
+#else
if (t == ot_Package)
continue;
+#endif
if (t == ot_Attribute || t == ot_Operation || t == ot_Association)
continue;
- if (t != ot_Actor && t != ot_UseCase && t != ot_Interface && t != ot_Datatype
- && t != ot_Enum && t != ot_Class && t != ot_EnumLiteral && t != ot_Template
- && t != ot_Component && t != ot_Artifact && t != ot_Node
- && t != ot_Stereotype) {
- kdWarning() << "UMLDoc::saveToXMI() trying to save a non-existant object from objectList"
- << endl;
- continue;
- }
if (! o->saveToXMI(doc, objectsElement)) {
status = false;
@@ -1778,11 +1778,9 @@ bool UMLDoc::loadUMLObjectsFromXMI( QDom
//counting to 10 (an arbitrary number)
emit sigWriteToStatusBar( i18n("Loading UML elements...") );
- UMLObject * pObject = 0;
int count = 0;
while ( !element.isNull() ) {
- pObject = 0;
QString type = element.tagName();
- pObject = makeNewUMLObject(type);
+ UMLObject *pObject = makeNewUMLObject(type);
if( !pObject ) {
kdWarning() << "Given wrong type of umlobject to create: " << type << endl;
@@ -1814,4 +1812,6 @@ bool UMLDoc::loadUMLObjectsFromXMI( QDom
// Add the method addObjRef() to UMLPackage.
*/
+ if (type == "UML:Generalization")
+ addAssocToConcepts((UMLAssociation *) pObject);
objectList.append( pObject );
}
More information about the umbrello-devel
mailing list