[Mobies-commit] [commit] r3812 - in GReAT/trunk/Tools/MetaGME2UMX: . MetaGME2UMX Interpreters

ksmyth at redhat1.isis.vanderbilt.edu ksmyth at redhat1.isis.vanderbilt.edu
Tue Aug 2 14:51:36 CDT 2011


Author: ksmyth
Date: Tue Aug  2 14:51:36 2011
New Revision: 3812

Log:
Print which Connections could have refport parent associations

Modified:
   GReAT/trunk/Tools/MetaGME2UMX/MetaGME2UML.h
   GReAT/trunk/Tools/MetaGME2UMX/MetaGME2UML_2.cpp
   GReAT/trunk/Tools/MetaGME2UMX/MetaGME2UMX Interpreters/UdmApp.cpp

Modified: GReAT/trunk/Tools/MetaGME2UMX/MetaGME2UML.h
==============================================================================
--- GReAT/trunk/Tools/MetaGME2UMX/MetaGME2UML.h	Mon Aug  1 13:46:20 2011	(r3811)
+++ GReAT/trunk/Tools/MetaGME2UMX/MetaGME2UML.h	Tue Aug  2 14:51:36 2011	(r3812)
@@ -20,7 +20,9 @@
 #ifndef META_GME_TO_UML
 #define META_GME_TO_UML
 
-#define GME_SILENT_MODE 128
+#include "stdafx.h"
+#include "Console.h"
+//#define GME_SILENT_MODE 128
 
 #ifdef GME_INTERPRETER_USED
 #include "stdafx.h"

Modified: GReAT/trunk/Tools/MetaGME2UMX/MetaGME2UML_2.cpp
==============================================================================
--- GReAT/trunk/Tools/MetaGME2UMX/MetaGME2UML_2.cpp	Mon Aug  1 13:46:20 2011	(r3811)
+++ GReAT/trunk/Tools/MetaGME2UMX/MetaGME2UML_2.cpp	Tue Aug  2 14:51:36 2011	(r3812)
@@ -28,6 +28,7 @@
 
 #include <iterator>
 #include "UdmUtil.h"
+#include "UdmGme.h"
 
 using namespace std;
 
@@ -1055,6 +1056,23 @@
 	return _GetAllConnections<UF>(f);
 }
 
+void print_refport_attr_explanation(const MetaGME::Connection& connection, const std::set<MetaGME::Reference>& refport_containers, const std::string& assoc_rolename, const std::string& s_or_d)
+{
+	std::string refport_container_names;
+	std::for_each(refport_containers.begin(), refport_containers.end(), [&](const MetaGME::Reference& ref){ 
+		refport_container_names += string(ref.name()) + ", ";
+	});
+	refport_container_names = refport_container_names.substr(0, refport_container_names.size() - 2);
+	string msg = "Connection <a href=\"mga:" + UdmGme::UdmId2GmeId(connection.uniqueId()) + "\">";
+	msg += string(connection.name()) + "</a> may have " + (s_or_d == "s" ? "source" : "destination") +" refport parent";
+	if (refport_containers.size() != 1)
+		msg += "s";
+	msg += " ";
+	msg += refport_container_names;
+	msg += ". Add \"" + s_or_d + "RefParent=" + assoc_rolename + "_refport_parent\" to the General Preferences attribute to generate refport container associations.";
+	GMEConsole::Console::Out::WriteLine(CString(msg.c_str()));
+}
+
 
 void MetaGME2UML::CreateRefportContainersAssociations(MetaGME::ParadigmSheet ps, UmlGME::ClassDiagram cd)
 {
@@ -1101,8 +1119,7 @@
 			string srcrolename = GetValueForName("sRefParent",prefMap);
 			string src_assoc_rolename = GetValueForName("sName",prefMap);
 
-			if (dstFco && dstrolename != "")
-			{
+			if (dstFco) {
 				std::string dstrrolename = GetValueForName("rdRefParent", prefMap);
 				if (dstrrolename == "") {
 					dstrrolename = dstrolename + "_rev";
@@ -1112,10 +1129,13 @@
 					std::set<MetaGME::Reference> src_refport_containers = GetRefportContainers(RefByProxy(srcFco), connection);
 					std::copy(src_refport_containers.begin(), src_refport_containers.end(), set_inserter(refport_containers));
 				}
-				CreateRefportContainerAssociation(connection, dst_assoc_rolename, dstrolename, dstrrolename, refport_containers, cd);
+				if (dstrolename != "")
+					CreateRefportContainerAssociation(connection, dst_assoc_rolename, dstrolename, dstrrolename, refport_containers, cd);
+				else if (refport_containers.size() > 0)
+					print_refport_attr_explanation(connection, refport_containers, dst_assoc_rolename, "d");
 			}
 
-			if (srcFco && srcrolename != "")
+			if (srcFco)
 			{
 				std::string srcrrolename = GetValueForName("rsRefParent", prefMap);
 				if (srcrrolename == "") {
@@ -1126,7 +1146,10 @@
 					std::set<MetaGME::Reference> dst_refport_containers = GetRefportContainers(RefByProxy(dstFco), connection);
 					std::copy(dst_refport_containers.begin(), dst_refport_containers.end(), set_inserter(refport_containers));
 				}
-				CreateRefportContainerAssociation(connection, src_assoc_rolename, srcrolename, srcrrolename, refport_containers, cd);
+				if (srcrolename != "")
+					CreateRefportContainerAssociation(connection, src_assoc_rolename, srcrolename, srcrrolename, refport_containers, cd);
+				else if (refport_containers.size() > 0)
+					print_refport_attr_explanation(connection, refport_containers, src_assoc_rolename, "s");
 			}
 		}
 	}

Modified: GReAT/trunk/Tools/MetaGME2UMX/MetaGME2UMX Interpreters/UdmApp.cpp
==============================================================================
--- GReAT/trunk/Tools/MetaGME2UMX/MetaGME2UMX Interpreters/UdmApp.cpp	Mon Aug  1 13:46:20 2011	(r3811)
+++ GReAT/trunk/Tools/MetaGME2UMX/MetaGME2UMX Interpreters/UdmApp.cpp	Tue Aug  2 14:51:36 2011	(r3812)
@@ -186,19 +186,6 @@
 
 		umlGme.CloseWithUpdate();
 		
-		cout << "the name is: " << name.c_str() << endl;
-		CString fn;
-		if(param != GME_SILENT_MODE)	
-		{	cout << "here" << endl;
-			fn = getFile.GetFileName();
-		}
-		else							
-		{	cout << "In here" << endl;
-			fn.Format("%s.mga",name.c_str());			
-		}
-		cout << "the name is: " << name.c_str() << endl;
-		cout << "the name is: " << fn << endl;
-
 		if(param != GME_SILENT_MODE)
 		{	AfxMessageBox("1. "+ fn + " has been Created\\Modified.\n2. Changes have been made to this metamodel.\n\nRun MetaGME Interpreter to reflect these changes in the paradigm.", MB_ICONINFORMATION);
 		}


More information about the Mobies-commit mailing list