Example #1
0
bool UMLClipboard::pasteChildren(UMLListViewItem *parent, IDChangeLog *chgLog) {
    if (!parent) {
        kWarning() << "Paste Children Error, parent missing" << endl;
        return false;
    }
    UMLDoc *doc = UMLApp::app()->getDocument();
    UMLListView *listView = UMLApp::app()->getListView();
    UMLListViewItem *childItem = static_cast<UMLListViewItem*>(parent->firstChild());
    while (childItem) {
        Uml::IDType oldID = childItem->getID();
        Uml::IDType newID = chgLog->findNewID(oldID);
        UMLListViewItem *shouldNotExist = listView->findItem(newID);
        if (shouldNotExist) {
            kError() << "UMLClipboard::pasteChildren: new list view item " << ID2STR(newID)
            << " already exists (internal error)" << endl;
            childItem = static_cast<UMLListViewItem*>(childItem->nextSibling());
            continue;
        }
        UMLObject *newObj = doc->findObjectById(newID);
        if (newObj) {
            kDebug() << "UMLClipboard::pasteChildren: adjusting lvitem(" << ID2STR(oldID)
            << ") to new UMLObject(" << ID2STR(newID) << ")" << endl;
            childItem->setUMLObject(newObj);
            childItem->setText(newObj->getName());
        } else {
            kDebug() << "UMLClipboard::pasteChildren: no UMLObject found for lvitem "
            << ID2STR(newID) << endl;
        }
        childItem = static_cast<UMLListViewItem*>(childItem->nextSibling());
    }
    return true;
}
Example #2
0
void UMLRole::saveToXMI( QDomDocument & qDoc, QDomElement & qElement ) {
    QDomElement roleElement = UMLObject::save("UML:AssociationEnd", qDoc);
    if (m_pSecondary)
        roleElement.setAttribute( "type", ID2STR(m_pSecondary->getID()) );
    else
        kError() << "UMLRole::saveToXMI(id " << ID2STR(m_nId)
        << "): m_pSecondary is NULL" << endl;
    if (!m_Multi.isEmpty())
        roleElement.setAttribute("multiplicity", m_Multi);
    if (m_role == Uml::A) {  // role aggregation based on parent type
        // role A
        switch (m_pAssoc->getAssocType()) {
        case Uml::at_Composition:
            roleElement.setAttribute("aggregation", "composite");
            break;
        case Uml::at_Aggregation:
            roleElement.setAttribute("aggregation", "aggregate");
            break;
        default:
            roleElement.setAttribute("aggregation", "none");
            break;
        }
        if (m_pAssoc->getAssocType() == Uml::at_UniAssociation) {
            // Normally the isNavigable attribute is "true".
            // We set it to false on role A to indicate that
            // role B gets an explicit arrowhead.
            roleElement.setAttribute("isNavigable", "false");
        } else {
            roleElement.setAttribute("isNavigable", "true");
        }
    } else {
        roleElement.setAttribute("aggregation", "none");
        roleElement.setAttribute("isNavigable", "true");
        //FIXME obviously this isn't standard XMI
        if (m_pAssoc->getAssocType() == Uml::at_Relationship) {
            roleElement.setAttribute("relationship", "true");
        }
    }

    roleElement.setAttribute("visibility", getVisibility().toString(false));

    switch (m_Changeability) {
    case Uml::chg_Frozen:
        roleElement.setAttribute("changeability", "frozen");
        break;
    case Uml::chg_AddOnly:
        roleElement.setAttribute("changeability", "addOnly");
        break;
    case Uml::chg_Changeable:
        roleElement.setAttribute("changeability", "changeable");
        break;
    }
    qElement.appendChild( roleElement );
}
Example #3
0
static TEE_Result platform_banner(void)
{
#ifdef CFG_EMBED_DTB
	IMSG("Platform stm32mp1: flavor %s - DT %s",
		ID2STR(PLATFORM_FLAVOR),
		ID2STR(CFG_EMBED_DTB_SOURCE_FILE));
#else
	IMSG("Platform stm32mp1: flavor %s - no device tree",
		ID2STR(PLATFORM_FLAVOR));
#endif

	return TEE_SUCCESS;
}
Example #4
0
// need to get the ID of the parent object
// this is kind of broken for UMLRoles.
QString CodeParameter::getID ()
{
    UMLRole * role = dynamic_cast<UMLRole*>(m_parentObject);
    if(role)
    {
        // cant use Role "ID" as that is used to distinquish if its
        // role "A" or "B"
        UMLAssociation *assoc = role->parentAssociation();
        return ID2STR(assoc->id());
    } else
        return ID2STR(m_parentObject->id());

}
Example #5
0
void UMLRole::setObject (UMLObject *obj) {
    // because we will get the id of this role from the parent
    // object, we CANT allow UMLRoles to take other UMLRoles as
    // parent objects. In fact, there is probably good reason
    // to only take UMLClassifiers here, but I'll leave it more open
    // for the time being. -b.t.
    if (obj && dynamic_cast<UMLRole*>(obj)) {
        kError() << "UMLRole(" << ID2STR(m_nId) << ") cannot setObject() to another UMLRole("
            << ID2STR(obj->getID()) << ")" << endl;
        return;
    }

    m_pSecondary = obj;
    UMLObject::emitModified();
}
Example #6
0
/**
 * Get a unique id for this codedocument.
 * @return   id for the codedocument
 */
QString CodeGenerator::getUniqueID(CodeDocument * codeDoc)
{
    QString id = codeDoc->getID();

    // does this document already exist? then just return its present id
    if (!id.isEmpty() && findCodeDocumentByID(id)) {
        return id;
    }

    // approach now differs by whether or not it is a classifier code document
    ClassifierCodeDocument * classDoc = dynamic_cast<ClassifierCodeDocument*>(codeDoc);
    if (classDoc) {
        UMLClassifier *c = classDoc->getParentClassifier();
        id = ID2STR(c->id()); // this is supposed to be unique already..
    }
    else {
        QString prefix = "doc";
        QString id = prefix + "_0";
        int number = lastIDIndex;
        for ( ; findCodeDocumentByID(id); ++number) {
            id = prefix + '_' + QString::number(number);
        }
        lastIDIndex = number;
    }

    return id;
}
Example #7
0
ostream& operator<<(ostream& os, const list<identifier>& node)
{
	uint num = node.size();
	if(num == 0)
		return os;

	list<identifier>::const_iterator it = node.begin();

	for(uint i = 0; i < num-1; i++, it++)
		os << ID2STR(*it) << ", ";

	if(num > 0)
		os << ID2STR(*it);

	return os;
}
Example #8
0
void 
NodeBuiltinStruct::dump(ostream& os, uint indent) const 
{
  dumpIndent(os, indent);
  os << "<BuiltinFunction name=\"" << ID2STR(getName()) << "\" id=\"" << getName() << "\" />" << endl;


}
Example #9
0
/**
 * Writes the <UML:TemplateParameter> XMI element.
 */
void UMLTemplate::saveToXMI(QDomDocument& qDoc, QDomElement& qElement)
{
    //FIXME: uml13.dtd compliance
    QDomElement attributeElement = UMLObject::save("UML:TemplateParameter", qDoc);
    if (m_pSecondary)
        attributeElement.setAttribute("type", ID2STR(m_pSecondary->id()));
    qElement.appendChild(attributeElement);
}
Example #10
0
void PreconditionWidget::slotWidgetMoved(Uml::IDType id)
{
    const Uml::IDType idA = m_pOw->localID();
    if (idA != id ) {
        uDebug() << "id=" << ID2STR(id) << ": ignoring for idA=" << ID2STR(idA);
        return;
    }
    m_nY = getY();
    if (m_nY < getMinY())
        m_nY = getMinY();
    if (m_nY > getMaxY())
        m_nY = getMaxY();

    calculateDimensions();
    if (m_scene->getSelectCount(true) > 1)
        return;

}
Example #11
0
void PreconditionWidget::saveToXMI( QDomDocument & qDoc, QDomElement & qElement )
{
    QDomElement preconditionElement = qDoc.createElement( "preconditionwidget" );
    UMLWidget::saveToXMI( qDoc, preconditionElement );
    preconditionElement.setAttribute( "widgetaid", ID2STR(m_pOw->localID()) );
    preconditionElement.setAttribute( "preconditionname", m_Text );
    preconditionElement.setAttribute( "documentation", m_Doc );
    qElement.appendChild( preconditionElement );
}
Example #12
0
/**
 * Reimplemented from UMLWidget::saveToXMI to save note widget
 * into XMI.
 */
void NoteWidget::saveToXMI(QDomDocument& qDoc, QDomElement& qElement)
{
    QDomElement noteElement = qDoc.createElement( "notewidget" );
    UMLWidget::saveToXMI( qDoc, noteElement );
    noteElement.setAttribute("text", documentation());
    if (m_diagramLink != Uml::id_None) {
        noteElement.setAttribute( "diagramlink", ID2STR(m_diagramLink) );
    }
    noteElement.setAttribute( "noteType", m_noteType);
    qElement.appendChild(noteElement);
}
Example #13
0
/**
 * Set the ID of the diagram hyperlinked to this note.
 * To switch off the hyperlink, set this to Uml::id_None.
 *
 * @param sceneID ID of an UMLScene.
 * @todo Fix the display of diagram link.
 */
void NoteWidget::setDiagramLink(Uml::IDType sceneID)
{
    UMLView *view = umlDoc()->findView(sceneID);
    if (view == 0) {
        uError() << "no view found for viewID " << ID2STR(sceneID);
        return;
    }

    QString linkText("Diagram: " + view->umlScene()->name());
    m_diagramLink = sceneID;
}
Example #14
0
Lexan::Lexan(identifier filename)
	: BaseObject(),
	m_source(),
	m_defines(),
	m_int(0),
	m_float(0.0f),
	m_string(""),
	m_identifier(0),
	m_currently_processed_function(STR2ID("none"))
{
	m_source.push(new LexanIteratorFile(ID2STR(filename)));
}
Example #15
0
void UMLAttribute::saveToXMI( QDomDocument & qDoc, QDomElement & qElement ) {
    QDomElement attributeElement = UMLObject::save("UML:Attribute", qDoc);
    if (m_pSecondary == NULL) {
        kDebug() << "UMLAttribute::saveToXMI(" << m_Name
        << "): m_pSecondary is NULL, m_SecondaryId is '"
        << m_SecondaryId << "'" << endl;
    } else {
        attributeElement.setAttribute( "type", ID2STR(m_pSecondary->getID()) );
    }
    if (! m_InitialValue.isEmpty())
        attributeElement.setAttribute( "initialValue", m_InitialValue );
    qElement.appendChild( attributeElement );
}
Example #16
0
bool PreconditionWidget::loadFromXMI( QDomElement & qElement )
{
    if( !UMLWidget::loadFromXMI( qElement ) )
        return false;
    QString widgetaid = qElement.attribute( "widgetaid", "-1" );
    m_Text = qElement.attribute( "preconditionname", "" );
    m_Doc = qElement.attribute( "documentation", "" );

    Uml::IDType aId = STR2ID(widgetaid);

    UMLWidget *pWA = m_scene -> findWidget( aId );
    if (pWA == NULL) {
        uDebug() << "role A object " << ID2STR(aId) << " not found";
        return false;
    }

    m_pOw = dynamic_cast<ObjectWidget*>(pWA);
    if (m_pOw == NULL) {
        uDebug() << "role A widget " << ID2STR(aId) << " is not an ObjectWidget";
        return false;
    }

    return true;
}
Example #17
0
/**
 * Save the XMI representation of this object
 */
void CodeGenerator::saveToXMI(QDomDocument & doc, QDomElement & root)
{
    QString langType = Model_Utils::progLangToString( language() );
    QDomElement docElement = doc.createElement( "codegenerator" );
    docElement.setAttribute("language",langType);

    if (dynamic_cast<SimpleCodeGenerator*>(this)) {
        UMLClassifierList concepts = m_document->classesAndInterfaces();
        foreach (UMLClassifier *c, concepts) {
            UMLOperationList operations = c->getOpList();
            foreach (UMLOperation *op, operations) {
                // save the source code
                QString code = op->getSourceCode();
                if (code.isEmpty()) {
                    continue;
                }
                QDomElement codeElement = doc.createElement("sourcecode");
                codeElement.setAttribute("id", ID2STR(op->id()));
                codeElement.setAttribute("value", code);
                docElement.appendChild( codeElement );
            }
/**
 * set attributes of the node that represents this class
 * in the XMI document.
 */
void OwnedHierarchicalCodeBlock::setAttributesOnNode(QDomDocument & doc, QDomElement & elem)
{
    // set super-class attributes
    HierarchicalCodeBlock::setAttributesOnNode(doc, elem);
    OwnedCodeBlock::setAttributesOnNode(doc, elem);

    // set local class attributes
    elem.setAttribute("parent_id",ID2STR(getParentObject()->id()));

    // setting ID's takes special treatment
    // as UMLRoles arent properly stored in the XMI right now.
    // (change would break the XMI format..save for big version change )
    UMLRole * role = dynamic_cast<UMLRole*>(getParentObject());
    if(role) {
        // see comment on role_id at OwnedCodeBlock::setAttributesOnNode()
        elem.setAttribute("role_id", (role->role() == Uml::A));
    }
    /* else
            elem.setAttribute("role_id","-1");
    */
}
Example #19
0
bool validateObjType(Uml::Object_Type expected, UMLObject* &o, Uml::IDType id)
{
    if (o == NULL) {
        uDebug() << "Widget_Factory::validateObjType: creating new object of type "
                 << expected << endl;
        QString artificialName = "LOST_" + ID2STR(id);
        o = Object_Factory::createUMLObject(expected, artificialName, NULL, false);
        if (o == NULL)
            return false;
        o->setID(id);
        UMLPackage *parentPkg = o->umlPackage();
        parentPkg->addObject(o);
        return true;
    }
    Uml::Object_Type actual = o->baseType();
    if (actual == expected)
        return true;
    uError() << "validateObjType(" << o->name()
        << "): expected type " << expected << ", actual type "
        << actual << endl;
    return false;
}
Example #20
0
/**
 * Find the value of the tag that this operation would have.
 */
QString CodeOperation::findTag (UMLOperation * op)
{
    return QString("operation_" + ID2STR(op->id()));
}
Example #21
0
UMLWidget* makeWidgetFromXMI(const QString& tag,
                             const QString& idStr, UMLView *view)
{
    UMLWidget *widget = NULL;

        // Loading of widgets which do NOT represent any UMLObject,
        // just graphic stuff with no real model information
        //FIXME while boxes and texts are just diagram objects, activities and
        // states should be UMLObjects
    if (tag == "statewidget" || tag == "UML:StateWidget") {
        widget = new StateWidget(view, StateWidget::Normal, Uml::id_Reserved);
    } else if (tag == "notewidget" || tag == "UML:NoteWidget") {
        widget = new NoteWidget(view, NoteWidget::Normal, Uml::id_Reserved);
    } else if (tag == "boxwidget") {
        widget = new BoxWidget(view, Uml::id_Reserved);
    } else if (tag == "floatingtext" || tag == "UML:FloatingTextWidget") {
        widget = new FloatingTextWidget(view, Uml::tr_Floating, "", Uml::id_Reserved);
    } else if (tag == "activitywidget" || tag == "UML:ActivityWidget") {
        widget = new ActivityWidget(view, ActivityWidget::Initial, Uml::id_Reserved);
    } else if (tag == "messagewidget") {
        widget = new MessageWidget(view, Uml::sequence_message_asynchronous, Uml::id_Reserved);
    } else if (tag == "forkjoin") {
        widget = new ForkJoinWidget(view, false, Uml::id_Reserved);
    } else if (tag == "preconditionwidget") {
        widget = new PreconditionWidget(view, NULL, Uml::id_Reserved);
    } else if (tag == "combinedFragmentwidget") {
        widget = new CombinedFragmentWidget(view, CombinedFragmentWidget::Ref, Uml::id_Reserved);
    } else if (tag == "signalwidget") {
        widget = new SignalWidget(view, SignalWidget::Send,  Uml::id_Reserved);
    } else if (tag == "floatingdashlinewidget") {
        widget = new FloatingDashLineWidget(view, Uml::id_Reserved);
    } else if (tag == "objectnodewidget") {
        widget = new ObjectNodeWidget(view, ObjectNodeWidget::Normal, Uml::id_Reserved);
    } else if (tag == "regionwidget") {
        widget = new RegionWidget(view, Uml::id_Reserved);
    } else if (tag == "pinwidget") {
        widget = new PinWidget(view, NULL, Uml::id_Reserved);
    }
    else
    {
        // Loading of widgets which represent an UMLObject

        // Find the UMLObject and create the Widget to represent it
        Uml::IDType id = STR2ID(idStr);
        UMLDoc *umldoc = UMLApp::app()->document();
        UMLObject *o = umldoc->findObjectById(id);
        if (o == NULL) {
            uDebug() << "makeWidgetFromXMI: cannot find object with id "
                << ID2STR(id) << endl;
        }

        if (tag == "actorwidget" || tag == "UML:ActorWidget") {
            if (validateObjType(Uml::ot_Actor, o, id))
                widget = new ActorWidget(view, static_cast<UMLActor*>(o));
        } else if (tag == "usecasewidget" || tag ==  "UML:UseCaseWidget") {
            if (validateObjType(Uml::ot_UseCase, o, id))
                widget = new UseCaseWidget(view, static_cast<UMLUseCase*>(o));
        } else if (tag == "classwidget" || tag == "UML:ClassWidget") {
            if (validateObjType(Uml::ot_Class, o, id))
                widget = new ClassifierWidget(view, static_cast<UMLClassifier*>(o));
        } else if (tag == "packagewidget") {
            if (validateObjType(Uml::ot_Package, o, id))
                widget = new PackageWidget(view, static_cast<UMLPackage*>(o));
        } else if (tag == "componentwidget") {
            if (validateObjType(Uml::ot_Component, o, id))
                widget = new ComponentWidget(view, static_cast<UMLComponent*>(o));
        } else if (tag == "nodewidget") {
            if (validateObjType(Uml::ot_Node, o, id))
                widget = new NodeWidget(view, static_cast<UMLNode*>(o));
        } else if (tag == "artifactwidget") {
            if (validateObjType(Uml::ot_Artifact, o, id))
                widget = new ArtifactWidget(view, static_cast<UMLArtifact*>(o));
        } else if (tag == "interfacewidget") {
            if (validateObjType(Uml::ot_Interface, o, id))
                widget = new ClassifierWidget(view, static_cast<UMLClassifier*>(o));
        } else if (tag == "datatypewidget") {
            if (validateObjType(Uml::ot_Datatype, o, id))
                widget = new DatatypeWidget(view, static_cast<UMLClassifier*>(o));
        } else if (tag == "enumwidget") {
            if (validateObjType(Uml::ot_Enum, o, id))
                widget = new EnumWidget(view, static_cast<UMLEnum*>(o));
        } else if (tag == "entitywidget") {
            if (validateObjType(Uml::ot_Entity, o, id))
                widget = new EntityWidget(view, static_cast<UMLEntity*>(o));
        } else if (tag == "categorywidget") {
            if (validateObjType(Uml::ot_Category, o, id))
                widget = new CategoryWidget(view, static_cast<UMLCategory*>(o));
        } else if (tag == "objectwidget" || tag == "UML:ObjectWidget") {
            widget = new ObjectWidget(view, o );
        } else {
            uWarning() << "Trying to create an unknown widget:" << tag;
        }
    }
    return widget;

}
Example #22
0
/** If clipboard has mime type application/x-uml-clip4,
Pastes the data from the clipboard into the current Doc */
bool UMLClipboard::pasteClip4(QMimeSource* data) {
    UMLDoc *doc = UMLApp::app()->getDocument();

    UMLObjectList objects;
    objects.setAutoDelete(false);


    UMLWidgetList               widgets;
    widgets.setAutoDelete(false);

    AssociationWidgetList       assocs;
    assocs.setAutoDelete(false);

    IDChangeLog* idchanges = 0;

    Uml::Diagram_Type diagramType;

    if( !UMLDrag::decodeClip4(data, objects, widgets, assocs, diagramType) ) {
        return false;
    }

    if( diagramType != UMLApp::app()->getCurrentView()->getType() ) {
        if( !checkPasteWidgets(widgets) ) {
            assocs.setAutoDelete(true);
            assocs.clear();
            return false;
        }
    }
    UMLObjectListIt object_it(objects);
    idchanges = doc->getChangeLog();
    if(!idchanges) {
        return false;
    }
     //make sure the file we are pasting into has the objects
     //we need if there are widgets to be pasted
     UMLObject* obj = 0;
     while ( (obj=object_it.current()) != 0 ) {
         ++object_it;

        if(!doc->assignNewIDs(obj)) {
            return false;
        }

     }

    //now add any widget we are want to paste
    bool objectAlreadyExists = false;
    UMLView *currentView = UMLApp::app()->getCurrentView();
    currentView->beginPartialWidgetPaste();
    UMLWidget* widget =0;
    UMLWidgetListIt widget_it(widgets);
    while ( (widget=widget_it.current()) != 0 ) {
        ++widget_it;

        Uml::IDType oldId = widget->getID();
        Uml::IDType newId = idchanges->findNewID(oldId);
        if (currentView->findWidget(newId)) {
            kError() << "UMLClipboard::pasteClip4: widget (oldID=" << ID2STR(oldId)
                << ", newID=" << ID2STR(newId) << ") already exists in target view."
                << endl;
            widgets.remove(widget);
            delete widget;
            objectAlreadyExists = true;
        } else if (! currentView->addWidget(widget, true)) {
            currentView->endPartialWidgetPaste();
            return false;
        }
    }

    //now paste the associations
    AssociationWidget* assoc;
    AssociationWidgetListIt assoc_it(assocs);
    while ( (assoc=assoc_it.current()) != 0 ) {
        ++assoc_it;
        if (!currentView->addAssociation(assoc, true)) {
            currentView->endPartialWidgetPaste();
            return false;
        }
    }

    //Activate all the pasted associations and widgets
    currentView->activate();
    currentView->endPartialWidgetPaste();

    /*
    UMLListView *listView = UMLApp::app()->getListView();
    UMLListViewItem* item = 0;
    UMLListViewItem* itemdata = 0;
    UMLListViewItemListIt it(itemdatalist);
    while ( (itemdata=it.current()) != 0 ) {
        item = listView->createItem(*itemdata, *idchanges);
        if(!item) {
            return false;
        }
        if(itemdata -> childCount()) {
            if(!pasteChildren(item, idchanges)) {
                return false;
            }
        }
        ++it;
        }*/

    if (objectAlreadyExists) {
        pasteItemAlreadyExists();
    }
    return true;
}
Example #23
0
LEXTOKEN Lexan::checkKeyword(void)
{
	// Check keywords
	if(m_string == "function")
		return LEX_FUNCTION;
	if(m_string == "return")
		return LEX_RETURN;
	if(m_string == "if")
		return LEX_IF;
	if(m_string == "else")
		return LEX_ELSE;
	if(m_string == "while")
		return LEX_WHILE;
	if(m_string == "for")
		return LEX_FOR;
	if(m_string == "foreach")
		return LEX_FOREACH;
	if(m_string == "break")
		return LEX_BREAK;
	if(m_string == "continue")
		return LEX_CONTINUE;
	if(m_string == "null")
		return LEX_NULL;
	if(m_string == "true")
		return LEX_TRUE;
	if(m_string == "false")
		return LEX_FALSE;
	if(m_string == "global")
		return LEX_GLOBAL;
	if(m_string == "__FILE__")
	{
		m_string = ID2STR(m_source.top()->getFile());
		return LEX_STRING;
	}
	if(m_string == "__LINE__")
	{
		m_int = m_source.top()->getLine();
		return LEX_INT;
	}
	if(m_string == "__FUNCTION__")
	{
		m_string = ID2STR(m_currently_processed_function);
		return LEX_STRING;
	}

	// Check include and define
	if(m_string == "include")
	{
		parseInclude();
		return nextToken();
	}
	if(m_string == "define")
	{
		parseDefine();
		return nextToken();
	}

	// Try to expand a macro
	if(expandMacro())
		return nextToken();

	// The string is variable or function name
	m_identifier = STR2ID(m_string);
	return LEX_IDENTIFIER;
}
Example #24
0
/**
 * Set the class attributes of this object from
 * the passed element node.
 */
void CodeParameter::setAttributesFromNode ( QDomElement & root)
{
    // set local attributes, parent object first
    QString idStr = root.attribute("parent_id","-1");
    Uml::IDType id = STR2ID(idStr);

    // always disconnect
    m_parentObject->disconnect(this);

    // now, what is the new object we want to set?
    UMLObject * obj = UMLApp::app()->document()->findObjectById(id);
    if(obj)
    {
        // FIX..one day.
        // Ugh. This is UGLY, but we have to do it this way because UMLRoles
        // don't go into the document list of UMLobjects, and have the same
        // ID as their parent UMLAssociations. So..the drill is then special
        // for Associations..in that case we need to find out which role will
        // serve as the parameter here. The REAL fix, of course, would be to
        // treat UMLRoles on a more even footing, but im not sure how that change
        // might ripple throughout the code and cause problems. Thus, since the
        // change appears to be needed for only this part, I'll do this crappy
        // change instead. -b.t.
        UMLAssociation * assoc = dynamic_cast<UMLAssociation*>(obj);
        if(assoc) {
            // In this case we init with indicated role child obj.
            UMLRole * role = 0;
            int role_id = root.attribute("role_id","-1").toInt();
            if(role_id == 1)
                role = assoc->getUMLRole(Uml::A);
            else if(role_id == 0)
                role = assoc->getUMLRole(Uml::B);
            else
                uError() << "corrupt save file? "
                << "cant get proper UMLRole for codeparameter uml id:"
                << ID2STR(id) << " w/role_id:" << role_id;

            // init using UMLRole obj
            initFields ( m_parentDocument, role);

        } else
            initFields ( m_parentDocument, obj); // just the regular approach

    } else
        uError() << "Cant load CodeParam: parentUMLObject w/id:"
        << ID2STR(id) << " not found, corrupt save file?";

    // other attribs now
    setInitialValue(root.attribute("initialValue",""));

    // load comment now
    // by looking for our particular child element
    QDomNode node = root.firstChild();
    QDomElement element = node.toElement();
    bool gotComment = false;
    while( !element.isNull() ) {
        QString tag = element.tagName();
        if( tag == "header" ) {
            QDomNode cnode = element.firstChild();
            QDomElement celem = cnode.toElement();
            getComment()->loadFromXMI(celem);
            gotComment = true;
            break;
        }
        node = element.nextSibling();
        element = node.toElement();
    }

    if(!gotComment)
        uWarning()<<" loadFromXMI : Warning: unable to initialize CodeComment in codeparam:"<<this;
}