[commit] r2103 - trunk/GME/Gme

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Wed Nov 7 10:28:28 CST 2012


Author: ksmyth
Date: Wed Nov  7 10:28:28 2012
New Revision: 2103

Log:
Show error message if user tries to connect two objects that may not be connected (according to the meta)

Modified:
   trunk/GME/Gme/GMEView.cpp

Modified: trunk/GME/Gme/GMEView.cpp
==============================================================================
--- trunk/GME/Gme/GMEView.cpp	Wed Nov  7 10:28:06 2012	(r2102)
+++ trunk/GME/Gme/GMEView.cpp	Wed Nov  7 10:28:28 2012	(r2103)
@@ -4133,13 +4133,12 @@
 			if (dstPort) CGMEEventLogger::LogGMEEvent(_T("    dstPort=")+dstPort->GetName()+_T(" ")+dstPort->GetID()+_T("\r\n"));
 		}
 		COMTHROW(doc->resolver->put_IsStickyEnabled(nosticky ? VARIANT_FALSE :VARIANT_TRUE));
-		COMTHROW(doc->resolver->get_ConnRoleByMeta(	currentModel,
+		role = doc->resolver->ConnRoleByMeta[currentModel,
 													aspect,
 													src->mgaFco,
 													srcPort ? srcPort->mgaFco : NULL,
 													dst->mgaFco,
-													dstPort ? dstPort->mgaFco : NULL,
-													&role));
+													dstPort ? dstPort->mgaFco : NULL];
 		CComPtr<IMgaFCO> conn;
 		if(role != 0) {
 			CComObjPtr<IMgaFCOs> srcRefs, dstRefs;
@@ -4166,13 +4165,12 @@
 			}
 // Bakay hack ends
 */
-			COMTHROW(currentModel->CreateSimpleConn(
+			conn = currentModel->__CreateSimpleConn(
 				role,
 				srcPort ? srcPort->mgaFco : src->mgaFco,
 				dstPort ? dstPort->mgaFco : dst->mgaFco,
 				srcRefs,
-				dstRefs,
-				&conn));
+				dstRefs);
 			CComBSTR nm;
 			COMTHROW(role->get_DisplayedName(&nm));
 			COMTHROW(conn->put_Name(nm));
@@ -4230,6 +4228,21 @@
         // deleted form the gui if the committransaction failed
 		ret = false;
 	}
+	catch(_com_error &e) {
+		AbortTransaction(e.Error());
+		CString error = _T("Cannot create connection");
+		if (e.Description().length() != 0)
+		{
+			error += _T(": ");
+			error += static_cast<const TCHAR*>(e.Description());
+		}
+		CGMEEventLogger::LogGMEEvent(error + _T("\r\n"));
+		AfxMessageBox(error,MB_ICONSTOP | MB_OK);
+
+        Reset(true); // BGY: something similar needed, otherwise the created conenction not 
+        // deleted form the gui if the committransaction failed
+		ret = false;
+	}
 	// error messages output to the console window
 	// or simple refreshing of ActiveBrowser might leave
 	// the focus set to another window, thus making the


More information about the gme-commit mailing list