Commit 0629bb3d authored by Ralf Habacker's avatar Ralf Habacker

Refactor applying of data type related stuff from UMLOperationDialog into UMLDatatypeWidget.

CCBUG:60452
parent 2214b836
......@@ -414,17 +414,7 @@ bool UMLOperationDialog::apply()
m_operation->setName(name);
m_visibilityEnumWidget->apply();
QString typeName = m_datatypeWidget->currentText();
UMLTemplate *tmplParam = 0;
if (classifier) {
tmplParam = classifier->findTemplate(typeName);
}
if (tmplParam)
m_operation->setType(tmplParam);
else
m_operation->setTypeName(typeName);
m_datatypeWidget->apply();
m_stereotypeWidget->apply();
bool isAbstract = m_pAbstractCB->isChecked();
......
......@@ -124,6 +124,8 @@ bool UMLDatatypeWidget::apply()
{
if (m_datatype)
return applyAttribute();
else if (m_operation)
return applyOperation();
return false;
}
......@@ -174,6 +176,20 @@ bool UMLDatatypeWidget::applyAttribute()
return true;
}
bool UMLDatatypeWidget::applyOperation()
{
QString typeName = currentText();
UMLClassifier *classifier = dynamic_cast<UMLClassifier*>(m_operation->parent());
UMLTemplate *tmplParam = 0;
if (classifier) {
tmplParam = classifier->findTemplate(typeName);
}
if (tmplParam)
m_operation->setType(tmplParam);
else
m_operation->setTypeName(typeName);
return true;
}
/**
* Inserts @p type into the type-combobox as well as its completion object.
......
......@@ -47,6 +47,7 @@ protected:
UMLTemplate *m_template;
void init();
bool applyAttribute();
bool applyOperation();
void insertTypesSortedAttribute(const QString &type);
void insertTypesSortedEntityAttribute(const QString &type);
void insertTypesSortedOperation(const QString &type);
......
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