Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 357618 - Respect readonly properties
Summary: Respect readonly properties
Status: CLOSED FIXED
Alias: None
Product: ECP
Classification: Modeling
Component: Editor (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 0.8.9   Edit
Assignee: Franziska Haunolder CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-14 07:48 EDT by Nikolay Kasyanov CLA
Modified: 2012-05-07 10:47 EDT (History)
1 user (show)

See Also:


Attachments
Solves the bug. (61.85 KB, text/plain)
2011-11-14 13:42 EST, David CLA
no flags Details
Solves the bug. (9.68 KB, patch)
2011-11-22 09:11 EST, David CLA
eclipse: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nikolay Kasyanov CLA 2011-09-14 07:48:38 EDT
Build Identifier: M20110909-1335

Looks like ECP ignores if an feature's "Property Type" is set to read only and allows editing of that feature.

Reproducible: Always

Steps to Reproduce:
1.Create some ecore metamodel.
2.Create genmodel.
3.Set "Property Type" as "Readonly" for some feature.
4.Start ECP with given metamodel,
5.Open model element, see that feature can be changed
Comment 1 Jonas Helming CLA 2011-09-14 07:54:09 EDT
that is correct, currently the widgets do not support read only mode. Is this required for all widgets?
Comment 2 Jonas Helming CLA 2011-09-19 11:04:53 EDT
as we discussed, the easiest way would be to add a new annotation. Are you planning a contribution?
Comment 3 Jonas Helming CLA 2011-09-19 11:41:43 EDT
sorry the last comment was not meant for this BR.
Comment 4 Jonas Helming CLA 2011-11-11 05:20:53 EST
we are working on this for 0.9.0M1
Comment 5 David CLA 2011-11-14 13:42:26 EST
Created attachment 206971 [details]
Solves the bug.
Comment 6 David CLA 2011-11-22 09:06:37 EST
Comment on attachment 206971 [details]
Solves the bug.

diff --git a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MEBoolControl.java b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MEBoolControl.java
index 33d1530..7c06add 100644
--- a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MEBoolControl.java
+++ b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MEBoolControl.java
@@ -45,6 +45,9 @@ public class MEBoolControl extends AbstractMEControl {
 		Object feature = getItemPropertyDescriptor().getFeature(getModelElement());

 		this.attribute = (EAttribute) feature;

 		check = getToolkit().createButton(parent, "", SWT.CHECK);

+		if (!getItemPropertyDescriptor().canSetProperty(getModelElement())) {

+			check.setEnabled(false);

+		}

 		IObservableValue model = EMFEditObservables.observeValue(getEditingDomain(), getModelElement(), attribute);

 		EMFDataBindingContext dbc = new EMFDataBindingContext();

 		dbc.bindValue(SWTObservables.observeSelection(check), model, null, null);

diff --git a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MEDoubleControl.java b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MEDoubleControl.java
index e9f8fc0..115cae1 100644
--- a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MEDoubleControl.java
+++ b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MEDoubleControl.java
@@ -65,6 +65,9 @@ public class MEDoubleControl extends AbstractMEControl {
 		spinner.setDigits(digits);

 		spinner.setMinimum(-1000000);

 		spinner.setMaximum(1000000);

+		if (!getItemPropertyDescriptor().canSetProperty(getModelElement())) {

+			spinner.setEnabled(false);

+		}

 		IObservableValue model = EMFEditObservables.observeValue(getEditingDomain(), getModelElement(), attribute);

 		EMFDataBindingContext dbc = new EMFDataBindingContext();

 		DoubleSpinnerObservable spinnerObservable = new DoubleSpinnerObservable(spinner);

diff --git a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MEIntControl.java b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MEIntControl.java
index 6bf5156..7ba28d1 100644
--- a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MEIntControl.java
+++ b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MEIntControl.java
@@ -46,6 +46,9 @@ public class MEIntControl extends AbstractMEControl {
 		spinner = new Spinner(parent, style);

 		spinner.setMinimum(-1000);

 		spinner.setMaximum(1000);

+		if (!getItemPropertyDescriptor().canSetProperty(getModelElement())) {

+			spinner.setEnabled(false);

+		}

 		IObservableValue model = EMFEditObservables.observeValue(getEditingDomain(), getModelElement(), attribute);

 		EMFDataBindingContext dbc = new EMFDataBindingContext();

 		dbc.bindValue(SWTObservables.observeSelection(spinner), model, null, null);

diff --git a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MERichTextControl.java b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MERichTextControl.java
index 59fae5d..6339131 100644
--- a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MERichTextControl.java
+++ b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MERichTextControl.java
@@ -91,7 +91,6 @@ public class MERichTextControl extends AbstractMEControl {
 

 	private void createText() {

 		text = new Text(composite, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);

-

 		text.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));

 		text.setSize(10, 100);

 		text.addFocusListener(new FocusAdapter() {

@@ -110,6 +109,10 @@ public class MERichTextControl extends AbstractMEControl {
 		spec.grabExcessVerticalSpace = true;

 		spec.heightHint = 200;

 		text.setLayoutData(spec);

+

+		if (!getItemPropertyDescriptor().canSetProperty(getModelElement())) {

+			text.setEnabled(false);

+		}

 	}

 

 	private void createToolBar() {

diff --git a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MESWTDateAndTimeControl.java b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MESWTDateAndTimeControl.java
index ed0a5ee..5e38e93 100644
--- a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MESWTDateAndTimeControl.java
+++ b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MESWTDateAndTimeControl.java
@@ -80,6 +80,10 @@ public class MESWTDateAndTimeControl extends AbstractMEControl {
 		timeWidget = new DateTime(dateComposite, SWT.TIME | SWT.SHORT);

 		timeWidget.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

 

+		if (!getItemPropertyDescriptor().canSetProperty(getModelElement())) {

+			dateWidget.setEnabled(false);

+			timeWidget.setEnabled(false);

+		}

 		dateDeleteButton = new ImageHyperlink(dateComposite, SWT.TOP);

 		dateDeleteButton.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_TOOL_DELETE));

 		dateDeleteButton.addMouseListener(new MouseAdapter() {

diff --git a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/melinkcontrol/MELinkControl.java b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/melinkcontrol/MELinkControl.java
index 2df6ec9..e9bf3cf 100644
--- a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/melinkcontrol/MELinkControl.java
+++ b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/melinkcontrol/MELinkControl.java
@@ -57,7 +57,7 @@ public class MELinkControl {
 	protected FormToolkit toolkit;

 	private org.eclipse.emf.ecp.editor.ModelElementChangeListener modelElementChangeListener;

 	private ECPModelelementContext context;

-

+	private IItemPropertyDescriptor pDescriptor;

 	public ECPModelelementContext getContext() {

 		return context;

 	}

@@ -66,12 +66,14 @@ public class MELinkControl {
 		this.context = context;

 	}

 

+	

 	/**

 	 * {@inheritDoc}

 	 */

 	public Control createControl(final Composite parent, int style, IItemPropertyDescriptor itemPropertyDescriptor,

 		final EObject link, EObject contextModelElement, FormToolkit toolkit, ECPModelelementContext context) {

 		this.context = context;

+		pDescriptor=itemPropertyDescriptor;

 		Object feature = itemPropertyDescriptor.getFeature(link);

 		this.eReference = (EReference) feature;

 		this.link = link;

@@ -84,7 +86,9 @@ public class MELinkControl {
 	protected Control createControl(final Composite parent, int style) {

 		linkComposite = toolkit.createComposite(parent, style);

 		linkComposite.setLayout(new GridLayout(3, false));

-

+		if (!pDescriptor.canSetProperty(contextModelElement)) {

+			linkComposite.setEnabled(false);

+		}

 		createHyperlink(parent, style);

 		createDeleteAction(style);

 		return linkComposite;

diff --git a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/melinkcontrol/MEMultiLinkControl.java b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/melinkcontrol/MEMultiLinkControl.java
index 65e02e0..4db193a 100644
--- a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/melinkcontrol/MEMultiLinkControl.java
+++ b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/melinkcontrol/MEMultiLinkControl.java
@@ -190,6 +190,9 @@ public class MEMultiLinkControl extends AbstractMEControl {
 		createSectionToolbar(section, getToolkit());

 		composite = getToolkit().createComposite(section, style);

 		composite.setLayout(tableLayout);

+		if (!getItemPropertyDescriptor().canSetProperty(getModelElement())) {

+			composite.setEnabled(false);

+		}

 

 		rebuildLinkSection();

 

diff --git a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/melinkcontrol/MESingleLinkControl.java b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/melinkcontrol/MESingleLinkControl.java
index b27880e..b37907e 100644
--- a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/melinkcontrol/MESingleLinkControl.java
+++ b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/melinkcontrol/MESingleLinkControl.java
@@ -72,6 +72,9 @@ public class MESingleLinkControl extends AbstractMEControl {
 		this.eReference = (EReference) feature;

 		composite = getToolkit().createComposite(parent, style);

 		composite.setLayout(new GridLayout(3, false));

+		if (!getItemPropertyDescriptor().canSetProperty(getModelElement())) {

+			composite.setEnabled(false);

+		}

 		GridLayoutFactory.fillDefaults().spacing(0, 0).numColumns(3).equalWidth(false).applyTo(composite);

 		this.parent = parent;

 		this.style = style;

diff --git a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/multiattributecontrol/MultiAttributeControl.java b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/multiattributecontrol/MultiAttributeControl.java
index fc3ff5c..b71341e 100644
--- a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/multiattributecontrol/MultiAttributeControl.java
+++ b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/multiattributecontrol/MultiAttributeControl.java
@@ -95,7 +95,9 @@ public abstract class MultiAttributeControl extends AbstractMEControl {
 		setComposite(getToolkit().createComposite(parent, style | SWT.BORDER));

 		configureGridLayout();

 		getComposite().setLayout(gridLayout);

-

+		if (!getItemPropertyDescriptor().canSetProperty(getModelElement())) {

+			getComposite().setEnabled(false);

+		}

 		// re-set upper bound... needed because canRender() was called in an other instance

 		upperBound = feature.getUpperBound();
Comment 7 David CLA 2011-11-22 09:07:54 EST
Comment on attachment 206971 [details]
Solves the bug.

>diff --git a/developer/.project b/developer/.project
>index d51d10c..e492c93 100644
>--- a/developer/.project
>+++ b/developer/.project
>@@ -1,6 +1,6 @@
> <?xml version="1.0" encoding="UTF-8"?>
> <projectDescription>
>-	<name>developer</name>
>+	<name>ECPDeveloper</name>
> 	<comment></comment>
> 	<projects>
> 	</projects>
>diff --git a/org.eclipse.emf.ecp.common/.checkstyle b/org.eclipse.emf.ecp.common/.checkstyle
>index 8b813a5..2f2667a 100644
>--- a/org.eclipse.emf.ecp.common/.checkstyle
>+++ b/org.eclipse.emf.ecp.common/.checkstyle
>@@ -1,7 +1,7 @@
> <?xml version="1.0" encoding="UTF-8"?>
> 
> <fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
>-  <fileset name="all" enabled="true" check-config-name="emfStoreStyle" local="false">
>+  <fileset name="all" enabled="true" check-config-name="emfstoreStyle" local="false">
>     <file-match-pattern match-pattern="." include-pattern="true"/>
>   </fileset>
> </fileset-config>
>diff --git a/org.eclipse.emf.ecp.common/META-INF/MANIFEST.MF b/org.eclipse.emf.ecp.common/META-INF/MANIFEST.MF
>index 1f9b4e8..facf904 100644
>--- a/org.eclipse.emf.ecp.common/META-INF/MANIFEST.MF
>+++ b/org.eclipse.emf.ecp.common/META-INF/MANIFEST.MF
>@@ -33,6 +33,7 @@
>    org.eclipse.swt.dnd,
>    org.eclipse.jface.viewers,
>    org.eclipse.emf.edit.ui.dnd",
>+ org.eclipse.emf.ecp.common.handler,
>  org.eclipse.emf.ecp.common.observer;uses:="org.eclipse.emf.ecore,org.eclipse.emf.emfstore.common.observer",
>  org.eclipse.emf.ecp.common.preferences;
>   uses:="org.eclipse.jface.preference,
>diff --git a/org.eclipse.emf.ecp.common/plugin.xml b/org.eclipse.emf.ecp.common/plugin.xml
>index 06ada9d..d737cf4 100644
>--- a/org.eclipse.emf.ecp.common/plugin.xml
>+++ b/org.eclipse.emf.ecp.common/plugin.xml
>@@ -9,6 +9,12 @@
>               id="org.eclipse.emf.ecp.common"
>               name="org.eclipse.emf.ecp.common">
>         </category>
>+        <command
>+            categoryId="org.eclipse.emf.ecp.common"
>+            defaultHandler="org.eclipse.emf.ecp.common.handler.SearchModelElementHandler"
>+            id="org.eclipse.emf.ecp.common.handlers.open_me_ID"
>+            name="Search for Modelelement">
>+        </command>
>   </extension>
>   <extension
>         point="org.eclipse.ui.menus">
>@@ -45,22 +51,57 @@
>               			 </not>
>         			   </and>     
>                  </iterate>
>+                 <test
>+                       args="org.eclipse.emf.ecp.common.deleteModelelement"
>+                       property="org.eclipse.emf.ecp.common.menuContributionsEnablement"
>+                       value="true">
>+                 </test>
>               </and>
>            </visibleWhen>
>         </command>
>      </menuContribution>
>-     
>-      <menuContribution
>-           locationURI="toolbar:org.eclipse.emf.ecp.navigator.viewer?before=additions">
>-         <command
>-               commandId="org.eclipse.emf.ecp.common.handlers.open_me_ID"
>-               icon="icons/magnifier.png"
>-               id="SearchElementButon"
>-               style="push"
>-               tooltip="Search for model element">
>+     <menuContribution
>+           locationURI="popup:org.eclipse.emf.ecp.navigator.viewer?after=org.eclipse.emf.ecp.common.deleteModelelement">
>+        <command
>+              commandId="org.eclipse.emf.emfstore.client.ui.validate"
>+              icon="icons/validation.png"
>+              label="Validate"
>+              style="push">
>+           <visibleWhen
>+                 checkEnabled="false">
>+              <and>
>+                 <iterate
>+                       ifEmpty="false"
>+                       operator="and">
>+                    <and>
>+	                  <instanceof
>+	                        value="org.eclipse.emf.ecore.EObject">
>+	                  </instanceof>
>+	                  <not>
>+	                  	<instanceof
>+	                         value="org.eclipse.emf.emfstore.common.model.Project">
>+	                  	</instanceof>
>+	                  </not>
>+	                  <not>
>+	                  	<instanceof
>+	                         value="org.eclipse.emf.emfstore.client.model.ProjectSpace">
>+	                  	</instanceof>
>+	                  </not>
>+	            	</and>
>+                 </iterate>
>+                 <count
>+                       value="1">
>+                 </count>
>+                 <test
>+                       args="org.eclipse.emf.emfstore.client.ui.validate"
>+                       property="org.eclipse.emf.ecp.common.menuContributionsEnablement"
>+                       value="true">
>+                 </test>
>+              </and>
>+           </visibleWhen>
>         </command>
>      </menuContribution>
>-     <menuContribution
>+      <menuContribution
>            locationURI="toolbar:org.eclipse.ui.main.toolbar">
>         <toolbar
>               id="org.eclipse.emf.ecp.common.ECPToolbar">
>@@ -69,6 +110,38 @@
>                  icon="icons/magnifier.png"
>                  style="push"
>                  tooltip="Search model element">
>+             <visibleWhen
>+                   checkEnabled="false">
>+                <and>
>+                   <iterate
>+                         ifEmpty="false"
>+                         operator="and">
>+                      <and>
>+                         <instanceof
>+                               value="org.eclipse.emf.ecore.EObject">
>+                         </instanceof>
>+                         <not>
>+                            <instanceof
>+                                  value="org.eclipse.emf.emfstore.common.model.Project">
>+                            </instanceof>
>+                         </not>
>+                         <not>
>+                            <instanceof
>+                                  value="org.eclipse.emf.emfstore.client.model.ProjectSpace">
>+                            </instanceof>
>+                         </not>
>+                      </and>
>+                   </iterate>
>+                   <count
>+                         value="1">
>+                   </count>
>+                   <test
>+                         args="org.eclipse.emf.ecp.common.handlers.open_me_ID"
>+                         property="org.eclipse.emf.ecp.common.menuContributionsEnablement"
>+                         value="true">
>+                   </test>
>+                </and>
>+             </visibleWhen>
>            </command>
>         </toolbar>
>      </menuContribution>
>@@ -156,5 +229,15 @@
>           sequence="Ctrl+Delete">
>     </key>
>  </extension>
>+  <extension
>+       point="org.eclipse.core.expressions.propertyTesters">
>+    <propertyTester
>+          class="org.eclipse.emf.ecp.common.commands.ECPMenuContributionsEnablementTester"
>+          id="org.eclipse.emf.ecp.common.menuContributionsEnablementTester"
>+          namespace="org.eclipse.emf.ecp.common"
>+          properties="menuContributionsEnablement"
>+          type="java.lang.Object">
>+    </propertyTester>
>+ </extension>
> </plugin>
> 
>diff --git a/org.eclipse.emf.ecp.common/schema/org.eclipse.emf.ecp.common.menuContributionEnablement.exsd b/org.eclipse.emf.ecp.common/schema/org.eclipse.emf.ecp.common.menuContributionEnablement.exsd
>new file mode 100644
>index 0000000..77926b1
>--- /dev/null
>+++ b/org.eclipse.emf.ecp.common/schema/org.eclipse.emf.ecp.common.menuContributionEnablement.exsd
>@@ -0,0 +1,90 @@
>+<?xml version='1.0' encoding='UTF-8'?>
>+<!-- Schema file written by PDE -->
>+<schema targetNamespace="org.eclipse.emf.ecp.common" xmlns="http://www.w3.org/2001/XMLSchema">
>+<annotation>
>+      <appInfo>
>+         <meta.schema plugin="org.eclipse.emf.ecp.common" id="org.eclipse.emf.ecp.common.menuContributionEnablement" name="ECP Menu Contribution Enablement"/>
>+      </appInfo>
>+      <documentation>
>+         Allows to disable all ECP menu contributions
>+      </documentation>
>+   </annotation>
>+
>+   <element name="extension">
>+      <annotation>
>+         <appInfo>
>+            <meta.element />
>+         </appInfo>
>+      </annotation>
>+      <complexType>
>+         <sequence>
>+            <element ref="MenuContributionEnablement"/>
>+         </sequence>
>+         <attribute name="point" type="string" use="required">
>+            <annotation>
>+               <documentation>
>+                  
>+               </documentation>
>+            </annotation>
>+         </attribute>
>+         <attribute name="id" type="string">
>+            <annotation>
>+               <documentation>
>+                  
>+               </documentation>
>+            </annotation>
>+         </attribute>
>+         <attribute name="name" type="string">
>+            <annotation>
>+               <documentation>
>+                  
>+               </documentation>
>+               <appInfo>
>+                  <meta.attribute translatable="true"/>
>+               </appInfo>
>+            </annotation>
>+         </attribute>
>+      </complexType>
>+   </element>
>+
>+   <element name="MenuContributionEnablement">
>+      <complexType>
>+         <sequence minOccurs="0" maxOccurs="unbounded">
>+            <element ref="Command"/>
>+         </sequence>
>+         <attribute name="enabled" type="boolean" use="required">
>+            <annotation>
>+               <documentation>
>+                  
>+               </documentation>
>+            </annotation>
>+         </attribute>
>+      </complexType>
>+   </element>
>+
>+   <element name="Command">
>+      <complexType>
>+         <attribute name="commandID" type="string" use="required">
>+            <annotation>
>+               <documentation>
>+                  
>+               </documentation>
>+            </annotation>
>+         </attribute>
>+      </complexType>
>+   </element>
>+
>+   <annotation>
>+      <appInfo>
>+         <meta.section type="since"/>
>+      </appInfo>
>+      <documentation>
>+         0.8.9.M901
>+      </documentation>
>+   </annotation>
>+
>+
>+
>+
>+
>+</schema>
>diff --git a/org.eclipse.emf.ecp.common/src/org/eclipse/emf/ecp/common/commands/DeleteModelElementCommand.java b/org.eclipse.emf.ecp.common/src/org/eclipse/emf/ecp/common/commands/DeleteModelElementCommand.java
>index f4bacbb..a4338fe 100644
>--- a/org.eclipse.emf.ecp.common/src/org/eclipse/emf/ecp/common/commands/DeleteModelElementCommand.java
>+++ b/org.eclipse.emf.ecp.common/src/org/eclipse/emf/ecp/common/commands/DeleteModelElementCommand.java
>@@ -1,137 +1,148 @@
>-/*******************************************************************************
>- * Copyright (c) 2008-2011 Chair for Applied Software Engineering,
>- * Technische Universitaet Muenchen.
>- * All rights reserved. This program and the accompanying materials
>- * are made available under the terms of the Eclipse Public License v1.0
>- * which accompanies this distribution, and is available at
>- * http://www.eclipse.org/legal/epl-v10.html
>- * 
>- * Contributors:
>- ******************************************************************************/
>-package org.eclipse.emf.ecp.common.commands;
>-
>-import java.util.Collections;
>-import java.util.HashSet;
>-import java.util.Set;
>-
>-import org.eclipse.emf.common.command.Command;
>-import org.eclipse.emf.ecore.EObject;
>-import org.eclipse.emf.ecp.common.model.ECPModelelementContext;
>-import org.eclipse.emf.ecp.common.model.workSpaceModel.util.AssociationClassHelper;
>-import org.eclipse.emf.edit.command.DeleteCommand;
>-import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
>-import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
>-import org.eclipse.jface.dialogs.MessageDialog;
>-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
>-import org.eclipse.ui.PlatformUI;
>-
>-/**
>- * Command to delete a modelelement.
>- * 
>- * @author helming
>- * @author shterev
>- */
>-public final class DeleteModelElementCommand {
>-
>-	private final Set<EObject> toBeDeleted;
>-	private final ECPModelelementContext context;
>-
>-	/**
>-	 * Default constructor.
>-	 * 
>-	 * @param element the model element to be deleted.
>-	 * @param context the model element context
>-	 */
>-	public DeleteModelElementCommand(EObject element, ECPModelelementContext context) {
>-		this(Collections.singleton(element), context);
>-	}
>-
>-	/**
>-	 * Default constructor.
>-	 * 
>-	 * @param elements the model elements to be deleted.
>-	 * @param context the model element context
>-	 */
>-	public DeleteModelElementCommand(Set<EObject> elements, ECPModelelementContext context) {
>-		this.toBeDeleted = elements;
>-		this.context = context;
>-	}
>-
>-	/**
>-	 * {@inheritDoc}
>-	 */
>-	public void run() {
>-		// remove already contained model elements to prevent double deletes -> exception
>-		removeAnchestorDuplicates(toBeDeleted);
>-
>-		// collect all association classes to be deleted
>-		Set<EObject> additionalMEs = new HashSet<EObject>();
>-		for (EObject eObject : toBeDeleted) {
>-			additionalMEs.addAll(AssociationClassHelper.getRelatedAssociationClassToDelete(eObject,
>-				context.getMetaModelElementContext()));
>-		}
>-		toBeDeleted.addAll(additionalMEs);
>-		// now delete
>-		if (askConfirmation()) {
>-			ProgressMonitorDialog progressDialog = new ProgressMonitorDialog(PlatformUI.getWorkbench()
>-				.getActiveWorkbenchWindow().getShell());
>-			progressDialog.open();
>-			try {
>-				removeElementsWithoutRoot(toBeDeleted);
>-
>-				Command deleteCommand = DeleteCommand.create(context.getEditingDomain(), toBeDeleted);
>-				context.getEditingDomain().getCommandStack().execute(deleteCommand);
>-			} finally {
>-				progressDialog.getProgressMonitor().done();
>-				progressDialog.close();
>-			}
>-		}
>-	}
>-
>-	private void removeElementsWithoutRoot(Set<EObject> toBeDeleted) {
>-		HashSet<EObject> tmpRemove = new HashSet<EObject>();
>-		for (EObject obj : toBeDeleted) {
>-			if (obj.eContainer() == null) {
>-				obj.eResource().getContents().remove(obj);
>-				tmpRemove.add(obj);
>-			}
>-		}
>-		toBeDeleted.removeAll(tmpRemove);
>-	}
>-
>-	private void removeAnchestorDuplicates(Set<EObject> toBeDeleted) {
>-		HashSet<EObject> toBeRemoved = new HashSet<EObject>();
>-		for (EObject obj : toBeDeleted) {
>-			if (parentIsContained(toBeDeleted, obj)) {
>-				toBeRemoved.add(obj);
>-			}
>-		}
>-		toBeDeleted.removeAll(toBeRemoved);
>-	}
>-
>-	private boolean parentIsContained(Set<EObject> toBeDeleted, EObject obj) {
>-		EObject container = obj.eContainer();
>-		if (container == null) {
>-			return false;
>-		}
>-		if (toBeDeleted.contains(container)) {
>-			return true;
>-		}
>-		return parentIsContained(toBeDeleted, container);
>-	}
>-
>-	private boolean askConfirmation() {
>-		String question = null;
>-		if (toBeDeleted.size() == 1) {
>-			AdapterFactoryLabelProvider adapterFactoryLabelProvider = new AdapterFactoryLabelProvider(
>-				new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE));
>-			String modelElementName = adapterFactoryLabelProvider.getText(toBeDeleted.iterator().next());
>-			question = "Do you really want to delete the model element " + modelElementName + "?";
>-		} else {
>-			question = "Do you really want to delete these " + toBeDeleted.size() + " model elements?";
>-		}
>-		MessageDialog dialog = new MessageDialog(null, "Confirmation", null, question, MessageDialog.QUESTION,
>-			new String[] { "Yes", "No" }, 0);
>-		return dialog.open() == MessageDialog.OK;
>-	}
>-}
>+/*******************************************************************************
>+ * Copyright (c) 2008-2011 Chair for Applied Software Engineering,
>+ * Technische Universitaet Muenchen.
>+ * All rights reserved. This program and the accompanying materials
>+ * are made available under the terms of the Eclipse Public License v1.0
>+ * which accompanies this distribution, and is available at
>+ * http://www.eclipse.org/legal/epl-v10.html
>+ * 
>+ * Contributors:
>+ ******************************************************************************/
>+package org.eclipse.emf.ecp.common.commands;
>+
>+import java.util.Collections;
>+import java.util.HashSet;
>+import java.util.Set;
>+
>+import org.eclipse.emf.ecore.EObject;
>+import org.eclipse.emf.ecore.util.EcoreUtil;
>+import org.eclipse.emf.ecp.common.model.ECPModelelementContext;
>+import org.eclipse.emf.ecp.common.model.workSpaceModel.util.AssociationClassHelper;
>+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
>+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
>+import org.eclipse.jface.dialogs.MessageDialog;
>+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
>+import org.eclipse.ui.PlatformUI;
>+
>+/**
>+ * Command to delete a modelelement.
>+ * 
>+ * @author helming
>+ * @author shterev
>+ */
>+public final class DeleteModelElementCommand {
>+
>+	private final Set<EObject> toBeDeleted;
>+	private final ECPModelelementContext context;
>+
>+	/**
>+	 * Default constructor.
>+	 * 
>+	 * @param element the model element to be deleted.
>+	 * @param context the model element context
>+	 */
>+	public DeleteModelElementCommand(EObject element, ECPModelelementContext context) {
>+		this(Collections.singleton(element), context);
>+	}
>+
>+	/**
>+	 * Default constructor.
>+	 * 
>+	 * @param elements the model elements to be deleted.
>+	 * @param context the model element context
>+	 */
>+	public DeleteModelElementCommand(Set<EObject> elements, ECPModelelementContext context) {
>+		this.toBeDeleted = elements;
>+		this.context = context;
>+	}
>+
>+	/**
>+	 * {@inheritDoc}
>+	 */
>+	public void run() {
>+		// remove already contained model elements to prevent double deletes -> exception
>+		removeAnchestorDuplicates(toBeDeleted);
>+
>+		// collect all association classes to be deleted
>+		Set<EObject> additionalMEs = new HashSet<EObject>();
>+		for (EObject eObject : toBeDeleted) {
>+			additionalMEs.addAll(AssociationClassHelper.getRelatedAssociationClassToDelete(eObject,
>+				context.getMetaModelElementContext()));
>+		}
>+		toBeDeleted.addAll(additionalMEs);
>+		// now delete
>+		if (askConfirmation()) {
>+			ProgressMonitorDialog progressDialog = new ProgressMonitorDialog(PlatformUI.getWorkbench()
>+				.getActiveWorkbenchWindow().getShell());
>+			progressDialog.open();
>+			try {
>+				removeElementsWithoutRoot(toBeDeleted);
>+
>+				if (toBeDeleted.size() > 0) {
>+					new ECPCommandWithParameter<Set<EObject>>(toBeDeleted.iterator().next()) {
>+
>+						@Override
>+						protected void doRun(Set<EObject> parameter) {
>+							for (EObject eObject : toBeDeleted) {
>+								EcoreUtil.delete(eObject, true);
>+							}
>+						}
>+
>+					}.run(toBeDeleted);
>+				}
>+				// Command deleteCommand = DeleteCommand.create(context.getEditingDomain(), toBeDeleted);
>+				// context.getEditingDomain().getCommandStack().execute(deleteCommand);
>+			} finally {
>+				progressDialog.getProgressMonitor().done();
>+				progressDialog.close();
>+			}
>+		}
>+	}
>+
>+	private void removeElementsWithoutRoot(Set<EObject> toBeDeleted) {
>+		HashSet<EObject> tmpRemove = new HashSet<EObject>();
>+		for (EObject obj : toBeDeleted) {
>+			if (obj.eContainer() == null) {
>+				obj.eResource().getContents().remove(obj);
>+				tmpRemove.add(obj);
>+			}
>+		}
>+		toBeDeleted.removeAll(tmpRemove);
>+	}
>+
>+	private void removeAnchestorDuplicates(Set<EObject> toBeDeleted) {
>+		HashSet<EObject> toBeRemoved = new HashSet<EObject>();
>+		for (EObject obj : toBeDeleted) {
>+			if (parentIsContained(toBeDeleted, obj)) {
>+				toBeRemoved.add(obj);
>+			}
>+		}
>+		toBeDeleted.removeAll(toBeRemoved);
>+	}
>+
>+	private boolean parentIsContained(Set<EObject> toBeDeleted, EObject obj) {
>+		EObject container = obj.eContainer();
>+		if (container == null) {
>+			return false;
>+		}
>+		if (toBeDeleted.contains(container)) {
>+			return true;
>+		}
>+		return parentIsContained(toBeDeleted, container);
>+	}
>+
>+	private boolean askConfirmation() {
>+		String question = null;
>+		if (toBeDeleted.size() == 1) {
>+			AdapterFactoryLabelProvider adapterFactoryLabelProvider = new AdapterFactoryLabelProvider(
>+				new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE));
>+			String modelElementName = adapterFactoryLabelProvider.getText(toBeDeleted.iterator().next());
>+			question = "Do you really want to delete the model element " + modelElementName + "?";
>+		} else {
>+			question = "Do you really want to delete these " + toBeDeleted.size() + " model elements?";
>+		}
>+		MessageDialog dialog = new MessageDialog(null, "Confirmation", null, question, MessageDialog.QUESTION,
>+			new String[] { "Yes", "No" }, 0);
>+		return dialog.open() == MessageDialog.OK;
>+	}
>+}
>diff --git a/org.eclipse.emf.ecp.common/src/org/eclipse/emf/ecp/common/commands/ECPCommandWithParameter.java b/org.eclipse.emf.ecp.common/src/org/eclipse/emf/ecp/common/commands/ECPCommandWithParameter.java
>new file mode 100644
>index 0000000..0cd2c2b
>--- /dev/null
>+++ b/org.eclipse.emf.ecp.common/src/org/eclipse/emf/ecp/common/commands/ECPCommandWithParameter.java
>@@ -0,0 +1,80 @@
>+/*******************************************************************************
>+ * Copyright (c) 2008-2011 Chair for Applied Software Engineering,
>+ * Technische Universitaet Muenchen.
>+ * All rights reserved. This program and the accompanying materials
>+ * are made available under the terms of the Eclipse Public License v1.0
>+ * which accompanies this distribution, and is available at
>+ * http://www.eclipse.org/legal/epl-v10.html
>+ * 
>+ * Contributors:
>+ ******************************************************************************/
>+package org.eclipse.emf.ecp.common.commands;
>+
>+import org.eclipse.emf.ecore.EObject;
>+import org.eclipse.emf.edit.command.ChangeCommand;
>+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
>+import org.eclipse.emf.edit.domain.EditingDomain;
>+
>+/**
>+ * Command capable of recording changes on a model element.
>+ * @param <T> the type of the parameter
>+ * 
>+ * @author koegel
>+ */
>+public abstract class ECPCommandWithParameter<T> extends ChangeCommand {
>+
>+	private EObject eObject;
>+	private RuntimeException runtimeException;
>+	private T parameter;
>+
>+	/**
>+	 * Constructor.
>+	 * 
>+	 * @param eObject the model element whose changes one is interested in
>+	 */
>+	public ECPCommandWithParameter(EObject eObject) {
>+		super(eObject);
>+		this.eObject = eObject;
>+	}
>+
>+	/**
>+	 * {@inheritDoc}
>+	 * 
>+	 * @see org.eclipse.emf.edit.ChangeCommand#doExecute()
>+	 */
>+	@Override
>+	protected final void doExecute() {
>+		try {
>+			doRun(parameter);
>+			// BEGIN SUPRESS CATCH EXCEPTION
>+		} catch (RuntimeException e) {
>+			// END SUPRESS CATCH EXCEPTION
>+			runtimeException = e;
>+			throw e;
>+		}
>+	}
>+
>+	/**
>+	 * The actual action that is being executed.
>+	 * 
>+	 * @param parameter the parameter of type T
>+	 */
>+	protected abstract void doRun(T parameter);
>+
>+	/**
>+	 * Executes the command.
>+	 * 
>+	 * @param parameter the parameter
>+	 */
>+	public void run(T parameter) {
>+		runtimeException = null;
>+		
>+		this.parameter=parameter;
>+		EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(eObject);
>+		domain.getCommandStack().execute(this);
>+
>+		if (runtimeException != null) {
>+			throw runtimeException;
>+		}
>+	}
>+}
>diff --git a/org.eclipse.emf.ecp.common/src/org/eclipse/emf/ecp/common/commands/ECPCommandWithResult.java b/org.eclipse.emf.ecp.common/src/org/eclipse/emf/ecp/common/commands/ECPCommandWithResult.java
>new file mode 100644
>index 0000000..e5ecea7
>--- /dev/null
>+++ b/org.eclipse.emf.ecp.common/src/org/eclipse/emf/ecp/common/commands/ECPCommandWithResult.java
>@@ -0,0 +1,81 @@
>+/*******************************************************************************
>+ * Copyright (c) 2008-2011 Chair for Applied Software Engineering,
>+ * Technische Universitaet Muenchen.
>+ * All rights reserved. This program and the accompanying materials
>+ * are made available under the terms of the Eclipse Public License v1.0
>+ * which accompanies this distribution, and is available at
>+ * http://www.eclipse.org/legal/epl-v10.html
>+ * 
>+ * Contributors:
>+ ******************************************************************************/
>+package org.eclipse.emf.ecp.common.commands;
>+
>+import org.eclipse.emf.ecore.EObject;
>+import org.eclipse.emf.edit.command.ChangeCommand;
>+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
>+import org.eclipse.emf.edit.domain.EditingDomain;
>+
>+/**
>+ * Command capable of recording changes on a model element.
>+ * @param <T> the type of the return value
>+ * 
>+ * @author koegel
>+ */
>+public abstract class ECPCommandWithResult<T> extends ChangeCommand {
>+
>+	private EObject eObject;
>+	private RuntimeException runtimeException;
>+	private T result;
>+
>+	/**
>+	 * Constructor.
>+	 * 
>+	 * @param eObject the model element whose changes one is interested in
>+	 */
>+	public ECPCommandWithResult(EObject eObject) {
>+		super(eObject);
>+		this.eObject = eObject;
>+	}
>+
>+	/**
>+	 * {@inheritDoc}
>+	 * 
>+	 * @see org.eclipse.emf.edit.ChangeCommand#doExecute()
>+	 */
>+	@Override
>+	protected final void doExecute() {
>+		try {
>+			result = doRun();
>+			// BEGIN SUPRESS CATCH EXCEPTION
>+		} catch (RuntimeException e) {
>+			// END SUPRESS CATCH EXCEPTION
>+			runtimeException = e;
>+			throw e;
>+		}
>+	}
>+
>+	/**
>+	 * The actual action that is being executed.
>+	 * 
>+	 * @return the result of type T
>+	 */
>+	protected abstract T doRun();
>+
>+	/**
>+	 * Executes the command.
>+	 * 
>+	 * @return the result of type T
>+	 */
>+	public T run() {
>+		runtimeException = null;
>+
>+		EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(eObject);
>+		domain.getCommandStack().execute(this);
>+
>+		if (runtimeException != null) {
>+			throw runtimeException;
>+		}
>+		return result;
>+	}
>+
>+}
>diff --git a/org.eclipse.emf.ecp.common/src/org/eclipse/emf/ecp/common/commands/ECPMenuContributionsEnablementTester.java b/org.eclipse.emf.ecp.common/src/org/eclipse/emf/ecp/common/commands/ECPMenuContributionsEnablementTester.java
>new file mode 100644
>index 0000000..ec172fd
>--- /dev/null
>+++ b/org.eclipse.emf.ecp.common/src/org/eclipse/emf/ecp/common/commands/ECPMenuContributionsEnablementTester.java
>@@ -0,0 +1,52 @@
>+/*******************************************************************************
>+ * Copyright (c) 2008-2011 Chair for Applied Software Engineering,
>+ * Technische Universitaet Muenchen.
>+ * All rights reserved. This program and the accompanying materials
>+ * are made available under the terms of the Eclipse Public License v1.0
>+ * which accompanies this distribution, and is available at
>+ * http://www.eclipse.org/legal/epl-v10.html
>+ * 
>+ * Contributors:
>+ ******************************************************************************/
>+package org.eclipse.emf.ecp.common.commands;
>+
>+import org.eclipse.core.expressions.PropertyTester;
>+import org.eclipse.core.runtime.IConfigurationElement;
>+import org.eclipse.core.runtime.Platform;
>+
>+/** 
>+ * Tests the enablement of ECP Menu contributions. The contributions are enabled by default and can be disabled by an extension point.
>+ * @author koegel
>+ *
>+ */
>+public class ECPMenuContributionsEnablementTester extends PropertyTester {
>+
>+	
>+	/**
>+	 * {@inheritDoc}
>+	 * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
>+	 */
>+	public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
>+		
>+		if (expectedValue instanceof Boolean) {
>+			Boolean menuContributionEnabled = true;
>+			IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(
>+				"org.eclipse.emf.ecp.common.menuContributionEnablement");
>+			if (elements != null && elements.length > 0) {
>+				IConfigurationElement configurationElement = elements[0];
>+				menuContributionEnabled = Boolean.parseBoolean(configurationElement.getAttribute("enabled"));
>+				for (IConfigurationElement child: configurationElement.getChildren()) {
>+					String commandID = child.getAttribute("commandID");
>+					menuContributionEnabled = !args[0].equals(commandID);
>+					if (!menuContributionEnabled) {
>+						break;
>+					}
>+				}
>+			}
>+			
>+			return expectedValue.equals(menuContributionEnabled);
>+		}
>+		return false;
>+	}
>+
>+}
>diff --git a/org.eclipse.emf.ecp.common/src/org/eclipse/emf/ecp/common/dialogs/SearchModelElementDialog.java b/org.eclipse.emf.ecp.common/src/org/eclipse/emf/ecp/common/dialogs/SearchModelElementDialog.java
>new file mode 100644
>index 0000000..b9be1eb
>--- /dev/null
>+++ b/org.eclipse.emf.ecp.common/src/org/eclipse/emf/ecp/common/dialogs/SearchModelElementDialog.java
>@@ -0,0 +1,51 @@
>+/*******************************************************************************
>+ * Copyright (c) 2008-2011 Chair for Applied Software Engineering, Technische Universitaet Muenchen. All rights
>+ * reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public
>+ * License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html
>+ * Contributors:
>+ ******************************************************************************/
>+package org.eclipse.emf.ecp.common.dialogs;
>+
>+import org.eclipse.core.runtime.IProgressMonitor;
>+import org.eclipse.emf.ecore.EObject;
>+import org.eclipse.emf.ecp.common.model.ECPWorkspaceManager;
>+import org.eclipse.emf.ecp.common.model.workSpaceModel.ECPProject;
>+
>+/**
>+ * Dialog to select model elements.
>+ * 
>+ * @author mkagel
>+ */
>+public class SearchModelElementDialog extends ModelElementSelectionDialog {
>+
>+	/**
>+	 * The constructor.
>+	 * 
>+	 * @param project the project, which contains all the model elements that can be searched for
>+	 */
>+	public SearchModelElementDialog(ECPProject project) {
>+		super(project);
>+	}
>+
>+	/**
>+	 * Fills the content provider with all elements matching the items filter.
>+	 * 
>+	 * @param contentProvider the content provider which gets added the items
>+	 * @param itemsFilter the used items filter
>+	 * @param progressMonitor a progress monitor stating the progress
>+	 */
>+	@Override
>+	protected void fillContentProvider(AbstractContentProvider contentProvider, ItemsFilter itemsFilter,
>+		IProgressMonitor progressMonitor) {
>+
>+		progressMonitor.beginTask("Searching", getModelElements().size());
>+		for (EObject modelElement : getModelElements()) {
>+			ECPProject project = ECPWorkspaceManager.getECPProject(modelElement);
>+			if (!(project.getMetaModelElementContext().isNonDomainElement(modelElement.eClass()))) {
>+				contentProvider.add(modelElement, itemsFilter);
>+				progressMonitor.worked(1);
>+			}
>+		}
>+		progressMonitor.done();
>+	}
>+}
>diff --git a/org.eclipse.emf.ecp.common/src/org/eclipse/emf/ecp/common/handler/CreateContainmentHandler.java b/org.eclipse.emf.ecp.common/src/org/eclipse/emf/ecp/common/handler/CreateContainmentHandler.java
>new file mode 100644
>index 0000000..d73dc44
>--- /dev/null
>+++ b/org.eclipse.emf.ecp.common/src/org/eclipse/emf/ecp/common/handler/CreateContainmentHandler.java
>@@ -0,0 +1,91 @@
>+/*******************************************************************************
>+ * Copyright (c) 2008-2011 Chair for Applied Software Engineering, Technische Universitaet Muenchen. All rights
>+ * reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public
>+ * License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html
>+ * Contributors:
>+ ******************************************************************************/
>+package org.eclipse.emf.ecp.common.handler;
>+
>+import java.util.List;
>+
>+import org.eclipse.core.commands.AbstractHandler;
>+import org.eclipse.core.commands.ExecutionEvent;
>+import org.eclipse.core.commands.ExecutionException;
>+import org.eclipse.emf.common.util.EList;
>+import org.eclipse.emf.ecore.EClass;
>+import org.eclipse.emf.ecore.EObject;
>+import org.eclipse.emf.ecore.EPackage;
>+import org.eclipse.emf.ecore.EReference;
>+import org.eclipse.emf.ecore.EcorePackage;
>+import org.eclipse.emf.ecp.common.commands.ECPCommand;
>+import org.eclipse.emf.ecp.common.util.UiUtil;
>+import org.eclipse.emf.ecp.common.utilities.ActionHelper;
>+
>+/**
>+ * . This is the generic handler for commands to create containments of a model element
>+ * 
>+ * @author Hodaie
>+ */
>+public class CreateContainmentHandler extends AbstractHandler {
>+
>+	/**
>+	 * The Id for EClass parameter to command. A model element of this EClass type is created in this handler.
>+	 */
>+	public static final String COMMAND_ECLASS_PARAM = "org.eclipse.emf.ecp.navigator.eClassParameter";
>+
>+	/**
>+	 * . {@inheritDoc}
>+	 */
>+	public Object execute(ExecutionEvent event) throws ExecutionException {
>+
>+		// get the command parameter (EClass)
>+		Object o = event.getObjectParameterForExecution(COMMAND_ECLASS_PARAM);
>+		if (o instanceof EClass) {
>+			final EClass newMEType = (EClass) o;
>+			final EObject newMEInstance;
>+
>+			final EObject selectedME = UiUtil.getSelectedModelelement();
>+			EPackage ePackage = newMEType.getEPackage();
>+			newMEInstance = ePackage.getEFactoryInstance().create(newMEType);
>+			final EReference eReference = getStructuralFeature(newMEInstance, selectedME);
>+			if ((selectedME != null) && (!eReference.isContainer())) {
>+				new ECPCommand(selectedME) {
>+					@SuppressWarnings("unchecked")
>+					@Override
>+					protected void doRun() {
>+						Object object = selectedME.eGet(eReference);
>+						if ((eReference.isMany())) {
>+							EList<EObject> eList = (EList<EObject>) object;
>+							eList.add(newMEInstance);
>+						} else {
>+							selectedME.eSet(eReference, newMEInstance);
>+						}
>+						ActionHelper.openModelElement(newMEInstance, this.getClass().getName());
>+					}
>+				}.run(false);
>+			}
>+		}
>+		return null;
>+	}
>+
>+	private EReference getStructuralFeature(final EObject newMEInstance, EObject parent) {
>+		// the value of the 'EAll Containments' reference list.
>+		List<EReference> eallcontainments = parent.eClass().getEAllContainments();
>+		EReference reference = null;
>+		for (EReference containmentitem : eallcontainments) {
>+
>+			EClass eReferenceType = containmentitem.getEReferenceType();
>+			if (eReferenceType.equals(newMEInstance)) {
>+				reference = containmentitem;
>+
>+				break;
>+			} else if (eReferenceType.isSuperTypeOf(newMEInstance.eClass())
>+				|| eReferenceType.equals(EcorePackage.eINSTANCE.getEObject())) {
>+
>+				reference = containmentitem;
>+				break;
>+			}
>+		}
>+		return reference;
>+	}
>+}
>diff --git a/org.eclipse.emf.ecp.common/src/org/eclipse/emf/ecp/common/handler/SearchModelElementHandler.java b/org.eclipse.emf.ecp.common/src/org/eclipse/emf/ecp/common/handler/SearchModelElementHandler.java
>new file mode 100644
>index 0000000..47eb90e
>--- /dev/null
>+++ b/org.eclipse.emf.ecp.common/src/org/eclipse/emf/ecp/common/handler/SearchModelElementHandler.java
>@@ -0,0 +1,68 @@
>+/*******************************************************************************
>+ * Copyright (c) 2008-2011 Chair for Applied Software Engineering, Technische Universitaet Muenchen. All rights
>+ * reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public
>+ * License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html
>+ * Contributors:
>+ ******************************************************************************/
>+package org.eclipse.emf.ecp.common.handler;
>+
>+import org.eclipse.core.commands.AbstractHandler;
>+import org.eclipse.core.commands.ExecutionEvent;
>+import org.eclipse.core.commands.ExecutionException;
>+import org.eclipse.core.commands.IHandler;
>+import org.eclipse.emf.ecore.EObject;
>+import org.eclipse.emf.ecp.common.Activator;
>+import org.eclipse.emf.ecp.common.dialogs.SearchModelElementDialog;
>+import org.eclipse.emf.ecp.common.model.ECPWorkspaceManager;
>+import org.eclipse.emf.ecp.common.model.NoWorkspaceException;
>+import org.eclipse.emf.ecp.common.model.workSpaceModel.ECPProject;
>+import org.eclipse.emf.ecp.common.utilities.ActionHelper;
>+import org.eclipse.jface.dialogs.MessageDialog;
>+import org.eclipse.jface.window.Window;
>+import org.eclipse.ui.PlatformUI;
>+
>+/**
>+ * This is the handler to search and select a model element out of a list of model elements.
>+ * 
>+ * @author emueller
>+ */
>+public class SearchModelElementHandler extends AbstractHandler implements IHandler {
>+
>+	/**
>+	 * Default constructor.
>+	 */
>+	public SearchModelElementHandler() {
>+	}
>+
>+	/**
>+	 * Opens a element selection dialog.
>+	 */
>+	public Object execute(ExecutionEvent event) throws ExecutionException {
>+
>+		ECPProject project = null;
>+
>+		try {
>+			project = ECPWorkspaceManager.getInstance().getWorkSpace().getActiveProject();
>+		} catch (NoWorkspaceException e) {
>+			Activator.getDefault().logException(e.getMessage(), e);
>+		}
>+
>+		if (project == null) {
>+			MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
>+				"Information", "You must first select the Project.");
>+		} else {
>+			SearchModelElementDialog dialog = new SearchModelElementDialog(project);
>+
>+			if (dialog.open() == Window.OK) {
>+				Object[] selections = dialog.getResult();
>+
>+				if (selections != null && selections.length == 1 && selections[0] instanceof EObject) {
>+					ActionHelper.openModelElement((EObject) selections[0],
>+						"org.eclipse.emf.ecp.navigator.handler.SearchModelElementHandler");
>+				}
>+			}
>+		}
>+
>+		return null;
>+	}
>+}
>diff --git a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MEBoolControl.java b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MEBoolControl.java
>index 33d1530..7c06add 100644
>--- a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MEBoolControl.java
>+++ b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MEBoolControl.java
>@@ -45,6 +45,9 @@
> 		Object feature = getItemPropertyDescriptor().getFeature(getModelElement());
> 		this.attribute = (EAttribute) feature;
> 		check = getToolkit().createButton(parent, "", SWT.CHECK);
>+		if (!getItemPropertyDescriptor().canSetProperty(getModelElement())) {
>+			check.setEnabled(false);
>+		}
> 		IObservableValue model = EMFEditObservables.observeValue(getEditingDomain(), getModelElement(), attribute);
> 		EMFDataBindingContext dbc = new EMFDataBindingContext();
> 		dbc.bindValue(SWTObservables.observeSelection(check), model, null, null);
>diff --git a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MEDoubleControl.java b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MEDoubleControl.java
>index e9f8fc0..115cae1 100644
>--- a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MEDoubleControl.java
>+++ b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MEDoubleControl.java
>@@ -65,6 +65,9 @@
> 		spinner.setDigits(digits);
> 		spinner.setMinimum(-1000000);
> 		spinner.setMaximum(1000000);
>+		if (!getItemPropertyDescriptor().canSetProperty(getModelElement())) {
>+			spinner.setEnabled(false);
>+		}
> 		IObservableValue model = EMFEditObservables.observeValue(getEditingDomain(), getModelElement(), attribute);
> 		EMFDataBindingContext dbc = new EMFDataBindingContext();
> 		DoubleSpinnerObservable spinnerObservable = new DoubleSpinnerObservable(spinner);
>diff --git a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MEIntControl.java b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MEIntControl.java
>index 6bf5156..7ba28d1 100644
>--- a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MEIntControl.java
>+++ b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MEIntControl.java
>@@ -46,6 +46,9 @@
> 		spinner = new Spinner(parent, style);
> 		spinner.setMinimum(-1000);
> 		spinner.setMaximum(1000);
>+		if (!getItemPropertyDescriptor().canSetProperty(getModelElement())) {
>+			spinner.setEnabled(false);
>+		}
> 		IObservableValue model = EMFEditObservables.observeValue(getEditingDomain(), getModelElement(), attribute);
> 		EMFDataBindingContext dbc = new EMFDataBindingContext();
> 		dbc.bindValue(SWTObservables.observeSelection(spinner), model, null, null);
>diff --git a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MERichTextControl.java b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MERichTextControl.java
>index 59fae5d..6339131 100644
>--- a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MERichTextControl.java
>+++ b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MERichTextControl.java
>@@ -91,7 +91,6 @@
> 
> 	private void createText() {
> 		text = new Text(composite, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
>-
> 		text.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
> 		text.setSize(10, 100);
> 		text.addFocusListener(new FocusAdapter() {
>@@ -110,6 +109,10 @@
> 		spec.grabExcessVerticalSpace = true;
> 		spec.heightHint = 200;
> 		text.setLayoutData(spec);
>+
>+		if (!getItemPropertyDescriptor().canSetProperty(getModelElement())) {
>+			text.setEnabled(false);
>+		}
> 	}
> 
> 	private void createToolBar() {
>diff --git a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MESWTDateAndTimeControl.java b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MESWTDateAndTimeControl.java
>index ed0a5ee..5e38e93 100644
>--- a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MESWTDateAndTimeControl.java
>+++ b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/MESWTDateAndTimeControl.java
>@@ -80,6 +80,10 @@
> 		timeWidget = new DateTime(dateComposite, SWT.TIME | SWT.SHORT);
> 		timeWidget.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
> 
>+		if (!getItemPropertyDescriptor().canSetProperty(getModelElement())) {
>+			dateWidget.setEnabled(false);
>+			timeWidget.setEnabled(false);
>+		}
> 		dateDeleteButton = new ImageHyperlink(dateComposite, SWT.TOP);
> 		dateDeleteButton.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_TOOL_DELETE));
> 		dateDeleteButton.addMouseListener(new MouseAdapter() {
>diff --git a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/melinkcontrol/MELinkControl.java b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/melinkcontrol/MELinkControl.java
>index 2df6ec9..e9bf3cf 100644
>--- a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/melinkcontrol/MELinkControl.java
>+++ b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/melinkcontrol/MELinkControl.java
>@@ -57,7 +57,7 @@
> 	protected FormToolkit toolkit;
> 	private org.eclipse.emf.ecp.editor.ModelElementChangeListener modelElementChangeListener;
> 	private ECPModelelementContext context;
>-
>+	private IItemPropertyDescriptor pDescriptor;
> 	public ECPModelelementContext getContext() {
> 		return context;
> 	}
>@@ -66,12 +66,14 @@
> 		this.context = context;
> 	}
> 
>+	
> 	/**
> 	 * {@inheritDoc}
> 	 */
> 	public Control createControl(final Composite parent, int style, IItemPropertyDescriptor itemPropertyDescriptor,
> 		final EObject link, EObject contextModelElement, FormToolkit toolkit, ECPModelelementContext context) {
> 		this.context = context;
>+		pDescriptor=itemPropertyDescriptor;
> 		Object feature = itemPropertyDescriptor.getFeature(link);
> 		this.eReference = (EReference) feature;
> 		this.link = link;
>@@ -84,7 +86,9 @@
> 	protected Control createControl(final Composite parent, int style) {
> 		linkComposite = toolkit.createComposite(parent, style);
> 		linkComposite.setLayout(new GridLayout(3, false));
>-
>+		if (!pDescriptor.canSetProperty(contextModelElement)) {
>+			linkComposite.setEnabled(false);
>+		}
> 		createHyperlink(parent, style);
> 		createDeleteAction(style);
> 		return linkComposite;
>diff --git a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/melinkcontrol/MEMultiLinkControl.java b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/melinkcontrol/MEMultiLinkControl.java
>index 65e02e0..4db193a 100644
>--- a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/melinkcontrol/MEMultiLinkControl.java
>+++ b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/melinkcontrol/MEMultiLinkControl.java
>@@ -190,6 +190,9 @@
> 		createSectionToolbar(section, getToolkit());
> 		composite = getToolkit().createComposite(section, style);
> 		composite.setLayout(tableLayout);
>+		if (!getItemPropertyDescriptor().canSetProperty(getModelElement())) {
>+			composite.setEnabled(false);
>+		}
> 
> 		rebuildLinkSection();
> 
>diff --git a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/melinkcontrol/MESingleLinkControl.java b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/melinkcontrol/MESingleLinkControl.java
>index b27880e..b37907e 100644
>--- a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/melinkcontrol/MESingleLinkControl.java
>+++ b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/melinkcontrol/MESingleLinkControl.java
>@@ -72,6 +72,9 @@
> 		this.eReference = (EReference) feature;
> 		composite = getToolkit().createComposite(parent, style);
> 		composite.setLayout(new GridLayout(3, false));
>+		if (!getItemPropertyDescriptor().canSetProperty(getModelElement())) {
>+			composite.setEnabled(false);
>+		}
> 		GridLayoutFactory.fillDefaults().spacing(0, 0).numColumns(3).equalWidth(false).applyTo(composite);
> 		this.parent = parent;
> 		this.style = style;
>diff --git a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/multiattributecontrol/MultiAttributeControl.java b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/multiattributecontrol/MultiAttributeControl.java
>index fc3ff5c..b71341e 100644
>--- a/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/multiattributecontrol/MultiAttributeControl.java
>+++ b/org.eclipse.emf.ecp.editor/src/org/eclipse/emf/ecp/editor/mecontrols/multiattributecontrol/MultiAttributeControl.java
>@@ -95,7 +95,9 @@
> 		setComposite(getToolkit().createComposite(parent, style | SWT.BORDER));
> 		configureGridLayout();
> 		getComposite().setLayout(gridLayout);
>-
>+		if (!getItemPropertyDescriptor().canSetProperty(getModelElement())) {
>+			getComposite().setEnabled(false);
>+		}
> 		// re-set upper bound... needed because canRender() was called in an other instance
> 		upperBound = feature.getUpperBound();
> 
>diff --git a/org.eclipse.emf.ecp.navigator/.checkstyle b/org.eclipse.emf.ecp.navigator/.checkstyle
>index 8b813a5..2f2667a 100644
>--- a/org.eclipse.emf.ecp.navigator/.checkstyle
>+++ b/org.eclipse.emf.ecp.navigator/.checkstyle
>@@ -1,7 +1,7 @@
> <?xml version="1.0" encoding="UTF-8"?>
> 
> <fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
>-  <fileset name="all" enabled="true" check-config-name="emfStoreStyle" local="false">
>+  <fileset name="all" enabled="true" check-config-name="emfstoreStyle" local="false">
>     <file-match-pattern match-pattern="." include-pattern="true"/>
>   </fileset>
> </fileset-config>
>diff --git a/org.eclipse.emf.ecp.navigator/icons/magnifier.png b/org.eclipse.emf.ecp.navigator/icons/magnifier.png
>new file mode 100644
>index 0000000..cf3d97f
>--- /dev/null
>+++ b/org.eclipse.emf.ecp.navigator/icons/magnifier.png
>Binary files differ
>diff --git a/org.eclipse.emf.ecp.navigator/plugin.xml b/org.eclipse.emf.ecp.navigator/plugin.xml
>index f3f6180..f27c76a 100644
>--- a/org.eclipse.emf.ecp.navigator/plugin.xml
>+++ b/org.eclipse.emf.ecp.navigator/plugin.xml
>@@ -63,6 +63,11 @@
>                   <count
>                         value="1">
>                   </count>
>+                  <test
>+                        args="org.eclipse.emf.ecp.navigator.dynamicMECreationCommands"
>+                        property="org.eclipse.emf.ecp.common.menuContributionsEnablement"
>+                        value="true">
>+                  </test>
>                </and>
>             </visibleWhen>
>          </dynamic>
>@@ -76,14 +81,26 @@
>                style="push">
>             <visibleWhen
>                   checkEnabled="false">
>+               <and>
>                <iterate>
>                   <and>
>                   <instanceof
>                         value="org.eclipse.emf.ecore.EObject">
>                   </instanceof>
>+                  <test
>+                        args="org.eclipse.emf.ecp.navigator.exportModel"
>+                        property="org.eclipse.emf.ecp.common.menuContributionsEnablement"
>+                        value="true">
>+                  </test>
>                 
> 	            </and>
>                </iterate>
>+               <test
>+                     args="org.eclipse.emf.ecp.navigator.exportModel"
>+                     property="org.eclipse.emf.ecp.common.menuContributionsEnablement"
>+                     value="true">
>+               </test>
>+               </and>
>             </visibleWhen>
>          </command>
>          <command
>@@ -93,13 +110,25 @@
>                style="push">
>             <visibleWhen
>                   checkEnabled="false">
>+               <and>
>                <iterate>
>                   <and>
>                      <instanceof
>                            value="org.eclipse.emf.ecore.EObject">
>                      </instanceof>
>+                     <test
>+                           args="org.eclipse.emf.ecp.navigator.importModel"
>+                           property="org.eclipse.emf.ecp.common.menuContributionsEnablement"
>+                           value="true">
>+                     </test>
>                   </and>
>                </iterate>
>+               <test
>+                     args="org.eclipse.emf.ecp.navigator.importModel"
>+                     property="org.eclipse.emf.ecp.common.menuContributionsEnablement"
>+                     value="true">
>+               </test>
>+              </and> 
>             </visibleWhen>
>          </command>
>          <separator
>@@ -107,15 +136,41 @@
>                visible="true">
>          </separator>
>       </menuContribution>
>-   </extension>
>+      <menuContribution
>+           locationURI="toolbar:org.eclipse.emf.ecp.navigator.viewer?before=additions">
>+         <command
>+               commandId="org.eclipse.emf.ecp.common.handlers.open_me_ID"
>+               icon="icons/magnifier.png"
>+               id="SearchElementButon"
>+               style="push"
>+               tooltip="Search for model element">
>+            <visibleWhen
>+                  checkEnabled="false">
>+               <and>
>+                  <iterate>
>+                     <and>
>+                        <instanceof
>+                              value="org.eclipse.emf.ecore.EObject">
>+                        </instanceof>
>+                        <test
>+                              args="org.eclipse.emf.ecp.navigator.importModel"
>+                              property="org.eclipse.emf.ecp.common.menuContributionsEnablement"
>+                              value="true">
>+                        </test>
>+                     </and>
>+                  </iterate>
>+                  <test
>+                        args="org.eclipse.emf.ecp.common.handlers.open_me_ID"
>+                        property="org.eclipse.emf.ecp.common.menuContributionsEnablement"
>+                        value="true">
>+                  </test>
>+               </and>
>+            </visibleWhen>
>+        </command>
>+     </menuContribution>
>+   </extension> 
>    <extension
>          point="org.eclipse.ui.commands">
>-              <command
>-            categoryId="org.eclipse.emf.ecp.navigator"
>-            defaultHandler="org.eclipse.emf.ecp.navigator.handler.SearchModelElementHandler"
>-            id="org.eclipse.emf.ecp.common.handlers.open_me_ID"
>-            name="Search for Modelelement">
>-      </command>
>            <command
>             categoryId="org.eclipse.emf.ecp.navigator"
>             defaultHandler="org.eclipse.emf.ecp.navigator.handler.DeleteModelelementHandler"
>@@ -135,7 +190,7 @@
>          </commandParameter>
>       </command>
>           <command
>-            defaultHandler="org.eclipse.emf.ecp.navigator.handler.CreateContainmentHandler"
>+            defaultHandler="org.eclipse.emf.ecp.common.handler.CreateContainmentHandler"
>             description="This generic command is used by dynamic commands to create containment MEs"
>             id="org.eclipse.emf.ecp.navigator.createContaiment"
>             name="New Containment ME">
>diff --git a/org.eclipse.emf.ecp.navigator/src/org/eclipse/emf/ecp/navigator/commands/DynamicContainmentCommands.java b/org.eclipse.emf.ecp.navigator/src/org/eclipse/emf/ecp/navigator/commands/DynamicContainmentCommands.java
>index bcb3068..920ec2b 100644
>--- a/org.eclipse.emf.ecp.navigator/src/org/eclipse/emf/ecp/navigator/commands/DynamicContainmentCommands.java
>+++ b/org.eclipse.emf.ecp.navigator/src/org/eclipse/emf/ecp/navigator/commands/DynamicContainmentCommands.java
>@@ -20,11 +20,11 @@
> import org.eclipse.emf.ecore.EClass;
> import org.eclipse.emf.ecore.EObject;
> import org.eclipse.emf.ecore.EReference;
>+import org.eclipse.emf.ecp.common.handler.CreateContainmentHandler;
> import org.eclipse.emf.ecp.common.model.ECPWorkspaceManager;
> import org.eclipse.emf.ecp.common.model.NoWorkspaceException;
> import org.eclipse.emf.ecp.common.util.UiUtil;
> import org.eclipse.emf.ecp.navigator.Activator;
>-import org.eclipse.emf.ecp.navigator.handler.CreateContainmentHandler;
> import org.eclipse.emf.ecp.navigator.handler.NewModelElementWizardHandler;
> import org.eclipse.emf.edit.command.CommandParameter;
> import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
>diff --git a/org.eclipse.emf.ecp.navigator/src/org/eclipse/emf/ecp/navigator/dialogs/SearchModelElementDialog.java b/org.eclipse.emf.ecp.navigator/src/org/eclipse/emf/ecp/navigator/dialogs/SearchModelElementDialog.java
>deleted file mode 100644
>index edc0ed6..0000000
>--- a/org.eclipse.emf.ecp.navigator/src/org/eclipse/emf/ecp/navigator/dialogs/SearchModelElementDialog.java
>+++ /dev/null
>@@ -1,56 +0,0 @@
>-/*******************************************************************************
>- * Copyright (c) 2008-2011 Chair for Applied Software Engineering,
>- * Technische Universitaet Muenchen.
>- * All rights reserved. This program and the accompanying materials
>- * are made available under the terms of the Eclipse Public License v1.0
>- * which accompanies this distribution, and is available at
>- * http://www.eclipse.org/legal/epl-v10.html
>- * 
>- * Contributors:
>- ******************************************************************************/
>-package org.eclipse.emf.ecp.navigator.dialogs;
>-
>-import org.eclipse.core.runtime.IProgressMonitor;
>-import org.eclipse.emf.ecore.EObject;
>-import org.eclipse.emf.ecp.common.dialogs.ModelElementSelectionDialog;
>-import org.eclipse.emf.ecp.common.model.ECPWorkspaceManager;
>-import org.eclipse.emf.ecp.common.model.workSpaceModel.ECPProject;
>-
>-/**
>- * Dialog to select model elements.
>- * 
>- * @author mkagel
>- */
>-public class SearchModelElementDialog extends ModelElementSelectionDialog {
>-
>-	/**
>-	 * The constructor.
>-	 * 
>-	 * @param project the project, which contains all the model elements that can be searched for
>-	 */
>-	public SearchModelElementDialog(ECPProject project) {
>-		super(project);
>-	}
>-
>-	/**
>-	 * Fills the content provider with all elements matching the items filter.
>-	 * 
>-	 * @param contentProvider the content provider which gets added the items
>-	 * @param itemsFilter the used items filter
>-	 * @param progressMonitor a progress monitor stating the progress
>-	 */
>-	@Override
>-	protected void fillContentProvider(AbstractContentProvider contentProvider, ItemsFilter itemsFilter,
>-		IProgressMonitor progressMonitor) {
>-
>-		progressMonitor.beginTask("Searching", getModelElements().size());
>-		for (EObject modelElement : getModelElements()) {
>-			ECPProject project = ECPWorkspaceManager.getECPProject(modelElement);
>-			if (!(project.getMetaModelElementContext().isNonDomainElement(modelElement.eClass()))) {
>-				contentProvider.add(modelElement, itemsFilter);
>-				progressMonitor.worked(1);
>-			}
>-		}
>-		progressMonitor.done();
>-	}
>-}
>diff --git a/org.eclipse.emf.ecp.navigator/src/org/eclipse/emf/ecp/navigator/handler/CreateContainmentHandler.java b/org.eclipse.emf.ecp.navigator/src/org/eclipse/emf/ecp/navigator/handler/CreateContainmentHandler.java
>deleted file mode 100644
>index 0be6a3b..0000000
>--- a/org.eclipse.emf.ecp.navigator/src/org/eclipse/emf/ecp/navigator/handler/CreateContainmentHandler.java
>+++ /dev/null
>@@ -1,95 +0,0 @@
>-/*******************************************************************************
>- * Copyright (c) 2008-2011 Chair for Applied Software Engineering,
>- * Technische Universitaet Muenchen.
>- * All rights reserved. This program and the accompanying materials
>- * are made available under the terms of the Eclipse Public License v1.0
>- * which accompanies this distribution, and is available at
>- * http://www.eclipse.org/legal/epl-v10.html
>- * 
>- * Contributors:
>- ******************************************************************************/
>-package org.eclipse.emf.ecp.navigator.handler;
>-
>-import java.util.List;
>-
>-import org.eclipse.core.commands.AbstractHandler;
>-import org.eclipse.core.commands.ExecutionEvent;
>-import org.eclipse.core.commands.ExecutionException;
>-import org.eclipse.emf.common.util.EList;
>-import org.eclipse.emf.ecore.EClass;
>-import org.eclipse.emf.ecore.EObject;
>-import org.eclipse.emf.ecore.EPackage;
>-import org.eclipse.emf.ecore.EReference;
>-import org.eclipse.emf.ecore.EcorePackage;
>-import org.eclipse.emf.ecp.common.commands.ECPCommand;
>-import org.eclipse.emf.ecp.common.util.UiUtil;
>-import org.eclipse.emf.ecp.common.utilities.ActionHelper;
>-
>-/**
>- * . This is the generic handler for commands to create containments of a model element
>- * 
>- * @author Hodaie
>- */
>-public class CreateContainmentHandler extends AbstractHandler {
>-
>-	/**
>-	 * The Id for EClass parameter to command. A model element of this EClass type is created in this handler.
>-	 */
>-	public static final String COMMAND_ECLASS_PARAM = "org.eclipse.emf.ecp.navigator.eClassParameter";
>-
>-	/**
>-	 * . {@inheritDoc}
>-	 */
>-	public Object execute(ExecutionEvent event) throws ExecutionException {
>-
>-		// get the command parameter (EClass)
>-		Object o = event.getObjectParameterForExecution(COMMAND_ECLASS_PARAM);
>-		if (o instanceof EClass) {
>-			final EClass newMEType = (EClass) o;
>-			final EObject newMEInstance;
>-
>-			final EObject selectedME = UiUtil.getSelectedModelelement();
>-			EPackage ePackage = newMEType.getEPackage();
>-			newMEInstance = ePackage.getEFactoryInstance().create(newMEType);
>-			final EReference eReference = getStructuralFeature(newMEInstance, selectedME);
>-			if ((selectedME != null) && (!eReference.isContainer())) {
>-				new ECPCommand(selectedME) {
>-					@SuppressWarnings("unchecked")
>-					@Override
>-					protected void doRun() {
>-						Object object = selectedME.eGet(eReference);
>-						if ((eReference.isMany())) {
>-							EList<EObject> eList = (EList<EObject>) object;
>-							eList.add(newMEInstance);
>-						} else {
>-							selectedME.eSet(eReference, newMEInstance);
>-						}
>-						ActionHelper.openModelElement(newMEInstance, this.getClass().getName());
>-					}
>-				}.run(false);
>-			}
>-		}
>-		return null;
>-	}
>-
>-	private EReference getStructuralFeature(final EObject newMEInstance, EObject parent) {
>-		// the value of the 'EAll Containments' reference list.
>-		List<EReference> eallcontainments = parent.eClass().getEAllContainments();
>-		EReference reference = null;
>-		for (EReference containmentitem : eallcontainments) {
>-
>-			EClass eReferenceType = containmentitem.getEReferenceType();
>-			if (eReferenceType.equals(newMEInstance)) {
>-				reference = containmentitem;
>-
>-				break;
>-			} else if (eReferenceType.isSuperTypeOf(newMEInstance.eClass())
>-				|| eReferenceType.equals(EcorePackage.eINSTANCE.getEObject())) {
>-
>-				reference = containmentitem;
>-				break;
>-			}
>-		}
>-		return reference;
>-	}
>-}
>diff --git a/org.eclipse.emf.ecp.navigator/src/org/eclipse/emf/ecp/navigator/handler/SearchModelElementHandler.java b/org.eclipse.emf.ecp.navigator/src/org/eclipse/emf/ecp/navigator/handler/SearchModelElementHandler.java
>deleted file mode 100644
>index c7cae1a..0000000
>--- a/org.eclipse.emf.ecp.navigator/src/org/eclipse/emf/ecp/navigator/handler/SearchModelElementHandler.java
>+++ /dev/null
>@@ -1,72 +0,0 @@
>-/*******************************************************************************
>- * Copyright (c) 2008-2011 Chair for Applied Software Engineering,
>- * Technische Universitaet Muenchen.
>- * All rights reserved. This program and the accompanying materials
>- * are made available under the terms of the Eclipse Public License v1.0
>- * which accompanies this distribution, and is available at
>- * http://www.eclipse.org/legal/epl-v10.html
>- * 
>- * Contributors:
>- ******************************************************************************/
>-package org.eclipse.emf.ecp.navigator.handler;
>-
>-import org.eclipse.core.commands.AbstractHandler;
>-import org.eclipse.core.commands.ExecutionEvent;
>-import org.eclipse.core.commands.ExecutionException;
>-import org.eclipse.core.commands.IHandler;
>-import org.eclipse.emf.ecore.EObject;
>-import org.eclipse.emf.ecp.common.model.ECPWorkspaceManager;
>-import org.eclipse.emf.ecp.common.model.NoWorkspaceException;
>-import org.eclipse.emf.ecp.common.model.workSpaceModel.ECPProject;
>-import org.eclipse.emf.ecp.common.utilities.ActionHelper;
>-import org.eclipse.emf.ecp.navigator.Activator;
>-import org.eclipse.emf.ecp.navigator.dialogs.SearchModelElementDialog;
>-import org.eclipse.jface.dialogs.MessageDialog;
>-import org.eclipse.jface.window.Window;
>-import org.eclipse.ui.PlatformUI;
>-
>-/**
>- * This is the handler to search and select a model element out of a list of model elements.
>- * 
>- * @author emueller
>- */
>-public class SearchModelElementHandler extends AbstractHandler implements IHandler {
>-
>-	/**
>-	 * Default constructor.
>-	 */
>-	public SearchModelElementHandler() {
>-	}
>-
>-	/**
>-	 * Opens a element selection dialog.
>-	 */
>-	public Object execute(ExecutionEvent event) throws ExecutionException {
>-
>-		ECPProject project = null;
>-
>-		try {
>-			project = ECPWorkspaceManager.getInstance().getWorkSpace().getActiveProject();
>-		} catch (NoWorkspaceException e) {
>-			Activator.getDefault().logException(e.getMessage(), e);
>-		}
>-
>-		if (project == null) {
>-			MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
>-				"Information", "You must first select the Project.");
>-		} else {
>-			SearchModelElementDialog dialog = new SearchModelElementDialog(project);
>-
>-			if (dialog.open() == Window.OK) {
>-				Object[] selections = dialog.getResult();
>-
>-				if (selections != null && selections.length == 1 && selections[0] instanceof EObject) {
>-					ActionHelper.openModelElement((EObject) selections[0],
>-						"org.eclipse.emf.ecp.navigator.handler.SearchModelElementHandler");
>-				}
>-			}
>-		}
>-
>-		return null;
>-	}
>-}
Comment 8 David CLA 2011-11-22 09:11:08 EST
Created attachment 207359 [details]
Solves the bug.
Comment 9 Jonas Helming CLA 2011-12-01 10:20:11 EST
what is the current state, Franziska have you applied the patch?
Comment 10 Franziska Haunolder CLA 2011-12-06 04:49:02 EST
Patch is working and applied.
(In reply to comment #9)
> what is the current state, Franziska have you applied the patch?