Commit 8495de1a authored by Ralf Habacker's avatar Ralf Habacker
Browse files

Avoid duplicate Invoker and other classes from importing bug 330018 testcase.

It was required to refactor the newly added 'doNotSearch' Import_Utils::createUMLObject()
parameter to a real 'searchInParentPackageOnly' strategy.

This enables classes with the same name in different name spaces.

CCBUG:330018
CCBUG:368810
parent b32539ea
......@@ -171,7 +171,7 @@ UMLObject *createUMLObject(UMLObject::ObjectType type,
UMLPackage *parentPkg,
const QString& comment,
const QString& stereotype,
bool doNotSearch)
bool searchInParentPackageOnly)
{
QString name = inName;
UMLDoc *umldoc = UMLApp::app()->document();
......@@ -192,14 +192,14 @@ UMLObject *createUMLObject(UMLObject::ObjectType type,
name = name.mid(2);
parentPkg = logicalView;
}
UMLObject *o = NULL;
if (!doNotSearch) {
o = umldoc->findUMLObject(name, type, parentPkg);
bNewUMLObjectWasCreated = false;
} else {
o = Object_Factory::createNewUMLObject(type, name, parentPkg);
bNewUMLObjectWasCreated = true;
bPutAtGlobalScope = false;
UMLObject *o = umldoc->findUMLObject(name, type, parentPkg);
bNewUMLObjectWasCreated = false;
if (searchInParentPackageOnly) {
if (o && o->umlPackage() != parentPkg) {
o = Object_Factory::createNewUMLObject(type, name, parentPkg);
bNewUMLObjectWasCreated = true;
bPutAtGlobalScope = false;
}
}
if (o == NULL) {
// Strip possible adornments and look again.
......
......@@ -38,7 +38,7 @@ namespace Import_Utils {
UMLPackage *parentPkg = NULL,
const QString& comment = QString(),
const QString& stereotype = QString(),
bool doNotSearch = false);
bool searchInParentPackageOnly = false);
void putAtGlobalScope(bool yesno);
......
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