Ensure we have a consistent message when dropping server objects [Ashesh Vashi]
authordpage <dpage@a7884b65-44f6-0310-8a51-81a127f17b15>
Wed, 15 Apr 2009 09:18:20 +0000 (09:18 +0000)
committerdpage <dpage@a7884b65-44f6-0310-8a51-81a127f17b15>
Wed, 15 Apr 2009 09:18:20 +0000 (09:18 +0000)
git-svn-id: svn://svn.pgadmin.org/trunk/pgadmin3@7808 a7884b65-44f6-0310-8a51-81a127f17b15

pgadmin/frm/events.cpp

index 3345a3f840d5288e75558cec005cff0905a40505..c0eb5d1849b201fb06683f41faea8f147e2d998c 100644 (file)
@@ -668,8 +668,21 @@ bool frmMain::dropSingleObject(pgObject *data, bool updateFinal, bool cascaded)
             }
             else
             {
-                text = wxString::Format(_("Are you sure you wish to drop %s %s?"),
-                    data->GetTranslatedTypeName().c_str(), data->GetFullIdentifier().c_str());
+                /*
+                *  curerntObject is set using the following command.
+                *  i.e. currentObject = browser->GetObject(item);
+                *  While fetching this object using this code, somehow it looses its virtual table pointer.
+                *  Hence, it is not able to call the GetFullIdentifier - virtual function from the 
+                *  particular class, but it will always call this functions from pgObject class always.
+                *  To rectify this problem, we need to explicitly check the meta data type and call the
+                *  function from the particular class.
+                */
+                if (data->GetMetaType() == PGM_SERVER)
+                    text = wxString::Format(_("Are you sure you wish to drop %s \"%s\"?"),
+                        data->GetTranslatedTypeName().c_str(), ((pgServer*)data)->GetFullIdentifier().c_str());
+                else
+                    text = wxString::Format(_("Are you sure you wish to drop %s %s?"),
+                        data->GetTranslatedTypeName().c_str(), data->GetFullIdentifier().c_str());
                 caption = wxString::Format(_("Drop %s?"), data->GetTranslatedTypeName().c_str());
             }
             wxMessageDialog msg(this, text, caption, wxYES_NO | wxICON_QUESTION);