[Uml-devel] kdesdk/umbrello/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Sun Feb 22 23:00:04 UTC 2004
CVS commit by okellogg:
createOperation: Support non-interactive operating mode, required by
class import code.
M +19 -14 umldoc.cpp 1.128
M +11 -8 umldoc.h 1.57
--- kdesdk/umbrello/umbrello/umldoc.cpp #1.127:1.128
@@ -865,5 +865,5 @@ UMLObject* UMLDoc::createStereotype(UMLC
UMLOperation* UMLDoc::createOperation(UMLClassifier* classifier,
const QString &name /*=null*/,
- UMLAttributeList *params )
+ UMLAttributeList *params /*=NULL*/)
{
if(!classifier)
@@ -873,5 +873,6 @@ UMLOperation* UMLDoc::createOperation(UM
return NULL;
}
- if (name != QString::null && !name.isEmpty()) {
+ bool nameNotSet = (name == QString::null || name.isEmpty());
+ if (! nameNotSet) {
UMLOperation *existingOp = classifier->checkOperationSignature(name, params);
if (existingOp)
@@ -879,5 +880,4 @@ UMLOperation* UMLDoc::createOperation(UM
}
UMLOperation *op = new UMLOperation(NULL, name, getUniqueID());
- op->setName( classifier->uniqChildName(Uml::ot_Operation) );
if (params)
{
@@ -890,4 +890,7 @@ UMLOperation* UMLDoc::createOperation(UM
}
}
+ if (nameNotSet || params == NULL) {
+ if (nameNotSet)
+ op->setName( classifier->uniqChildName(Uml::ot_Operation) );
do {
UMLOperationDialog operationDialogue(0, op);
@@ -896,9 +899,11 @@ UMLOperation* UMLDoc::createOperation(UM
return NULL;
} else if (classifier->checkOperationSignature(op->getName(), op->getParmList())) {
- KMessageBox::information(0, i18n("An operation with the same name and signature already exists. You can not add it again."));
+ KMessageBox::information(0,
+ i18n("An operation with the same name and signature already exists. You can not add it again."));
} else {
break;
}
} while(1);
+ }
// operation name is ok, formally add it to the classifier
--- kdesdk/umbrello/umbrello/umldoc.h #1.56:1.57
@@ -237,12 +237,15 @@ public:
/**
* Creates an operation in the current document.
- * The new Operation is already initialized with name, id, etc.
- * If no name is provided, or if the name given as parameter conflicts with
- * other operations in the classifier, an Operation Dialog is shown to ask the user
- * for a name and gives the chance to set other Op. properties
- * The Operation's signature is checked for validity within the parent classifier.
+ * The new operation is initialized with name, id, etc.
+ * If a method with the given profile already exists in the classifier,
+ * no new method is created and the existing operation is returned.
+ * If no name is provided, or if the params are NULL, an Operation
+ * Dialog is shown to ask the user for a name and parameters.
+ * The operation's signature is checked for validity within the parent
+ * classifier.
*
- * @return The new operation, or NULL if the operation could not be created because
- * for example, the user canceled the dialog or no appropriate name can be found.
+ * @return The new operation, or NULL if the operation could not be
+ * created because for example, the user canceled the dialog
+ * or no appropriate name can be found.
*/
UMLOperation* createOperation( UMLClassifier *parent,
More information about the umbrello-devel
mailing list