Commit 129ebb73 authored by Oliver Kellogg's avatar Oliver Kellogg
Browse files

Small fixes for IDLImport:

umbrello/codeimport/import_utils.cpp
- In function createGeneralization(UMLClassifier*, UMLClassifier*), if
  child->umlPackage() is non null then
  - set UMLPackage of assoc to child->umlPackage();
  - add association at child instead of at Logical View.

umbrello/codeimport/idlimport.cpp
- In function skipStructure remove call to skipStmt().
  Reason: This is done by NativeImportBase::parseFile().
- In function parseStmt handling of alias-typedef of non template type
  flesh out conveying of the existing type:
  - If oldType is found by m_doc->findUMLObject then use the returned
    UMLObject instead of creating a new one;
  - Create generalization from new classifier to existing classifier.
    Note that in case of alias-typedef of datatypes this does not show
    up yet in diagrams etc. because associations are not saved in class
    UMLDatatype. This is a TODO for future change.
         skipStmt();
         return true;
- In function parseStmt handling of valuetype set the stereotype
  "idlValue" on m_klass.
parent d18794a6
......@@ -235,7 +235,7 @@ bool IDLImport::parseFile(const QString& filename)
bool IDLImport::skipStructure()
{
bool status = skipToClosing(QLatin1Char('{')); // skip to '}'
skipStmt(); // IDL blocks are terminated using "};". Skip ';' after '}'
// Skipping of ';' after '}' is done by NativeImportBase::parseFile
return status;
}
......@@ -486,9 +486,26 @@ bool IDLImport::parseStmt()
uDebug() << "parseStmt(typedef) : oldType is " << oldType
<< ", newType is " << newType
<< ", scopeIndex is " << scopeIndex();
Import_Utils::createUMLObject(UMLObject::ot_Class, newType, currentScope(),
m_comment, QLatin1String("idlTypedef") /* stereotype */);
// @todo How do we convey the existingType ?
UMLObject::ObjectType ot = UMLObject::ot_Class;
UMLObject *pOld = m_doc->findUMLObject(oldType, UMLObject::ot_UMLObject, currentScope());
if (pOld) {
ot = pOld->baseType();
} else {
pOld = Import_Utils::createUMLObject(ot, oldType, currentScope());
}
UMLClassifier *oldClassifier = pOld->asUMLClassifier();
UMLObject *pNew = Import_Utils::createUMLObject(ot, newType, currentScope(), m_comment,
QLatin1String("idlTypedef")); /* stereotype */
UMLClassifier *newClassifier = pNew->asUMLClassifier();
if (oldClassifier == 0) {
log(QLatin1String("Error: importIDL(typedef ") + newType +
QLatin1String("): Origin type ") + oldType + QLatin1String(" is not a classifier"));
} else if (newClassifier == 0) {
log(QLatin1String("Error: importIDL(typedef ") + newType +
QLatin1String(") internal error: Import_Utils::createUMLObject did not return a classifier"));
} else {
Import_Utils::createGeneralization(newClassifier, oldClassifier);
}
skipStmt();
return true;
}
......@@ -508,6 +525,7 @@ bool IDLImport::parseStmt()
UMLObject *ns = Import_Utils::createUMLObject(UMLObject::ot_Class,
name, currentScope(), m_comment);
m_klass = ns->asUMLClassifier();
m_klass->setStereotype(QLatin1String("idlValue"));
m_klass->setAbstract(m_isAbstract);
m_isAbstract = false;
if (advance() == QLatin1String(";")) // forward declaration
......
......@@ -614,9 +614,17 @@ UMLAssociation *createGeneralization(UMLClassifier *child, UMLClassifier *parent
association = Uml::AssociationType::Realization;
}
UMLAssociation *assoc = new UMLAssociation(association, child, parent);
UMLDoc *umldoc = UMLApp::app()->document();
assoc->setUMLPackage(umldoc->rootFolder(Uml::ModelType::Logical));
umldoc->addAssociation(assoc);
if (child->umlPackage()) {
assoc->setUMLPackage(child->umlPackage());
child->addAssociationEnd(assoc);
} else {
uDebug() << "Import_Utils::createGeneralization(child " << child->name()
<< ", parent " << parent->name() << ") : Package is not set on child";
UMLDoc *umldoc = UMLApp::app()->document();
UMLPackage *owningPackage = umldoc->rootFolder(Uml::ModelType::Logical);
assoc->setUMLPackage(owningPackage);
umldoc->addAssociation(assoc);
}
return assoc;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment