From: vsv Date: Thu, 10 Jan 2019 12:27:32 +0000 (+0300) Subject: Issue #2754: Objects of the same type can not have the same name. X-Git-Tag: Jan2019~29 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c5352903243a909771af75a675bf16601301720c;p=modules%2Fshaper.git Issue #2754: Objects of the same type can not have the same name. --- diff --git a/src/XGUI/XGUI_Tools.cpp b/src/XGUI/XGUI_Tools.cpp index aafafbfce..e058ff8cf 100644 --- a/src/XGUI/XGUI_Tools.cpp +++ b/src/XGUI/XGUI_Tools.cpp @@ -166,16 +166,14 @@ bool canRename(const ObjectPtr& theObject, const QString& theName) return false; } } - else if ((aType == ModelAPI_ResultConstruction::group()) || - (aType == ModelAPI_ResultBody::group())) { + else { DocumentPtr aDoc = theObject->document(); ObjectPtr aObj = - aDoc->objectByName(ModelAPI_ResultConstruction::group(), theName.toStdString()); - if (!aObj.get()) - aObj = aDoc->objectByName(ModelAPI_ResultBody::group(), theName.toStdString()); + aDoc->objectByName(aType, theName.toStdString()); if (aObj.get()) { - QString aErrMsg(QObject::tr("Object with name %1 already exists.").arg(theName)); + QString aErrMsg(QObject::tr("%1 with name %2 already exists."). + arg(aType.c_str()).arg(theName)); // We can not use here a dialog box for message - // it will crash editing process in ObjectBrowser Events_InfoMessage("XGUI_Tools", aErrMsg.toStdString()).send();