From 2f6c65c815222f350617353ad7f97bd3e87e8789 Mon Sep 17 00:00:00 2001
From: Daniel Ratiu <ratiu@fortiss.org>
Date: Tue, 4 Dec 2012 13:45:11 +0000
Subject: [PATCH] different improvements and fixes in the library refs 694

---
 .../kernel/utils/KernelModelElementUtils.java |  2 +-
 .../tooling/kernel/utils/PrototypesUtils.java | 48 +++++++++++++++++++
 2 files changed, 49 insertions(+), 1 deletion(-)
 create mode 100644 org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/utils/PrototypesUtils.java

diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/utils/KernelModelElementUtils.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/utils/KernelModelElementUtils.java
index 2e72bd5f2..70425e175 100644
--- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/utils/KernelModelElementUtils.java
+++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/utils/KernelModelElementUtils.java
@@ -33,7 +33,7 @@ import org.fortiss.tooling.kernel.service.IPersistencyService;
  * @author hoelzl
  * @author $Author$
  * @version $Rev$
- * @ConQAT.Rating GREEN Hash: 8E3FE62B80ACF1DA5FF9DCA2A91B2A3E
+ * @ConQAT.Rating YELLOW Hash: DFE80532CB79D43BBCC951603AA91A9B
  */
 public final class KernelModelElementUtils {
 
diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/utils/PrototypesUtils.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/utils/PrototypesUtils.java
new file mode 100644
index 000000000..31d1268dd
--- /dev/null
+++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/utils/PrototypesUtils.java
@@ -0,0 +1,48 @@
+/*--------------------------------------------------------------------------+
+$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $
+|                                                                          |
+| Copyright 2012 ForTISS GmbH                     |
+|                                                                          |
+| Licensed under the Apache License, Version 2.0 (the "License");          |
+| you may not use this file except in compliance with the License.         |
+| You may obtain a copy of the License at                                  |
+|                                                                          |
+|    http://www.apache.org/licenses/LICENSE-2.0                            |
+|                                                                          |
+| Unless required by applicable law or agreed to in writing, software      |
+| distributed under the License is distributed on an "AS IS" BASIS,        |
+| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
+| See the License for the specific language governing permissions and      |
+| limitations under the License.                                           |
++--------------------------------------------------------------------------*/
+package org.fortiss.tooling.kernel.utils;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.fortiss.tooling.kernel.extension.data.Prototype;
+import org.fortiss.tooling.kernel.service.IPrototypeService;
+
+/**
+ * Utility methods for dealing with prototypes.
+ * 
+ * @author ratiu
+ * @author $Author: hoelzl $
+ * @version $Rev: 18709 $
+ * @ConQAT.Rating YELLOW Hash: 6EE14E172A9708B6E42379AEB3A61219
+ */
+public class PrototypesUtils {
+
+	/** Returns a prototype with a given name that is composable with a given model element type. */
+	public static Prototype findPrototypeComposableWith(Class<? extends EObject> modelElementType,
+			String prototypeName) {
+		List<Prototype> prototypes =
+				IPrototypeService.INSTANCE.getComposablePrototypes(modelElementType);
+		for(Prototype prot : prototypes) {
+			if(prot.getName().equals(prototypeName)) {
+				return prot;
+			}
+		}
+		return null;
+	}
+}
-- 
GitLab