From 9634c8b7fcda94394ee04deeb96297646dd2c1b8 Mon Sep 17 00:00:00 2001
From: Daniel Ratiu <ratiu@fortiss.org>
Date: Thu, 10 Jan 2013 12:16:58 +0000
Subject: [PATCH] implementing category parent of prototypes categories refs
 694

---
 .../extension/base/PrototypeProviderBase.java |  3 ++-
 .../extension/data/PrototypeCategory.java     | 25 ++++++++++++++-----
 .../kernel/internal/PrototypeService.java     |  6 +++--
 3 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/base/PrototypeProviderBase.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/base/PrototypeProviderBase.java
index 622608431..c1c948eae 100644
--- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/base/PrototypeProviderBase.java
+++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/base/PrototypeProviderBase.java
@@ -39,7 +39,7 @@ import org.fortiss.tooling.kernel.extension.data.PrototypeCategory;
  * @author hoelzl
  * @author $Author$
  * @version $Rev$
- * @ConQAT.Rating YELLOW Hash: 266A6634327794A801F21F8E9018C35B
+ * @ConQAT.Rating YELLOW Hash: 07BDC65FD4A4D5A8C6EA22DB8128CDDA
  */
 public abstract class PrototypeProviderBase implements IPrototypeProvider {
 
@@ -103,6 +103,7 @@ public abstract class PrototypeProviderBase implements IPrototypeProvider {
 			registerPrototypeCategory(PrototypeCategory parent, String category) {
 		PrototypeCategory cat = registerPrototypeCategory(category);
 		parent.add(cat);
+		cat.setPrototypeCategoryParent(parent);
 		return cat;
 	}
 
diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/data/PrototypeCategory.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/data/PrototypeCategory.java
index ef4c1920f..3388957ed 100644
--- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/data/PrototypeCategory.java
+++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/data/PrototypeCategory.java
@@ -26,24 +26,27 @@ import java.util.List;
  * @author doebber
  * @author $Author$
  * @version $Rev$
- * @ConQAT.Rating GREEN Hash: E51B16B14246DBE6D73D62B1424E852F
+ * @ConQAT.Rating YELLOW Hash: 2C2B8C827EDAFE098F4D62B3EF94C1FC
  */
 public class PrototypeCategory {
 
-	/** Constructor. */
-	public PrototypeCategory(String category) {
-		categoryName = category;
-	}
-
 	/** Stores the name of the category. */
 	private final String categoryName;
 
+	/** Stores the parent of the category. */
+	private PrototypeCategory parentCategory;
+
 	/** Stores the prototypes affiliated with this category. */
 	private List<Prototype> children = new ArrayList<Prototype>();
 
 	/** Stores the sub-categories of this category. */
 	private List<PrototypeCategory> subCategories = new ArrayList<PrototypeCategory>();
 
+	/** Constructor. */
+	public PrototypeCategory(String category) {
+		categoryName = category;
+	}
+
 	/** Adds the prototype. */
 	public void add(Prototype prototype) {
 		children.add(prototype);
@@ -66,4 +69,14 @@ public class PrototypeCategory {
 	public String getName() {
 		return categoryName;
 	}
+
+	/** Sets the parent of this category. */
+	public void setPrototypeCategoryParent(PrototypeCategory parent) {
+		parentCategory = parent;
+	}
+
+	/** Returns parent of this category. */
+	public PrototypeCategory getParentCategory() {
+		return parentCategory;
+	}
 }
diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/PrototypeService.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/PrototypeService.java
index a3b5cada3..936d455a0 100644
--- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/PrototypeService.java
+++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/PrototypeService.java
@@ -44,7 +44,7 @@ import org.osgi.framework.Bundle;
  * @author hoelzl
  * @author $Author$
  * @version $Rev$
- * @ConQAT.Rating GREEN Hash: 7348244C108974051B1E151F2B83BD61
+ * @ConQAT.Rating YELLOW Hash: CC514D89E2985B7503F6EFA6E701B5A6
  */
 public class PrototypeService implements IPrototypeService {
 
@@ -130,7 +130,9 @@ public class PrototypeService implements IPrototypeService {
 
 		for(IPrototypeProvider provider : prototypeProviderList) {
 			for(PrototypeCategory currentCategory : provider.getCategories()) {
-				result.add(currentCategory);
+				if(currentCategory.getParentCategory() == null) {
+					result.add(currentCategory);
+				}
 			}
 		}
 
-- 
GitLab