#include "SalomeApp_Application.h"
#include "SalomeApp_DataModel.h"
#include "SalomeApp_Study.h"
+#include "SalomeApp_DataObject.h"
#include "SalomeApp_CheckFileDlg.h"
#include "LightApp_SelectionMgr.h"
\brief Return \c true if object can be renamed
*/
bool VisuGUI::renameAllowed( const QString& entry) const {
- bool appRes = SalomeApp_Module::renameAllowed(entry);
- if( !appRes )
+
+ SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ SalomeApp_Study* appStudy = app ? dynamic_cast<SalomeApp_Study*>( app->activeStudy() ) : 0;
+ SalomeApp_DataObject* obj = appStudy ? dynamic_cast<SalomeApp_DataObject*>(appStudy->findObjectByEntry(entry)) : 0;
+
+ if(!app || !appStudy || !obj)
+ return false;
+
+ if(appStudy->isComponent(entry) || obj->isReference())
return false;
+
VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( GetAppStudy(this), qPrintable(entry) );
VISU::Base_i* aBase = anObjectInfo.myBase;
\brief Return \c true if rename operation finished successfully, \c false otherwise.
*/
bool VisuGUI::renameObject( const QString& entry, const QString& name) {
- bool appRes = SalomeApp_Module::renameObject(entry, name);
- if( !appRes )
+
+ SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication());
+ SalomeApp_Study* appStudy = app ? dynamic_cast<SalomeApp_Study*>( app->activeStudy() ) : 0;
+
+ if(!appStudy)
return false;
+ _PTR(Study) aStudy = appStudy->studyDS();
+
+ if(!aStudy)
+ return false;
+
+ bool aLocked = (_PTR(AttributeStudyProperties)(appStudy->studyDS()->GetProperties()))->IsLocked();
+ if ( aLocked ) {
+ SUIT_MessageBox::warning ( app->desktop(), QObject::tr("WRN_WARNING"), QObject::tr("WRN_STUDY_LOCKED") );
+ return false;
+ }
+
VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this) , qPrintable(entry) );
_PTR(SObject) aSObject = anObjectInfo.mySObject;