If the user type a different type for the template, that isn't in the options, this template isn't saved. The saved templates appears in the template object in the scene, but a type insert by the user don't appear. Reproducible: Always Steps to Reproduce: 1.Create A class 2.Add a Template 3. Insert a new type 4. Press Ok Actual Results: The new type doesn't appear be saved and doesn't appear on the scene Expected Results: The type appear and is saved in the UmlObject
The oldest umbrello version I currently have access to shows also this bug, which is 2.15.3.
Bug is also present in older versions like 2.11.2.
This problem does not occur on using a pointer as data type e.g. test1234*.
Classifier widget and tree view requires to have an UMLTemplate class instance for showing the template datatype. The recent code has two bugs, which prevents adding of non pointer and non common data types as template datatype. In bool UMLDatatypeWidget::applyTemplate(), which got the data type related part of UMLTemplateDialog::apply() there is the following code: QString typeName = m_datatypeWidget->currentText(); UMLDoc *pDoc = UMLApp::app()->document(); UMLClassifierList namesList(pDoc->concepts()); * get all objects from logical root with type Class, Interface, Datatype, Enum, Entity, Package, Folder foreach (UMLClassifier* obj, namesList) { if (typeName == obj->name()) { * here a related classifier has been found and is set as template type. m_pTemplate->setType(obj); * because it does not return with TRUE the last occurence of the related type is used } } * only if no global objects has been found (which is never the case) the template type name is used. if (namesList.isEmpty()) { // not found. // FIXME: This implementation is not good yet. m_pTemplate->setTypeName(typeName); } The second bug is located in UMLClassifierListItem::setTypeName(), which in the recent state adds such an instance only for common data and pointer types [1], not for classes. void UMLClassifierListItem::setTypeName(const QString &type) { if (type.isEmpty() || type == QLatin1String("void")) { m_pSecondary = NULL; m_SecondaryId.clear(); return; } UMLDoc *pDoc = UMLApp::app()->document(); m_pSecondary = pDoc->findUMLObject(type); if (m_pSecondary == NULL) { // Make data type for easily identified cases [1] if (Model_Utils::isCommonDataType(type) || type.contains(QLatin1Char('*'))) { m_pSecondary = Object_Factory::createUMLObject(UMLObject::ot_Datatype, type); uDebug() << "created datatype for " << type; } else { m_SecondaryId = type; } } UMLObject::emitModified(); } In all other cases it sets m_secondaryID with the template datatype as text, which is not displayed in the tree view and classifier widget and not fetched on initial setup of UMLDataTypeWidget. /** * Overrides method from UMLClassifierListItem. * Returns the type name of the UMLTemplate. * If the template parameter is a class, there is no separate * type object. In this case, getTypeName() returns "class". * * @return The type name of the UMLClassifierListItem. */ QString UMLTemplate::getTypeName() const { if (m_pSecondary == NULL) return QLatin1String("class"); return m_pSecondary->name(); }