Updated label providers: fixed getChildrenFeatures(...) and getParent(...) related to virtual folders
diff --git a/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/ExtendedCommonElementsIP.java b/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/ExtendedCommonElementsIP.java
index 64558a8..e48b8a4 100644
--- a/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/ExtendedCommonElementsIP.java
+++ b/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/ExtendedCommonElementsIP.java
@@ -103,7 +103,7 @@
 
 	@Override
 	public Collection<? extends EStructuralFeature> getChildrenFeatures(final Object object) {
-		// Do not modify cached collection!
+		// Do NOT modify cached collection!
 		Set<? extends EStructuralFeature> result = new HashSet<>(super.getChildrenFeatures(object));
 
 		// reduce result
diff --git a/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/ExtendedComponentsModelIP.java b/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/ExtendedComponentsModelIP.java
index e40a2d2..da7389b 100644
--- a/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/ExtendedComponentsModelIP.java
+++ b/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/ExtendedComponentsModelIP.java
@@ -93,7 +93,7 @@
 
 	@Override
 	public Collection<? extends EStructuralFeature> getChildrenFeatures(final Object object) {
-		// Do not modify cached collection!
+		// Do NOT modify cached collection!
 		Set<? extends EStructuralFeature> result = new HashSet<>(super.getChildrenFeatures(object));
 
 		// reduce result
diff --git a/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/ExtendedHWModelIP.java b/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/ExtendedHWModelIP.java
index 531cbe3..2d7259e 100644
--- a/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/ExtendedHWModelIP.java
+++ b/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/ExtendedHWModelIP.java
@@ -93,7 +93,7 @@
 
 	@Override
 	public Collection<? extends EStructuralFeature> getChildrenFeatures(final Object object) {
-		// Do not modify cached collection!
+		// Do NOT modify cached collection!
 		Set<? extends EStructuralFeature> result = new HashSet<>(super.getChildrenFeatures(object));
 
 		// reduce result
diff --git a/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/ExtendedSWModelIP.java b/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/ExtendedSWModelIP.java
index a412f52..fb2f25e 100644
--- a/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/ExtendedSWModelIP.java
+++ b/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/ExtendedSWModelIP.java
@@ -206,7 +206,7 @@
 
 	@Override
 	public Collection<? extends EStructuralFeature> getChildrenFeatures(final Object object) {
-		// Do not modify cached collection!
+		// Do NOT modify cached collection!
 		Set<? extends EStructuralFeature> result = new HashSet<>(super.getChildrenFeatures(object));
 
 		// reduce result
diff --git a/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/comp/extended/ExtendedCompositeIP.java b/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/comp/extended/ExtendedCompositeIP.java
index b6361fe..ef3e40d 100644
--- a/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/comp/extended/ExtendedCompositeIP.java
+++ b/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/comp/extended/ExtendedCompositeIP.java
@@ -15,7 +15,9 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 import org.eclipse.app4mc.amalthea.model.AmaltheaPackage;
 import org.eclipse.app4mc.amalthea.model.ComponentsModel;
@@ -62,11 +64,26 @@
 	}
 
 	@Override
+	protected EStructuralFeature getChildFeature(Object object, Object child) {
+		
+		for (EStructuralFeature feature : super.getChildrenFeatures(object)) {
+			if (isValidValue(object, child, feature)) {
+				return feature;
+			}
+		}
+		return null;
+	}
+
+	@Override
 	public Collection<? extends EStructuralFeature> getChildrenFeatures(final Object object) {
-		super.getChildrenFeatures(object);
-		this.childrenFeatures.remove(this.featureCONNECTORS);
-		this.childrenFeatures.remove(this.featureINSTANCES);
-		return this.childrenFeatures;
+		// Do NOT modify cached collection!
+		Set<? extends EStructuralFeature> result = new HashSet<>(super.getChildrenFeatures(object));
+
+		// reduce result
+		result.remove(this.featureCONNECTORS);
+		result.remove(this.featureINSTANCES);
+
+		return result;
 	}
 
 	@Override
diff --git a/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/comp/extended/ExtendedSystemIP.java b/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/comp/extended/ExtendedSystemIP.java
index 7ae0416..4fdcdef 100644
--- a/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/comp/extended/ExtendedSystemIP.java
+++ b/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/comp/extended/ExtendedSystemIP.java
@@ -15,7 +15,9 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 import org.eclipse.app4mc.amalthea.model.AmaltheaPackage;
 import org.eclipse.app4mc.amalthea.model.ISystem;
@@ -58,11 +60,26 @@
 	}
 
 	@Override
+	protected EStructuralFeature getChildFeature(Object object, Object child) {
+		
+		for (EStructuralFeature feature : super.getChildrenFeatures(object)) {
+			if (isValidValue(object, child, feature)) {
+				return feature;
+			}
+		}
+		return null;
+	}
+
+	@Override
 	public Collection<? extends EStructuralFeature> getChildrenFeatures(final Object object) {
-		super.getChildrenFeatures(object);
-		this.childrenFeatures.remove(this.featureCONNECTORS);
-		this.childrenFeatures.remove(this.featureINSTANCES);
-		return this.childrenFeatures;
+		// Do NOT modify cached collection!
+		Set<? extends EStructuralFeature> result = new HashSet<>(super.getChildrenFeatures(object));
+
+		// reduce result
+		result.remove(this.featureCONNECTORS);
+		result.remove(this.featureINSTANCES);
+
+		return result;
 	}
 
 	@Override
diff --git a/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/hw/extended/ExtendedConnectionHandlerIP.java b/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/hw/extended/ExtendedConnectionHandlerIP.java
index d4fb3ed..24ed71a 100644
--- a/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/hw/extended/ExtendedConnectionHandlerIP.java
+++ b/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/hw/extended/ExtendedConnectionHandlerIP.java
@@ -1,6 +1,6 @@
 /**
  ********************************************************************************
- * Copyright (c) 2015-2018 Robert Bosch GmbH and others.
+ * Copyright (c) 2015-2021 Robert Bosch GmbH and others.
  * 
  * This program and the accompanying materials are made
  * available under the terms of the Eclipse Public License 2.0
@@ -28,10 +28,17 @@
 	 */
 	@Override
 	public Object getParent(final Object object) {
-		final Object hwStructure = super.getParent(object);
-		final ExtendedHwStructureIP hwStructureItemProvider = (ExtendedHwStructureIP) this.adapterFactory
-				.adapt(hwStructure, ITreeItemContentProvider.class);
-		return hwStructureItemProvider != null ? hwStructureItemProvider.getModulesContainerIP((HwStructure) hwStructure) : null;
+		final Object parent = super.getParent(object);
+
+		// if parent is HwStructure then adapt to modules container
+		if (parent instanceof HwStructure) {
+			final Object parentIP = this.adapterFactory.adapt(parent, ITreeItemContentProvider.class);
+			if (parentIP instanceof ExtendedHwStructureIP) {
+				return ((ExtendedHwStructureIP) parentIP).getModulesContainerIP((HwStructure) parent);
+			}
+		}
+
+		return parent;
 	}
 
 }
diff --git a/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/hw/extended/ExtendedHwConnectionIP.java b/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/hw/extended/ExtendedHwConnectionIP.java
index 3d591ad..f4c6284 100644
--- a/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/hw/extended/ExtendedHwConnectionIP.java
+++ b/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/hw/extended/ExtendedHwConnectionIP.java
@@ -30,11 +30,11 @@
 	public Object getParent(final Object object) {
 		final Object parent = super.getParent(object);
 
-		// if parent is HwStructure then adapt to modules container
+		// if parent is HwStructure then adapt to connections container
 		if (parent instanceof HwStructure) {
 			final Object parentIP = this.adapterFactory.adapt(parent, ITreeItemContentProvider.class);
 			if (parentIP instanceof ExtendedHwStructureIP) {
-				return ((ExtendedHwStructureIP) parentIP).getModulesContainerIP((HwStructure) parent);
+				return ((ExtendedHwStructureIP) parentIP).getConnectionsContainerIP((HwStructure) parent);
 			}
 		}
 
diff --git a/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/hw/extended/ExtendedHwStructureIP.java b/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/hw/extended/ExtendedHwStructureIP.java
index 070cb2e..414c17b 100644
--- a/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/hw/extended/ExtendedHwStructureIP.java
+++ b/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/hw/extended/ExtendedHwStructureIP.java
@@ -15,7 +15,9 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 import org.eclipse.app4mc.amalthea.model.AmaltheaPackage;
 import org.eclipse.app4mc.amalthea.model.HwStructure;
@@ -33,6 +35,7 @@
 
 public class ExtendedHwStructureIP extends HwStructureItemProvider {
 
+	// Container item providers
 	protected HwConnectionContainerIP hwConnectionCIP;
 	protected HwModuleContainerIP hwModuleCIP;
 
@@ -58,11 +61,26 @@
 	}
 
 	@Override
+	protected EStructuralFeature getChildFeature(Object object, Object child) {
+		
+		for (EStructuralFeature feature : super.getChildrenFeatures(object)) {
+			if (isValidValue(object, child, feature)) {
+				return feature;
+			}
+		}
+		return null;
+	}
+
+	@Override
 	public Collection<? extends EStructuralFeature> getChildrenFeatures(final Object object) {
-		super.getChildrenFeatures(object);
-		this.childrenFeatures.remove(this.featureCONNECTIONS);
-		this.childrenFeatures.remove(this.featureMODULES);
-		return this.childrenFeatures;
+		// Do NOT modify cached collection!
+		Set<? extends EStructuralFeature> result = new HashSet<>(super.getChildrenFeatures(object));
+
+		// reduce result
+		result.remove(this.featureCONNECTIONS);
+		result.remove(this.featureMODULES);
+
+		return result;
 	}
 
 	@Override
@@ -95,8 +113,7 @@
 		return createWrappedCommand(super.createRemoveCommand(domain, owner, feature, collection), owner, feature);
 	}
 
-	protected Command createWrappedCommand(final Command command, final EObject owner,
-			final EStructuralFeature feature) {
+	protected Command createWrappedCommand(final Command command, final EObject owner, final EStructuralFeature feature) {
 		if (feature == featureCONNECTIONS || feature == featureMODULES) {
 			return new CommandWrapper(command) {
 				@Override
diff --git a/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/hw/extended/ExtendedMemoryIP.java b/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/hw/extended/ExtendedMemoryIP.java
index e34289f..fc95ad1 100644
--- a/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/hw/extended/ExtendedMemoryIP.java
+++ b/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/hw/extended/ExtendedMemoryIP.java
@@ -1,6 +1,6 @@
 /**
  ********************************************************************************
- * Copyright (c) 2015-2018 Robert Bosch GmbH and others.
+ * Copyright (c) 2015-2021 Robert Bosch GmbH and others.
  * 
  * This program and the accompanying materials are made
  * available under the terms of the Eclipse Public License 2.0
@@ -28,10 +28,17 @@
 	 */
 	@Override
 	public Object getParent(final Object object) {
-		final Object hwStructure = super.getParent(object);
-		final ExtendedHwStructureIP hwStructureItemProvider = (ExtendedHwStructureIP) this.adapterFactory
-				.adapt(hwStructure, ITreeItemContentProvider.class);
-		return hwStructureItemProvider != null ? hwStructureItemProvider.getModulesContainerIP((HwStructure) hwStructure) : null;
+		final Object parent = super.getParent(object);
+
+		// if parent is HwStructure then adapt to modules container
+		if (parent instanceof HwStructure) {
+			final Object parentIP = this.adapterFactory.adapt(parent, ITreeItemContentProvider.class);
+			if (parentIP instanceof ExtendedHwStructureIP) {
+				return ((ExtendedHwStructureIP) parentIP).getModulesContainerIP((HwStructure) parent);
+			}
+		}
+
+		return parent;
 	}
 
 }
diff --git a/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/hw/extended/ExtendedProcessingUnitIP.java b/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/hw/extended/ExtendedProcessingUnitIP.java
index 27d8a65..98fbf7a 100644
--- a/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/hw/extended/ExtendedProcessingUnitIP.java
+++ b/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/hw/extended/ExtendedProcessingUnitIP.java
@@ -1,6 +1,6 @@
 /**
  ********************************************************************************
- * Copyright (c) 2015-2018 Robert Bosch GmbH and others.
+ * Copyright (c) 2015-2021 Robert Bosch GmbH and others.
  * 
  * This program and the accompanying materials are made
  * available under the terms of the Eclipse Public License 2.0
@@ -28,10 +28,17 @@
 	 */
 	@Override
 	public Object getParent(final Object object) {
-		final Object hwStructure = super.getParent(object);
-		final ExtendedHwStructureIP hwStructureItemProvider = (ExtendedHwStructureIP) this.adapterFactory
-				.adapt(hwStructure, ITreeItemContentProvider.class);
-		return hwStructureItemProvider != null ? hwStructureItemProvider.getModulesContainerIP((HwStructure) hwStructure) : null;
+		final Object parent = super.getParent(object);
+
+		// if parent is HwStructure then adapt to modules container
+		if (parent instanceof HwStructure) {
+			final Object parentIP = this.adapterFactory.adapt(parent, ITreeItemContentProvider.class);
+			if (parentIP instanceof ExtendedHwStructureIP) {
+				return ((ExtendedHwStructureIP) parentIP).getModulesContainerIP((HwStructure) parent);
+			}
+		}
+
+		return parent;
 	}
 
 }
diff --git a/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/sw/extended/ExtendedRunnableIP.java b/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/sw/extended/ExtendedRunnableIP.java
index f527cfc..926c91f 100644
--- a/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/sw/extended/ExtendedRunnableIP.java
+++ b/plugins/org.eclipse.app4mc.amalthea.model.edit.extended/src/org/eclipse/app4mc/amalthea/model/edit/sw/extended/ExtendedRunnableIP.java
@@ -15,7 +15,9 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 import org.eclipse.app4mc.amalthea.model.AmaltheaPackage;
 import org.eclipse.app4mc.amalthea.model.Runnable;
@@ -57,10 +59,25 @@
 	}
 
 	@Override
+	protected EStructuralFeature getChildFeature(Object object, Object child) {
+		
+		for (EStructuralFeature feature : super.getChildrenFeatures(object)) {
+			if (isValidValue(object, child, feature)) {
+				return feature;
+			}
+		}
+		return null;
+	}
+
+	@Override
 	public Collection<? extends EStructuralFeature> getChildrenFeatures(final Object object) {
-		super.getChildrenFeatures(object);
-		this.childrenFeatures.remove(this.featurePARAMETERS);
-		return this.childrenFeatures;
+		// Do NOT modify cached collection!
+		Set<? extends EStructuralFeature> result = new HashSet<>(super.getChildrenFeatures(object));
+
+		// reduce result
+		result.remove(this.featurePARAMETERS);
+
+		return result;
 	}
 
 	@Override