[Uml-devel] KDE/kdesdk/umbrello/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Sun Feb 19 04:18:04 UTC 2006
SVN commit 511269 by okellogg:
apply commit 511268 from branches/KDE/3.5
M +4 -1 umldoc.cpp
M +31 -3 umlobject.cpp
--- trunk/KDE/kdesdk/umbrello/umbrello/umldoc.cpp #511268:511269
@@ -809,7 +809,10 @@
}
UMLObject* UMLDoc::findObjectById(Uml::IDType id) {
- return Model_Utils::findObjectInList(id, m_objectList);
+ UMLObject *o = Model_Utils::findObjectInList(id, m_objectList);
+ if (o == NULL)
+ o = findStereotypeById(id);
+ return o;
}
UMLStereotype * UMLDoc::findStereotypeById(Uml::IDType id) {
--- trunk/KDE/kdesdk/umbrello/umbrello/umlobject.cpp #511268:511269
@@ -416,6 +416,11 @@
if (! m_SecondaryId.isEmpty()) {
m_pSecondary = pDoc->findObjectById(STR2ID(m_SecondaryId));
if (m_pSecondary != NULL) {
+ if (m_pSecondary->getBaseType() == Uml::ot_Stereotype) {
+ m_pStereotype = static_cast<UMLStereotype*>(m_pSecondary);
+ m_pStereotype->incrRefCount();
+ m_pSecondary = NULL;
+ }
m_SecondaryId = "";
maybeSignalObjectCreated();
return true;
@@ -665,9 +670,9 @@
}
/**** End of XMI_FLAT_PACKAGES and old files handling ****************/
- // If the name is not set, let's check whether the attributes are saved
- // as child nodes.
- if (m_Name.isEmpty()) {
+ // If the node has child nodes, check whether attributes can be
+ // extracted from them.
+ if (element.hasChildNodes()) {
QDomNode node = element.firstChild();
if (node.isComment())
node = node.nextSibling();
@@ -698,6 +703,29 @@
if (ownerScope.isEmpty())
ownerScope = elem.text();
m_bStatic = (ownerScope == "classifier");
+ } else if (Uml::tagEq(tag, "stereotype")) {
+ QString stereo = elem.attribute("xmi.value", "");
+ if (stereo.isEmpty() && elem.hasChildNodes()) {
+ /* like so:
+ <UML:ModelElement.stereotype>
+ <UML:Stereotype xmi.idref = '07CD'/>
+ </UML:ModelElement.stereotype>
+ */
+ QDomNode stereoNode = elem.firstChild();
+ QDomElement stereoElem = stereoNode.toElement();
+ tag = stereoElem.tagName();
+ if (Uml::tagEq(tag, "Stereotype")) {
+ stereo = stereoElem.attribute("xmi.idref", "");
+ }
+ }
+ if (! stereo.isEmpty()) {
+ Uml::IDType stereoID = STR2ID(stereo);
+ m_pStereotype = umldoc->findStereotypeById(stereoID);
+ if (m_pStereotype)
+ m_pStereotype->incrRefCount();
+ else
+ m_SecondaryId = stereo; // leave it to resolveRef()
+ }
}
node = node.nextSibling();
if (node.isComment())
More information about the umbrello-devel
mailing list