Bug 561236 - Update EMF Graphical Viewer

Fixed some bugs with EObjectRefs visualization

Change-Id: I6dd4c916acaac8368ca8ac0e40d7304b3e6bb917
Signed-off-by: Dirk Fauth <dirk.fauth@de.bosch.com>
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emf.viewer.plantuml/src/org/eclipse/app4mc/emf/viewer/plantuml/handlers/ObjectContentHandler.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emf.viewer.plantuml/src/org/eclipse/app4mc/emf/viewer/plantuml/handlers/ObjectContentHandler.java
index 0708012..aae6a8c 100644
--- a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emf.viewer.plantuml/src/org/eclipse/app4mc/emf/viewer/plantuml/handlers/ObjectContentHandler.java
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emf.viewer.plantuml/src/org/eclipse/app4mc/emf/viewer/plantuml/handlers/ObjectContentHandler.java
@@ -58,6 +58,9 @@
 				Type[] genericInterfaces = eList.getClass().getGenericInterfaces();
 				
 				typeString = genericInterfaces.length > 0 ? genericInterfaces[0].getTypeName() : "";
+				
+				// replace generic information
+				typeString = typeString.replaceAll("<[a-zA-Z]+>", "");
 			}
 			return "Collection" + "_" + typeString + "__object_Content";
 		}
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emf.viewer.plantuml/src/org/eclipse/app4mc/emf/viewer/plantuml/views/DiagramView.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emf.viewer.plantuml/src/org/eclipse/app4mc/emf/viewer/plantuml/views/DiagramView.java
index aac859c..eed789b 100644
--- a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emf.viewer.plantuml/src/org/eclipse/app4mc/emf/viewer/plantuml/views/DiagramView.java
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emf.viewer.plantuml/src/org/eclipse/app4mc/emf/viewer/plantuml/views/DiagramView.java
@@ -29,6 +29,7 @@
 import org.eclipse.app4mc.emf.viewer.plantuml.handlers.EClassContentsAndHierarchyHandler;
 import org.eclipse.app4mc.emf.viewer.plantuml.handlers.EClassContentsFromReferenceHandler;
 import org.eclipse.app4mc.emf.viewer.plantuml.handlers.EClassHierarchyHandler;
+import org.eclipse.app4mc.emf.viewer.plantuml.handlers.EObjectRefsHandler;
 import org.eclipse.app4mc.emf.viewer.plantuml.handlers.ObjectContentHandler;
 import org.eclipse.app4mc.emf.viewer.plantuml.preferences.PreferenceConstants;
 import org.eclipse.app4mc.emf.viewer.plantuml.utils.ExecutionCategory;
@@ -196,6 +197,8 @@
 	
 	private void updateDiagram(Object eClass, EObject eObject) {
 
+		Object selected = eClass;
+		
 		/*
 		 * Regeneration of SVG Buffer for populating content specific to the selection
 		 */
@@ -209,12 +212,22 @@
 			handler = new EClassAllReferencesHandler();
 		} else if (ExecutionUtil.isExecuting(ExecutionCategory.eClassContentsFromReference)) {
 			handler = new EClassContentsFromReferenceHandler();
+		} else if (ExecutionUtil.isExecuting(ExecutionCategory.eObjectRefs)) {
+			handler = new EObjectRefsHandler();
+			if (eObject != null) {
+				// if the eObject is not null we use this for the visualization, otherwise maybe a collection was selected
+				selected = eObject;
+			}
 		} else {
 			/*- EClassContents and EObjectRefs behaviour is included in ObjectContentBuilder java class */
 			handler = new ObjectContentHandler();
+			if (eObject != null) {
+				// if the eObject is not null we use this for the visualization, otherwise maybe a collection was selected
+				selected = eObject;
+			}
 		}
 		
-		handler.execute(shell, sync, dotPath, genFolderPath, partService, eClass, eObject);
+		handler.execute(shell, sync, dotPath, genFolderPath, partService, selected, eObject);
 	}
 	
 	/**