+void HYDROGUI_ImportGeomObjectOp::updateDefaultName()
+{
+ // Get panel
+ HYDROGUI_GeomObjectDlg* aPanel = ::qobject_cast<HYDROGUI_GeomObjectDlg*>( inputPanel() );
+ if ( !aPanel ) {
+ return;
+ }
+
+ // Set the current GEOM object name to the panel
+ if ( myGeomObjects.count() == 1 ) {
+ SalomeApp_Study* aStudy =
+ dynamic_cast<SalomeApp_Study*>( module()->getApp()->activeStudy() );
+ if ( aStudy ) {
+ QString anEntry = myGeomObjects.first();
+ _PTR(SObject) aSObject( aStudy->studyDS()->FindObjectID( qPrintable(anEntry) ) );
+ if ( aSObject ) {
+ aPanel->setDefaultName( QString::fromStdString(aSObject->GetName()) );
+ }
+ }
+ }
+}
+
+/**
+ * Called when the operation perfomed by another module is finished.
+ * \param theModuleName the name of the module which perfomed the operation
+ * \param theOperationName the operation name
+ * \param theEntryList the list of the created objects entries
+ */
+void HYDROGUI_ImportGeomObjectOp::onExternalOperationFinished(
+ const QString& theModuleName, const QString& theOperationName,
+ const QStringList& theEntryList )
+{
+ // Process "Geometry" module operations with non-empty list of created objects only
+ if ( theModuleName != "Geometry" || theEntryList.isEmpty() ) {
+ return;
+ }
+
+ // Store the operation name
+ myGEOMOpName = theOperationName;
+
+ // Store the geom objects entries list
+ myGeomObjects = theEntryList;
+
+ // Update the default name of the HYDRO object
+ updateDefaultName();
+}
+
+void HYDROGUI_ImportGeomObjectOp::closeExternalOperationDlg()
+{
+ if ( myGEOMOpName.isEmpty() ) {
+ return;
+ }
+
+ SUIT_Desktop* aDesktop = module()->getApp()->desktop();
+ if ( aDesktop ) {
+ QList<QDialog*> aDialogs = aDesktop->findChildren<QDialog*>();
+ foreach ( QDialog* aDlg, aDialogs ) {
+ if ( typeid(*aDlg).name() == myGEOMOpName ) {
+ aDlg->close();
+ break;
+ }
+ }
+ }
+}
+