Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorashatalin2007-04-18 13:49:29 -0400
committerashatalin2007-04-18 13:49:29 -0400
commit659ac8c77a836bf8d8991720a69c66e88b28568b (patch)
tree1070fb8a71a39675b41776859e5dbf8a989bf201
parent2f277dfcbd04ba6a3d740f82234ff55f543d12aa (diff)
downloadorg.eclipse.gmf-tooling-659ac8c77a836bf8d8991720a69c66e88b28568b.tar.gz
org.eclipse.gmf-tooling-659ac8c77a836bf8d8991720a69c66e88b28568b.tar.xz
org.eclipse.gmf-tooling-659ac8c77a836bf8d8991720a69c66e88b28568b.zip
Updating with new templates
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/commands/EAnnotationReferencesCreateCommand.java84
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/commands/EClassESuperTypesCreateCommand.java84
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotation2ItemSemanticEditPolicy.java37
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotationDetailsCanonicalEditPolicy.java28
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotationDetailsItemSemanticEditPolicy.java2
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotationItemSemanticEditPolicy.java60
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotationReferencesItemSemanticEditPolicy.java2
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAttributeItemSemanticEditPolicy.java26
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClass2ItemSemanticEditPolicy.java58
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassAttributesCanonicalEditPolicy.java28
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassAttributesItemSemanticEditPolicy.java2
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassClassAnnotationsCanonicalEditPolicy.java30
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassClassAnnotationsItemSemanticEditPolicy.java2
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassESuperTypesItemSemanticEditPolicy.java2
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassItemSemanticEditPolicy.java85
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassOperationsCanonicalEditPolicy.java28
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassOperationsItemSemanticEditPolicy.java2
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EDataType2ItemSemanticEditPolicy.java31
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EDataTypeDataTypeAnnotationsCanonicalEditPolicy.java30
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EDataTypeDataTypeAnnotationsItemSemanticEditPolicy.java2
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EDataTypeItemSemanticEditPolicy.java54
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnum2ItemSemanticEditPolicy.java31
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumEnumAnnotationsCanonicalEditPolicy.java30
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumEnumAnnotationsItemSemanticEditPolicy.java2
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumItemSemanticEditPolicy.java56
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumLiteralItemSemanticEditPolicy.java26
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumLiteralsCanonicalEditPolicy.java28
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumLiteralsItemSemanticEditPolicy.java2
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EOperationItemSemanticEditPolicy.java26
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackage2ItemSemanticEditPolicy.java57
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackage3ItemSemanticEditPolicy.java26
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageClassesCanonicalEditPolicy.java28
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageClassesItemSemanticEditPolicy.java2
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageDataTypesCanonicalEditPolicy.java28
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageDataTypesItemSemanticEditPolicy.java2
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageEnumsCanonicalEditPolicy.java28
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageEnumsItemSemanticEditPolicy.java2
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageItemSemanticEditPolicy.java12
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackagePackageAnnotationsCanonicalEditPolicy.java30
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackagePackageAnnotationsItemSemanticEditPolicy.java2
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackagePackagesCanonicalEditPolicy.java28
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackagePackagesItemSemanticEditPolicy.java2
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EReference2ItemSemanticEditPolicy.java24
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EReferenceItemSemanticEditPolicy.java24
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EStringToStringMapEntryItemSemanticEditPolicy.java4
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EcoreBaseItemSemanticEditPolicy.java22
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/part/EcoreDocumentProvider.java3
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/part/Messages.java5
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/providers/EcoreStructuralFeatureParser.java2
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/providers/EcoreStructuralFeaturesParser.java2
50 files changed, 513 insertions, 698 deletions
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/commands/EAnnotationReferencesCreateCommand.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/commands/EAnnotationReferencesCreateCommand.java
new file mode 100644
index 000000000..76a70c5d0
--- /dev/null
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/commands/EAnnotationReferencesCreateCommand.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2006, 2007 Borland Software Corp.
+ *
+ * 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+package org.eclipse.gmf.ecore.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.ecore.edit.policies.EcoreBaseItemSemanticEditPolicy;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+
+/**
+ * @generated
+ */
+public class EAnnotationReferencesCreateCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final EObject source;
+
+ /**
+ * @generated
+ */
+ private final EObject target;
+
+ /**
+ * @generated
+ */
+ public EAnnotationReferencesCreateCommand(CreateRelationshipRequest request) {
+ super(request.getLabel(), null, request);
+ source = request.getSource();
+ target = request.getTarget();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (!(source instanceof EAnnotation && (target == null || target instanceof EObject))) {
+ return false;
+ }
+ return EcoreBaseItemSemanticEditPolicy.LinkConstraints.canCreateEAnnotationReferences_4001(getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
+ }
+ if (getTarget() != null) {
+ getSource().getReferences().add(getTarget());
+ }
+ return CommandResult.newOKCommandResult(getSource());
+ }
+
+ /**
+ * @generated
+ */
+ protected EAnnotation getSource() {
+ return (EAnnotation) source;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getTarget() {
+ return (EObject) target;
+ }
+}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/commands/EClassESuperTypesCreateCommand.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/commands/EClassESuperTypesCreateCommand.java
new file mode 100644
index 000000000..fd0fc30b1
--- /dev/null
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/commands/EClassESuperTypesCreateCommand.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2006, 2007 Borland Software Corp.
+ *
+ * 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+package org.eclipse.gmf.ecore.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.ecore.edit.policies.EcoreBaseItemSemanticEditPolicy;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+
+/**
+ * @generated
+ */
+public class EClassESuperTypesCreateCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final EObject source;
+
+ /**
+ * @generated
+ */
+ private final EObject target;
+
+ /**
+ * @generated
+ */
+ public EClassESuperTypesCreateCommand(CreateRelationshipRequest request) {
+ super(request.getLabel(), null, request);
+ source = request.getSource();
+ target = request.getTarget();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (!(source instanceof EClass && (target == null || target instanceof EClass))) {
+ return false;
+ }
+ return EcoreBaseItemSemanticEditPolicy.LinkConstraints.canCreateEClassESuperTypes_4004(getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
+ }
+ if (getTarget() != null) {
+ getSource().getESuperTypes().add(getTarget());
+ }
+ return CommandResult.newOKCommandResult(getSource());
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getSource() {
+ return (EClass) source;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getTarget() {
+ return (EClass) target;
+ }
+}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotation2ItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotation2ItemSemanticEditPolicy.java
index c26bede3a..e1d8b185a 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotation2ItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotation2ItemSemanticEditPolicy.java
@@ -11,21 +11,16 @@
*/
package org.eclipse.gmf.ecore.edit.policies;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CompoundCommand;
-import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.ecore.edit.commands.EAnnotationReferencesCreateCommand;
import org.eclipse.gmf.ecore.edit.commands.EAnnotationReferencesReorientCommand;
import org.eclipse.gmf.ecore.edit.parts.EAnnotationReferencesEditPart;
import org.eclipse.gmf.ecore.providers.EcoreElementTypes;
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
/**
* @generated
@@ -36,8 +31,8 @@ public class EAnnotation2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEdi
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- CompoundCommand cc = getDestroyEdgesCommand(req.isConfirmationRequired());
- cc.add(getMSLWrapper(new DestroyElementCommand(req)));
+ CompoundCommand cc = getDestroyEdgesCommand();
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
return cc.unwrap();
}
@@ -55,34 +50,14 @@ public class EAnnotation2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEdi
* @generated
*/
protected Command getCreateStartOutgoingEAnnotationReferences_4001Command(CreateRelationshipRequest req) {
- EObject sourceEObject = req.getSource();
- if (false == sourceEObject instanceof EAnnotation) {
- return UnexecutableCommand.INSTANCE;
- }
- EAnnotation source = (EAnnotation) sourceEObject;
- if (!EcoreBaseItemSemanticEditPolicy.LinkConstraints.canCreateEAnnotationReferences_4001(source, null)) {
- return UnexecutableCommand.INSTANCE;
- }
- return new Command() {
- };
+ return getGEFWrapper(new EAnnotationReferencesCreateCommand(req));
}
/**
* @generated
*/
protected Command getCreateCompleteIncomingEAnnotationReferences_4001Command(CreateRelationshipRequest req) {
- EObject sourceEObject = req.getSource();
- EObject targetEObject = req.getTarget();
- if (false == sourceEObject instanceof EAnnotation || false == targetEObject instanceof EObject) {
- return UnexecutableCommand.INSTANCE;
- }
- EAnnotation source = (EAnnotation) sourceEObject;
- EObject target = (EObject) targetEObject;
- if (!EcoreBaseItemSemanticEditPolicy.LinkConstraints.canCreateEAnnotationReferences_4001(source, target)) {
- return UnexecutableCommand.INSTANCE;
- }
- SetRequest setReq = new SetRequest(sourceEObject, EcorePackage.eINSTANCE.getEAnnotation_References(), target);
- return getMSLWrapper(new SetValueCommand(setReq));
+ return getGEFWrapper(new EAnnotationReferencesCreateCommand(req));
}
/**
@@ -94,7 +69,7 @@ public class EAnnotation2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEdi
protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
switch (getVisualID(req)) {
case EAnnotationReferencesEditPart.VISUAL_ID:
- return getMSLWrapper(new EAnnotationReferencesReorientCommand(req));
+ return getGEFWrapper(new EAnnotationReferencesReorientCommand(req));
}
return super.getReorientReferenceRelationshipCommand(req);
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotationDetailsCanonicalEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotationDetailsCanonicalEditPolicy.java
index 251849968..cd22ea9c4 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotationDetailsCanonicalEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotationDetailsCanonicalEditPolicy.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2007 Borland Software Corp.
+ * Copyright (c) 2006, 2007 Borland Software Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -11,18 +11,16 @@
*/
package org.eclipse.gmf.ecore.edit.policies;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
-import org.eclipse.gmf.runtime.notation.View;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import org.eclipse.emf.ecore.EAnnotation;
import org.eclipse.emf.ecore.EObject;
-
import org.eclipse.gmf.ecore.edit.parts.EStringToStringMapEntryEditPart;
-
import org.eclipse.gmf.ecore.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
/**
* @generated
@@ -34,14 +32,14 @@ public class EAnnotationDetailsCanonicalEditPolicy extends CanonicalEditPolicy {
*/
protected List getSemanticChildrenList() {
List result = new LinkedList();
- EObject modelObject = ((View) getHost().getModel()).getElement();
View viewObject = (View) getHost().getModel();
- EObject nextValue;
- int nodeVID;
- for (Iterator values = ((EAnnotation) modelObject).getDetails().iterator(); values.hasNext();) {
- nextValue = (EObject) values.next();
- nodeVID = EcoreVisualIDRegistry.getNodeVisualID(viewObject, nextValue);
- if (EStringToStringMapEntryEditPart.VISUAL_ID == nodeVID) {
+ EAnnotation modelObject = (EAnnotation) viewObject.getElement();
+ List allValues = new LinkedList();
+ allValues.addAll(modelObject.getDetails());
+ for (Iterator valuesIterator = allValues.iterator(); valuesIterator.hasNext();) {
+ EObject nextValue = (EObject) valuesIterator.next();
+ switch (EcoreVisualIDRegistry.getNodeVisualID(viewObject, nextValue)) {
+ case EStringToStringMapEntryEditPart.VISUAL_ID:
result.add(nextValue);
}
}
@@ -52,11 +50,7 @@ public class EAnnotationDetailsCanonicalEditPolicy extends CanonicalEditPolicy {
* @generated
*/
protected boolean shouldDeleteView(View view) {
- if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
- return view.isSetElement() && (view.getElement() == null || view.getElement().eIsProxy());
- }
- int nodeVID = EcoreVisualIDRegistry.getVisualID(view);
- switch (nodeVID) {
+ switch (EcoreVisualIDRegistry.getVisualID(view)) {
case EStringToStringMapEntryEditPart.VISUAL_ID:
return true;
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotationDetailsItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotationDetailsItemSemanticEditPolicy.java
index 08b84ff56..48ffd39ff 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotationDetailsItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotationDetailsItemSemanticEditPolicy.java
@@ -34,7 +34,7 @@ public class EAnnotationDetailsItemSemanticEditPolicy extends EcoreBaseItemSeman
if (req.getContainmentFeature() == null) {
req.setContainmentFeature(EcorePackage.eINSTANCE.getEAnnotation_Details());
}
- return getMSLWrapper(new EStringToStringMapEntryCreateCommand(req));
+ return getGEFWrapper(new EStringToStringMapEntryCreateCommand(req));
}
return super.getCreateCommand(req);
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotationItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotationItemSemanticEditPolicy.java
index 2787087fa..e6e9f840d 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotationItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotationItemSemanticEditPolicy.java
@@ -14,11 +14,9 @@ package org.eclipse.gmf.ecore.edit.policies;
import java.util.Iterator;
import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CompoundCommand;
-import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.ecore.edit.commands.EAnnotationReferencesCreateCommand;
import org.eclipse.gmf.ecore.edit.commands.EAnnotationReferencesReorientCommand;
import org.eclipse.gmf.ecore.edit.parts.EAnnotationDetailsEditPart;
import org.eclipse.gmf.ecore.edit.parts.EAnnotationReferencesEditPart;
@@ -26,11 +24,9 @@ import org.eclipse.gmf.ecore.edit.parts.EStringToStringMapEntryEditPart;
import org.eclipse.gmf.ecore.part.EcoreVisualIDRegistry;
import org.eclipse.gmf.ecore.providers.EcoreElementTypes;
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.View;
@@ -43,27 +39,25 @@ public class EAnnotationItemSemanticEditPolicy extends EcoreBaseItemSemanticEdit
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- CompoundCommand cc = getDestroyEdgesCommand(req.isConfirmationRequired());
- addDestroyChildNodesCommand(cc, req.isConfirmationRequired());
- cc.add(getMSLWrapper(new DestroyElementCommand(req) {
-
- protected EObject getElementToDestroy() {
- View view = (View) getHost().getModel();
- EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
- if (annotation != null) {
- return view;
- }
- return super.getElementToDestroy();
- }
- }));
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ View view = (View) getHost().getModel();
+ if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
+ req.setElementToDestroy(view);
+ }
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
return cc.unwrap();
}
/**
* @generated
*/
- protected void addDestroyChildNodesCommand(CompoundCommand cmd, boolean confirm) {
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
Node node = (Node) it.next();
switch (EcoreVisualIDRegistry.getVisualID(node)) {
@@ -72,7 +66,7 @@ public class EAnnotationItemSemanticEditPolicy extends EcoreBaseItemSemanticEdit
Node cnode = (Node) cit.next();
switch (EcoreVisualIDRegistry.getVisualID(cnode)) {
case EStringToStringMapEntryEditPart.VISUAL_ID:
- cmd.add(getDestroyElementCommand(cnode, confirm));
+ cmd.add(getDestroyElementCommand(cnode));
break;
}
}
@@ -95,34 +89,14 @@ public class EAnnotationItemSemanticEditPolicy extends EcoreBaseItemSemanticEdit
* @generated
*/
protected Command getCreateStartOutgoingEAnnotationReferences_4001Command(CreateRelationshipRequest req) {
- EObject sourceEObject = req.getSource();
- if (false == sourceEObject instanceof EAnnotation) {
- return UnexecutableCommand.INSTANCE;
- }
- EAnnotation source = (EAnnotation) sourceEObject;
- if (!EcoreBaseItemSemanticEditPolicy.LinkConstraints.canCreateEAnnotationReferences_4001(source, null)) {
- return UnexecutableCommand.INSTANCE;
- }
- return new Command() {
- };
+ return getGEFWrapper(new EAnnotationReferencesCreateCommand(req));
}
/**
* @generated
*/
protected Command getCreateCompleteIncomingEAnnotationReferences_4001Command(CreateRelationshipRequest req) {
- EObject sourceEObject = req.getSource();
- EObject targetEObject = req.getTarget();
- if (false == sourceEObject instanceof EAnnotation || false == targetEObject instanceof EObject) {
- return UnexecutableCommand.INSTANCE;
- }
- EAnnotation source = (EAnnotation) sourceEObject;
- EObject target = (EObject) targetEObject;
- if (!EcoreBaseItemSemanticEditPolicy.LinkConstraints.canCreateEAnnotationReferences_4001(source, target)) {
- return UnexecutableCommand.INSTANCE;
- }
- SetRequest setReq = new SetRequest(sourceEObject, EcorePackage.eINSTANCE.getEAnnotation_References(), target);
- return getMSLWrapper(new SetValueCommand(setReq));
+ return getGEFWrapper(new EAnnotationReferencesCreateCommand(req));
}
/**
@@ -134,7 +108,7 @@ public class EAnnotationItemSemanticEditPolicy extends EcoreBaseItemSemanticEdit
protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
switch (getVisualID(req)) {
case EAnnotationReferencesEditPart.VISUAL_ID:
- return getMSLWrapper(new EAnnotationReferencesReorientCommand(req));
+ return getGEFWrapper(new EAnnotationReferencesReorientCommand(req));
}
return super.getReorientReferenceRelationshipCommand(req);
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotationReferencesItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotationReferencesItemSemanticEditPolicy.java
index 89d0ca16b..93a3d8f24 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotationReferencesItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAnnotationReferencesItemSemanticEditPolicy.java
@@ -24,7 +24,7 @@ public class EAnnotationReferencesItemSemanticEditPolicy extends EcoreBaseItemSe
* @generated
*/
protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) {
- return getMSLWrapper(new DestroyReferenceCommand(req));
+ return getGEFWrapper(new DestroyReferenceCommand(req));
}
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAttributeItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAttributeItemSemanticEditPolicy.java
index 6e36b7a9e..93894f396 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAttributeItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EAttributeItemSemanticEditPolicy.java
@@ -11,21 +11,16 @@
*/
package org.eclipse.gmf.ecore.edit.policies;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CompoundCommand;
-import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.ecore.edit.commands.EAnnotationReferencesCreateCommand;
import org.eclipse.gmf.ecore.edit.commands.EAnnotationReferencesReorientCommand;
import org.eclipse.gmf.ecore.edit.parts.EAnnotationReferencesEditPart;
import org.eclipse.gmf.ecore.providers.EcoreElementTypes;
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
/**
* @generated
@@ -36,8 +31,8 @@ public class EAttributeItemSemanticEditPolicy extends EcoreBaseItemSemanticEditP
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- CompoundCommand cc = getDestroyEdgesCommand(req.isConfirmationRequired());
- cc.add(getMSLWrapper(new DestroyElementCommand(req)));
+ CompoundCommand cc = getDestroyEdgesCommand();
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
return cc.unwrap();
}
@@ -55,18 +50,7 @@ public class EAttributeItemSemanticEditPolicy extends EcoreBaseItemSemanticEditP
* @generated
*/
protected Command getCreateCompleteIncomingEAnnotationReferences_4001Command(CreateRelationshipRequest req) {
- EObject sourceEObject = req.getSource();
- EObject targetEObject = req.getTarget();
- if (false == sourceEObject instanceof EAnnotation || false == targetEObject instanceof EObject) {
- return UnexecutableCommand.INSTANCE;
- }
- EAnnotation source = (EAnnotation) sourceEObject;
- EObject target = (EObject) targetEObject;
- if (!EcoreBaseItemSemanticEditPolicy.LinkConstraints.canCreateEAnnotationReferences_4001(source, target)) {
- return UnexecutableCommand.INSTANCE;
- }
- SetRequest setReq = new SetRequest(sourceEObject, EcorePackage.eINSTANCE.getEAnnotation_References(), target);
- return getMSLWrapper(new SetValueCommand(setReq));
+ return getGEFWrapper(new EAnnotationReferencesCreateCommand(req));
}
/**
@@ -78,7 +62,7 @@ public class EAttributeItemSemanticEditPolicy extends EcoreBaseItemSemanticEditP
protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
switch (getVisualID(req)) {
case EAnnotationReferencesEditPart.VISUAL_ID:
- return getMSLWrapper(new EAnnotationReferencesReorientCommand(req));
+ return getGEFWrapper(new EAnnotationReferencesReorientCommand(req));
}
return super.getReorientReferenceRelationshipCommand(req);
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClass2ItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClass2ItemSemanticEditPolicy.java
index e259353a7..11c0b6484 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClass2ItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClass2ItemSemanticEditPolicy.java
@@ -11,7 +11,6 @@
*/
package org.eclipse.gmf.ecore.edit.policies;
-import org.eclipse.emf.ecore.EAnnotation;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EObject;
@@ -19,7 +18,9 @@ import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CompoundCommand;
import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.ecore.edit.commands.EAnnotationReferencesCreateCommand;
import org.eclipse.gmf.ecore.edit.commands.EAnnotationReferencesReorientCommand;
+import org.eclipse.gmf.ecore.edit.commands.EClassESuperTypesCreateCommand;
import org.eclipse.gmf.ecore.edit.commands.EClassESuperTypesReorientCommand;
import org.eclipse.gmf.ecore.edit.commands.EReference2CreateCommand;
import org.eclipse.gmf.ecore.edit.commands.EReference2ReorientCommand;
@@ -31,12 +32,10 @@ import org.eclipse.gmf.ecore.edit.parts.EReference2EditPart;
import org.eclipse.gmf.ecore.edit.parts.EReferenceEditPart;
import org.eclipse.gmf.ecore.providers.EcoreElementTypes;
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
/**
* @generated
@@ -47,8 +46,8 @@ public class EClass2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPoli
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- CompoundCommand cc = getDestroyEdgesCommand(req.isConfirmationRequired());
- cc.add(getMSLWrapper(new DestroyElementCommand(req)));
+ CompoundCommand cc = getDestroyEdgesCommand();
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
return cc.unwrap();
}
@@ -75,18 +74,7 @@ public class EClass2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPoli
* @generated
*/
protected Command getCreateCompleteIncomingEAnnotationReferences_4001Command(CreateRelationshipRequest req) {
- EObject sourceEObject = req.getSource();
- EObject targetEObject = req.getTarget();
- if (false == sourceEObject instanceof EAnnotation || false == targetEObject instanceof EObject) {
- return UnexecutableCommand.INSTANCE;
- }
- EAnnotation source = (EAnnotation) sourceEObject;
- EObject target = (EObject) targetEObject;
- if (!EcoreBaseItemSemanticEditPolicy.LinkConstraints.canCreateEAnnotationReferences_4001(source, target)) {
- return UnexecutableCommand.INSTANCE;
- }
- SetRequest setReq = new SetRequest(sourceEObject, EcorePackage.eINSTANCE.getEAnnotation_References(), target);
- return getMSLWrapper(new SetValueCommand(setReq));
+ return getGEFWrapper(new EAnnotationReferencesCreateCommand(req));
}
/**
@@ -122,7 +110,7 @@ public class EClass2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPoli
if (req.getContainmentFeature() == null) {
req.setContainmentFeature(EcorePackage.eINSTANCE.getEClass_EStructuralFeatures());
}
- return getMSLWrapper(new EReferenceCreateCommand(req, source, target));
+ return getGEFWrapper(new EReferenceCreateCommand(req, source, target));
}
/**
@@ -158,41 +146,21 @@ public class EClass2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPoli
if (req.getContainmentFeature() == null) {
req.setContainmentFeature(EcorePackage.eINSTANCE.getEClass_EStructuralFeatures());
}
- return getMSLWrapper(new EReference2CreateCommand(req, source, target));
+ return getGEFWrapper(new EReference2CreateCommand(req, source, target));
}
/**
* @generated
*/
protected Command getCreateStartOutgoingEClassESuperTypes_4004Command(CreateRelationshipRequest req) {
- EObject sourceEObject = req.getSource();
- if (false == sourceEObject instanceof EClass) {
- return UnexecutableCommand.INSTANCE;
- }
- EClass source = (EClass) sourceEObject;
- if (!EcoreBaseItemSemanticEditPolicy.LinkConstraints.canCreateEClassESuperTypes_4004(source, null)) {
- return UnexecutableCommand.INSTANCE;
- }
- return new Command() {
- };
+ return getGEFWrapper(new EClassESuperTypesCreateCommand(req));
}
/**
* @generated
*/
protected Command getCreateCompleteIncomingEClassESuperTypes_4004Command(CreateRelationshipRequest req) {
- EObject sourceEObject = req.getSource();
- EObject targetEObject = req.getTarget();
- if (false == sourceEObject instanceof EClass || false == targetEObject instanceof EClass) {
- return UnexecutableCommand.INSTANCE;
- }
- EClass source = (EClass) sourceEObject;
- EClass target = (EClass) targetEObject;
- if (!EcoreBaseItemSemanticEditPolicy.LinkConstraints.canCreateEClassESuperTypes_4004(source, target)) {
- return UnexecutableCommand.INSTANCE;
- }
- SetRequest setReq = new SetRequest(sourceEObject, EcorePackage.eINSTANCE.getEClass_ESuperTypes(), target);
- return getMSLWrapper(new SetValueCommand(setReq));
+ return getGEFWrapper(new EClassESuperTypesCreateCommand(req));
}
/**
@@ -204,9 +172,9 @@ public class EClass2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPoli
protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
switch (getVisualID(req)) {
case EReferenceEditPart.VISUAL_ID:
- return getMSLWrapper(new EReferenceReorientCommand(req));
+ return getGEFWrapper(new EReferenceReorientCommand(req));
case EReference2EditPart.VISUAL_ID:
- return getMSLWrapper(new EReference2ReorientCommand(req));
+ return getGEFWrapper(new EReference2ReorientCommand(req));
}
return super.getReorientRelationshipCommand(req);
}
@@ -220,9 +188,9 @@ public class EClass2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPoli
protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
switch (getVisualID(req)) {
case EAnnotationReferencesEditPart.VISUAL_ID:
- return getMSLWrapper(new EAnnotationReferencesReorientCommand(req));
+ return getGEFWrapper(new EAnnotationReferencesReorientCommand(req));
case EClassESuperTypesEditPart.VISUAL_ID:
- return getMSLWrapper(new EClassESuperTypesReorientCommand(req));
+ return getGEFWrapper(new EClassESuperTypesReorientCommand(req));
}
return super.getReorientReferenceRelationshipCommand(req);
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassAttributesCanonicalEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassAttributesCanonicalEditPolicy.java
index 1e1f569c0..49b1140d3 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassAttributesCanonicalEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassAttributesCanonicalEditPolicy.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2007 Borland Software Corp.
+ * Copyright (c) 2006, 2007 Borland Software Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -11,18 +11,16 @@
*/
package org.eclipse.gmf.ecore.edit.policies;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
-import org.eclipse.gmf.runtime.notation.View;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
-
import org.eclipse.gmf.ecore.edit.parts.EAttributeEditPart;
-
import org.eclipse.gmf.ecore.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
/**
* @generated
@@ -34,14 +32,14 @@ public class EClassAttributesCanonicalEditPolicy extends CanonicalEditPolicy {
*/
protected List getSemanticChildrenList() {
List result = new LinkedList();
- EObject modelObject = ((View) getHost().getModel()).getElement();
View viewObject = (View) getHost().getModel();
- EObject nextValue;
- int nodeVID;
- for (Iterator values = ((EClass) modelObject).getEAttributes().iterator(); values.hasNext();) {
- nextValue = (EObject) values.next();
- nodeVID = EcoreVisualIDRegistry.getNodeVisualID(viewObject, nextValue);
- if (EAttributeEditPart.VISUAL_ID == nodeVID) {
+ EClass modelObject = (EClass) viewObject.getElement();
+ List allValues = new LinkedList();
+ allValues.addAll(modelObject.getEAttributes());
+ for (Iterator valuesIterator = allValues.iterator(); valuesIterator.hasNext();) {
+ EObject nextValue = (EObject) valuesIterator.next();
+ switch (EcoreVisualIDRegistry.getNodeVisualID(viewObject, nextValue)) {
+ case EAttributeEditPart.VISUAL_ID:
result.add(nextValue);
}
}
@@ -52,11 +50,7 @@ public class EClassAttributesCanonicalEditPolicy extends CanonicalEditPolicy {
* @generated
*/
protected boolean shouldDeleteView(View view) {
- if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
- return view.isSetElement() && (view.getElement() == null || view.getElement().eIsProxy());
- }
- int nodeVID = EcoreVisualIDRegistry.getVisualID(view);
- switch (nodeVID) {
+ switch (EcoreVisualIDRegistry.getVisualID(view)) {
case EAttributeEditPart.VISUAL_ID:
return true;
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassAttributesItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassAttributesItemSemanticEditPolicy.java
index 62f841d60..6c2aa9c94 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassAttributesItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassAttributesItemSemanticEditPolicy.java
@@ -34,7 +34,7 @@ public class EClassAttributesItemSemanticEditPolicy extends EcoreBaseItemSemanti
if (req.getContainmentFeature() == null) {
req.setContainmentFeature(EcorePackage.eINSTANCE.getEClass_EStructuralFeatures());
}
- return getMSLWrapper(new EAttributeCreateCommand(req));
+ return getGEFWrapper(new EAttributeCreateCommand(req));
}
return super.getCreateCommand(req);
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassClassAnnotationsCanonicalEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassClassAnnotationsCanonicalEditPolicy.java
index 9e9a6cd1b..ad7836048 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassClassAnnotationsCanonicalEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassClassAnnotationsCanonicalEditPolicy.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2007 Borland Software Corp.
+ * Copyright (c) 2006, 2007 Borland Software Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -11,18 +11,16 @@
*/
package org.eclipse.gmf.ecore.edit.policies;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
-import org.eclipse.gmf.runtime.notation.View;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
-import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
-
import org.eclipse.gmf.ecore.edit.parts.EAnnotation2EditPart;
-
import org.eclipse.gmf.ecore.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
/**
* @generated
@@ -34,14 +32,14 @@ public class EClassClassAnnotationsCanonicalEditPolicy extends CanonicalEditPoli
*/
protected List getSemanticChildrenList() {
List result = new LinkedList();
- EObject modelObject = ((View) getHost().getModel()).getElement();
View viewObject = (View) getHost().getModel();
- EObject nextValue;
- int nodeVID;
- for (Iterator values = ((EModelElement) modelObject).getEAnnotations().iterator(); values.hasNext();) {
- nextValue = (EObject) values.next();
- nodeVID = EcoreVisualIDRegistry.getNodeVisualID(viewObject, nextValue);
- if (EAnnotation2EditPart.VISUAL_ID == nodeVID) {
+ EClass modelObject = (EClass) viewObject.getElement();
+ List allValues = new LinkedList();
+ allValues.addAll(modelObject.getEAnnotations());
+ for (Iterator valuesIterator = allValues.iterator(); valuesIterator.hasNext();) {
+ EObject nextValue = (EObject) valuesIterator.next();
+ switch (EcoreVisualIDRegistry.getNodeVisualID(viewObject, nextValue)) {
+ case EAnnotation2EditPart.VISUAL_ID:
result.add(nextValue);
}
}
@@ -52,11 +50,7 @@ public class EClassClassAnnotationsCanonicalEditPolicy extends CanonicalEditPoli
* @generated
*/
protected boolean shouldDeleteView(View view) {
- if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
- return view.isSetElement() && (view.getElement() == null || view.getElement().eIsProxy());
- }
- int nodeVID = EcoreVisualIDRegistry.getVisualID(view);
- switch (nodeVID) {
+ switch (EcoreVisualIDRegistry.getVisualID(view)) {
case EAnnotation2EditPart.VISUAL_ID:
return true;
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassClassAnnotationsItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassClassAnnotationsItemSemanticEditPolicy.java
index 92f00ad2e..5b92dd29d 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassClassAnnotationsItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassClassAnnotationsItemSemanticEditPolicy.java
@@ -34,7 +34,7 @@ public class EClassClassAnnotationsItemSemanticEditPolicy extends EcoreBaseItemS
if (req.getContainmentFeature() == null) {
req.setContainmentFeature(EcorePackage.eINSTANCE.getEModelElement_EAnnotations());
}
- return getMSLWrapper(new EAnnotation2CreateCommand(req));
+ return getGEFWrapper(new EAnnotation2CreateCommand(req));
}
return super.getCreateCommand(req);
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassESuperTypesItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassESuperTypesItemSemanticEditPolicy.java
index 6818082d6..b86d1086f 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassESuperTypesItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassESuperTypesItemSemanticEditPolicy.java
@@ -24,7 +24,7 @@ public class EClassESuperTypesItemSemanticEditPolicy extends EcoreBaseItemSemant
* @generated
*/
protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) {
- return getMSLWrapper(new DestroyReferenceCommand(req));
+ return getGEFWrapper(new DestroyReferenceCommand(req));
}
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassItemSemanticEditPolicy.java
index 51905bc9c..425d850c6 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassItemSemanticEditPolicy.java
@@ -21,7 +21,9 @@ import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CompoundCommand;
import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.ecore.edit.commands.EAnnotationReferencesCreateCommand;
import org.eclipse.gmf.ecore.edit.commands.EAnnotationReferencesReorientCommand;
+import org.eclipse.gmf.ecore.edit.commands.EClassESuperTypesCreateCommand;
import org.eclipse.gmf.ecore.edit.commands.EClassESuperTypesReorientCommand;
import org.eclipse.gmf.ecore.edit.commands.EReference2CreateCommand;
import org.eclipse.gmf.ecore.edit.commands.EReference2ReorientCommand;
@@ -40,12 +42,10 @@ import org.eclipse.gmf.ecore.edit.parts.EReferenceEditPart;
import org.eclipse.gmf.ecore.part.EcoreVisualIDRegistry;
import org.eclipse.gmf.ecore.providers.EcoreElementTypes;
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.View;
@@ -58,27 +58,25 @@ public class EClassItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolic
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- CompoundCommand cc = getDestroyEdgesCommand(req.isConfirmationRequired());
- addDestroyChildNodesCommand(cc, req.isConfirmationRequired());
- cc.add(getMSLWrapper(new DestroyElementCommand(req) {
-
- protected EObject getElementToDestroy() {
- View view = (View) getHost().getModel();
- EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
- if (annotation != null) {
- return view;
- }
- return super.getElementToDestroy();
- }
- }));
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ View view = (View) getHost().getModel();
+ if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
+ req.setElementToDestroy(view);
+ }
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
return cc.unwrap();
}
/**
* @generated
*/
- protected void addDestroyChildNodesCommand(CompoundCommand cmd, boolean confirm) {
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
Node node = (Node) it.next();
switch (EcoreVisualIDRegistry.getVisualID(node)) {
@@ -87,7 +85,7 @@ public class EClassItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolic
Node cnode = (Node) cit.next();
switch (EcoreVisualIDRegistry.getVisualID(cnode)) {
case EAttributeEditPart.VISUAL_ID:
- cmd.add(getDestroyElementCommand(cnode, confirm));
+ cmd.add(getDestroyElementCommand(cnode));
break;
}
}
@@ -97,7 +95,7 @@ public class EClassItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolic
Node cnode = (Node) cit.next();
switch (EcoreVisualIDRegistry.getVisualID(cnode)) {
case EOperationEditPart.VISUAL_ID:
- cmd.add(getDestroyElementCommand(cnode, confirm));
+ cmd.add(getDestroyElementCommand(cnode));
break;
}
}
@@ -107,7 +105,7 @@ public class EClassItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolic
Node cnode = (Node) cit.next();
switch (EcoreVisualIDRegistry.getVisualID(cnode)) {
case EAnnotation2EditPart.VISUAL_ID:
- cmd.add(getDestroyElementCommand(cnode, confirm));
+ cmd.add(getDestroyElementCommand(cnode));
break;
}
}
@@ -139,18 +137,7 @@ public class EClassItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolic
* @generated
*/
protected Command getCreateCompleteIncomingEAnnotationReferences_4001Command(CreateRelationshipRequest req) {
- EObject sourceEObject = req.getSource();
- EObject targetEObject = req.getTarget();
- if (false == sourceEObject instanceof EAnnotation || false == targetEObject instanceof EObject) {
- return UnexecutableCommand.INSTANCE;
- }
- EAnnotation source = (EAnnotation) sourceEObject;
- EObject target = (EObject) targetEObject;
- if (!EcoreBaseItemSemanticEditPolicy.LinkConstraints.canCreateEAnnotationReferences_4001(source, target)) {
- return UnexecutableCommand.INSTANCE;
- }
- SetRequest setReq = new SetRequest(sourceEObject, EcorePackage.eINSTANCE.getEAnnotation_References(), target);
- return getMSLWrapper(new SetValueCommand(setReq));
+ return getGEFWrapper(new EAnnotationReferencesCreateCommand(req));
}
/**
@@ -186,7 +173,7 @@ public class EClassItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolic
if (req.getContainmentFeature() == null) {
req.setContainmentFeature(EcorePackage.eINSTANCE.getEClass_EStructuralFeatures());
}
- return getMSLWrapper(new EReferenceCreateCommand(req, source, target));
+ return getGEFWrapper(new EReferenceCreateCommand(req, source, target));
}
/**
@@ -222,41 +209,21 @@ public class EClassItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolic
if (req.getContainmentFeature() == null) {
req.setContainmentFeature(EcorePackage.eINSTANCE.getEClass_EStructuralFeatures());
}
- return getMSLWrapper(new EReference2CreateCommand(req, source, target));
+ return getGEFWrapper(new EReference2CreateCommand(req, source, target));
}
/**
* @generated
*/
protected Command getCreateStartOutgoingEClassESuperTypes_4004Command(CreateRelationshipRequest req) {
- EObject sourceEObject = req.getSource();
- if (false == sourceEObject instanceof EClass) {
- return UnexecutableCommand.INSTANCE;
- }
- EClass source = (EClass) sourceEObject;
- if (!EcoreBaseItemSemanticEditPolicy.LinkConstraints.canCreateEClassESuperTypes_4004(source, null)) {
- return UnexecutableCommand.INSTANCE;
- }
- return new Command() {
- };
+ return getGEFWrapper(new EClassESuperTypesCreateCommand(req));
}
/**
* @generated
*/
protected Command getCreateCompleteIncomingEClassESuperTypes_4004Command(CreateRelationshipRequest req) {
- EObject sourceEObject = req.getSource();
- EObject targetEObject = req.getTarget();
- if (false == sourceEObject instanceof EClass || false == targetEObject instanceof EClass) {
- return UnexecutableCommand.INSTANCE;
- }
- EClass source = (EClass) sourceEObject;
- EClass target = (EClass) targetEObject;
- if (!EcoreBaseItemSemanticEditPolicy.LinkConstraints.canCreateEClassESuperTypes_4004(source, target)) {
- return UnexecutableCommand.INSTANCE;
- }
- SetRequest setReq = new SetRequest(sourceEObject, EcorePackage.eINSTANCE.getEClass_ESuperTypes(), target);
- return getMSLWrapper(new SetValueCommand(setReq));
+ return getGEFWrapper(new EClassESuperTypesCreateCommand(req));
}
/**
@@ -268,9 +235,9 @@ public class EClassItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolic
protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
switch (getVisualID(req)) {
case EReferenceEditPart.VISUAL_ID:
- return getMSLWrapper(new EReferenceReorientCommand(req));
+ return getGEFWrapper(new EReferenceReorientCommand(req));
case EReference2EditPart.VISUAL_ID:
- return getMSLWrapper(new EReference2ReorientCommand(req));
+ return getGEFWrapper(new EReference2ReorientCommand(req));
}
return super.getReorientRelationshipCommand(req);
}
@@ -284,9 +251,9 @@ public class EClassItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolic
protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
switch (getVisualID(req)) {
case EAnnotationReferencesEditPart.VISUAL_ID:
- return getMSLWrapper(new EAnnotationReferencesReorientCommand(req));
+ return getGEFWrapper(new EAnnotationReferencesReorientCommand(req));
case EClassESuperTypesEditPart.VISUAL_ID:
- return getMSLWrapper(new EClassESuperTypesReorientCommand(req));
+ return getGEFWrapper(new EClassESuperTypesReorientCommand(req));
}
return super.getReorientReferenceRelationshipCommand(req);
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassOperationsCanonicalEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassOperationsCanonicalEditPolicy.java
index 9ff33c1a1..de48a5a9e 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassOperationsCanonicalEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassOperationsCanonicalEditPolicy.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2007 Borland Software Corp.
+ * Copyright (c) 2006, 2007 Borland Software Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -11,18 +11,16 @@
*/
package org.eclipse.gmf.ecore.edit.policies;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
-import org.eclipse.gmf.runtime.notation.View;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
-
import org.eclipse.gmf.ecore.edit.parts.EOperationEditPart;
-
import org.eclipse.gmf.ecore.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
/**
* @generated
@@ -34,14 +32,14 @@ public class EClassOperationsCanonicalEditPolicy extends CanonicalEditPolicy {
*/
protected List getSemanticChildrenList() {
List result = new LinkedList();
- EObject modelObject = ((View) getHost().getModel()).getElement();
View viewObject = (View) getHost().getModel();
- EObject nextValue;
- int nodeVID;
- for (Iterator values = ((EClass) modelObject).getEOperations().iterator(); values.hasNext();) {
- nextValue = (EObject) values.next();
- nodeVID = EcoreVisualIDRegistry.getNodeVisualID(viewObject, nextValue);
- if (EOperationEditPart.VISUAL_ID == nodeVID) {
+ EClass modelObject = (EClass) viewObject.getElement();
+ List allValues = new LinkedList();
+ allValues.addAll(modelObject.getEOperations());
+ for (Iterator valuesIterator = allValues.iterator(); valuesIterator.hasNext();) {
+ EObject nextValue = (EObject) valuesIterator.next();
+ switch (EcoreVisualIDRegistry.getNodeVisualID(viewObject, nextValue)) {
+ case EOperationEditPart.VISUAL_ID:
result.add(nextValue);
}
}
@@ -52,11 +50,7 @@ public class EClassOperationsCanonicalEditPolicy extends CanonicalEditPolicy {
* @generated
*/
protected boolean shouldDeleteView(View view) {
- if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
- return view.isSetElement() && (view.getElement() == null || view.getElement().eIsProxy());
- }
- int nodeVID = EcoreVisualIDRegistry.getVisualID(view);
- switch (nodeVID) {
+ switch (EcoreVisualIDRegistry.getVisualID(view)) {
case EOperationEditPart.VISUAL_ID:
return true;
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassOperationsItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassOperationsItemSemanticEditPolicy.java
index d7b08700b..d8ff28a8c 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassOperationsItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EClassOperationsItemSemanticEditPolicy.java
@@ -34,7 +34,7 @@ public class EClassOperationsItemSemanticEditPolicy extends EcoreBaseItemSemanti
if (req.getContainmentFeature() == null) {
req.setContainmentFeature(EcorePackage.eINSTANCE.getEClass_EOperations());
}
- return getMSLWrapper(new EOperationCreateCommand(req));
+ return getGEFWrapper(new EOperationCreateCommand(req));
}
return super.getCreateCommand(req);
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EDataType2ItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EDataType2ItemSemanticEditPolicy.java
index 33c598228..f784469a2 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EDataType2ItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EDataType2ItemSemanticEditPolicy.java
@@ -11,7 +11,6 @@
*/
package org.eclipse.gmf.ecore.edit.policies;
-import org.eclipse.emf.ecore.EAnnotation;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EObject;
@@ -19,6 +18,7 @@ import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CompoundCommand;
import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.ecore.edit.commands.EAnnotationReferencesCreateCommand;
import org.eclipse.gmf.ecore.edit.commands.EAnnotationReferencesReorientCommand;
import org.eclipse.gmf.ecore.edit.commands.EReference2CreateCommand;
import org.eclipse.gmf.ecore.edit.commands.EReference2ReorientCommand;
@@ -29,12 +29,10 @@ import org.eclipse.gmf.ecore.edit.parts.EReference2EditPart;
import org.eclipse.gmf.ecore.edit.parts.EReferenceEditPart;
import org.eclipse.gmf.ecore.providers.EcoreElementTypes;
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
/**
* @generated
@@ -45,8 +43,8 @@ public class EDataType2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditP
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- CompoundCommand cc = getDestroyEdgesCommand(req.isConfirmationRequired());
- cc.add(getMSLWrapper(new DestroyElementCommand(req)));
+ CompoundCommand cc = getDestroyEdgesCommand();
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
return cc.unwrap();
}
@@ -70,18 +68,7 @@ public class EDataType2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditP
* @generated
*/
protected Command getCreateCompleteIncomingEAnnotationReferences_4001Command(CreateRelationshipRequest req) {
- EObject sourceEObject = req.getSource();
- EObject targetEObject = req.getTarget();
- if (false == sourceEObject instanceof EAnnotation || false == targetEObject instanceof EObject) {
- return UnexecutableCommand.INSTANCE;
- }
- EAnnotation source = (EAnnotation) sourceEObject;
- EObject target = (EObject) targetEObject;
- if (!EcoreBaseItemSemanticEditPolicy.LinkConstraints.canCreateEAnnotationReferences_4001(source, target)) {
- return UnexecutableCommand.INSTANCE;
- }
- SetRequest setReq = new SetRequest(sourceEObject, EcorePackage.eINSTANCE.getEAnnotation_References(), target);
- return getMSLWrapper(new SetValueCommand(setReq));
+ return getGEFWrapper(new EAnnotationReferencesCreateCommand(req));
}
/**
@@ -101,7 +88,7 @@ public class EDataType2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditP
if (req.getContainmentFeature() == null) {
req.setContainmentFeature(EcorePackage.eINSTANCE.getEClass_EStructuralFeatures());
}
- return getMSLWrapper(new EReferenceCreateCommand(req, source, target));
+ return getGEFWrapper(new EReferenceCreateCommand(req, source, target));
}
/**
@@ -121,7 +108,7 @@ public class EDataType2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditP
if (req.getContainmentFeature() == null) {
req.setContainmentFeature(EcorePackage.eINSTANCE.getEClass_EStructuralFeatures());
}
- return getMSLWrapper(new EReference2CreateCommand(req, source, target));
+ return getGEFWrapper(new EReference2CreateCommand(req, source, target));
}
/**
@@ -133,9 +120,9 @@ public class EDataType2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditP
protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
switch (getVisualID(req)) {
case EReferenceEditPart.VISUAL_ID:
- return getMSLWrapper(new EReferenceReorientCommand(req));
+ return getGEFWrapper(new EReferenceReorientCommand(req));
case EReference2EditPart.VISUAL_ID:
- return getMSLWrapper(new EReference2ReorientCommand(req));
+ return getGEFWrapper(new EReference2ReorientCommand(req));
}
return super.getReorientRelationshipCommand(req);
}
@@ -149,7 +136,7 @@ public class EDataType2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditP
protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
switch (getVisualID(req)) {
case EAnnotationReferencesEditPart.VISUAL_ID:
- return getMSLWrapper(new EAnnotationReferencesReorientCommand(req));
+ return getGEFWrapper(new EAnnotationReferencesReorientCommand(req));
}
return super.getReorientReferenceRelationshipCommand(req);
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EDataTypeDataTypeAnnotationsCanonicalEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EDataTypeDataTypeAnnotationsCanonicalEditPolicy.java
index 3f181b670..ee72360b6 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EDataTypeDataTypeAnnotationsCanonicalEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EDataTypeDataTypeAnnotationsCanonicalEditPolicy.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2007 Borland Software Corp.
+ * Copyright (c) 2006, 2007 Borland Software Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -11,18 +11,16 @@
*/
package org.eclipse.gmf.ecore.edit.policies;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
-import org.eclipse.gmf.runtime.notation.View;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
-import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
-
import org.eclipse.gmf.ecore.edit.parts.EAnnotation2EditPart;
-
import org.eclipse.gmf.ecore.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
/**
* @generated
@@ -34,14 +32,14 @@ public class EDataTypeDataTypeAnnotationsCanonicalEditPolicy extends CanonicalEd
*/
protected List getSemanticChildrenList() {
List result = new LinkedList();
- EObject modelObject = ((View) getHost().getModel()).getElement();
View viewObject = (View) getHost().getModel();
- EObject nextValue;
- int nodeVID;
- for (Iterator values = ((EModelElement) modelObject).getEAnnotations().iterator(); values.hasNext();) {
- nextValue = (EObject) values.next();
- nodeVID = EcoreVisualIDRegistry.getNodeVisualID(viewObject, nextValue);
- if (EAnnotation2EditPart.VISUAL_ID == nodeVID) {
+ EDataType modelObject = (EDataType) viewObject.getElement();
+ List allValues = new LinkedList();
+ allValues.addAll(modelObject.getEAnnotations());
+ for (Iterator valuesIterator = allValues.iterator(); valuesIterator.hasNext();) {
+ EObject nextValue = (EObject) valuesIterator.next();
+ switch (EcoreVisualIDRegistry.getNodeVisualID(viewObject, nextValue)) {
+ case EAnnotation2EditPart.VISUAL_ID:
result.add(nextValue);
}
}
@@ -52,11 +50,7 @@ public class EDataTypeDataTypeAnnotationsCanonicalEditPolicy extends CanonicalEd
* @generated
*/
protected boolean shouldDeleteView(View view) {
- if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
- return view.isSetElement() && (view.getElement() == null || view.getElement().eIsProxy());
- }
- int nodeVID = EcoreVisualIDRegistry.getVisualID(view);
- switch (nodeVID) {
+ switch (EcoreVisualIDRegistry.getVisualID(view)) {
case EAnnotation2EditPart.VISUAL_ID:
return true;
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EDataTypeDataTypeAnnotationsItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EDataTypeDataTypeAnnotationsItemSemanticEditPolicy.java
index 3a7b50de3..26c6dd3e3 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EDataTypeDataTypeAnnotationsItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EDataTypeDataTypeAnnotationsItemSemanticEditPolicy.java
@@ -34,7 +34,7 @@ public class EDataTypeDataTypeAnnotationsItemSemanticEditPolicy extends EcoreBas
if (req.getContainmentFeature() == null) {
req.setContainmentFeature(EcorePackage.eINSTANCE.getEModelElement_EAnnotations());
}
- return getMSLWrapper(new EAnnotation2CreateCommand(req));
+ return getGEFWrapper(new EAnnotation2CreateCommand(req));
}
return super.getCreateCommand(req);
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EDataTypeItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EDataTypeItemSemanticEditPolicy.java
index 66efbe1c6..47bd0a088 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EDataTypeItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EDataTypeItemSemanticEditPolicy.java
@@ -21,6 +21,7 @@ import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CompoundCommand;
import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.ecore.edit.commands.EAnnotationReferencesCreateCommand;
import org.eclipse.gmf.ecore.edit.commands.EAnnotationReferencesReorientCommand;
import org.eclipse.gmf.ecore.edit.commands.EReference2CreateCommand;
import org.eclipse.gmf.ecore.edit.commands.EReference2ReorientCommand;
@@ -34,12 +35,10 @@ import org.eclipse.gmf.ecore.edit.parts.EReferenceEditPart;
import org.eclipse.gmf.ecore.part.EcoreVisualIDRegistry;
import org.eclipse.gmf.ecore.providers.EcoreElementTypes;
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.View;
@@ -52,27 +51,25 @@ public class EDataTypeItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPo
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- CompoundCommand cc = getDestroyEdgesCommand(req.isConfirmationRequired());
- addDestroyChildNodesCommand(cc, req.isConfirmationRequired());
- cc.add(getMSLWrapper(new DestroyElementCommand(req) {
-
- protected EObject getElementToDestroy() {
- View view = (View) getHost().getModel();
- EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
- if (annotation != null) {
- return view;
- }
- return super.getElementToDestroy();
- }
- }));
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ View view = (View) getHost().getModel();
+ if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
+ req.setElementToDestroy(view);
+ }
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
return cc.unwrap();
}
/**
* @generated
*/
- protected void addDestroyChildNodesCommand(CompoundCommand cmd, boolean confirm) {
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
Node node = (Node) it.next();
switch (EcoreVisualIDRegistry.getVisualID(node)) {
@@ -81,7 +78,7 @@ public class EDataTypeItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPo
Node cnode = (Node) cit.next();
switch (EcoreVisualIDRegistry.getVisualID(cnode)) {
case EAnnotation2EditPart.VISUAL_ID:
- cmd.add(getDestroyElementCommand(cnode, confirm));
+ cmd.add(getDestroyElementCommand(cnode));
break;
}
}
@@ -110,18 +107,7 @@ public class EDataTypeItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPo
* @generated
*/
protected Command getCreateCompleteIncomingEAnnotationReferences_4001Command(CreateRelationshipRequest req) {
- EObject sourceEObject = req.getSource();
- EObject targetEObject = req.getTarget();
- if (false == sourceEObject instanceof EAnnotation || false == targetEObject instanceof EObject) {
- return UnexecutableCommand.INSTANCE;
- }
- EAnnotation source = (EAnnotation) sourceEObject;
- EObject target = (EObject) targetEObject;
- if (!EcoreBaseItemSemanticEditPolicy.LinkConstraints.canCreateEAnnotationReferences_4001(source, target)) {
- return UnexecutableCommand.INSTANCE;
- }
- SetRequest setReq = new SetRequest(sourceEObject, EcorePackage.eINSTANCE.getEAnnotation_References(), target);
- return getMSLWrapper(new SetValueCommand(setReq));
+ return getGEFWrapper(new EAnnotationReferencesCreateCommand(req));
}
/**
@@ -141,7 +127,7 @@ public class EDataTypeItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPo
if (req.getContainmentFeature() == null) {
req.setContainmentFeature(EcorePackage.eINSTANCE.getEClass_EStructuralFeatures());
}
- return getMSLWrapper(new EReferenceCreateCommand(req, source, target));
+ return getGEFWrapper(new EReferenceCreateCommand(req, source, target));
}
/**
@@ -161,7 +147,7 @@ public class EDataTypeItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPo
if (req.getContainmentFeature() == null) {
req.setContainmentFeature(EcorePackage.eINSTANCE.getEClass_EStructuralFeatures());
}
- return getMSLWrapper(new EReference2CreateCommand(req, source, target));
+ return getGEFWrapper(new EReference2CreateCommand(req, source, target));
}
/**
@@ -173,9 +159,9 @@ public class EDataTypeItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPo
protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
switch (getVisualID(req)) {
case EReferenceEditPart.VISUAL_ID:
- return getMSLWrapper(new EReferenceReorientCommand(req));
+ return getGEFWrapper(new EReferenceReorientCommand(req));
case EReference2EditPart.VISUAL_ID:
- return getMSLWrapper(new EReference2ReorientCommand(req));
+ return getGEFWrapper(new EReference2ReorientCommand(req));
}
return super.getReorientRelationshipCommand(req);
}
@@ -189,7 +175,7 @@ public class EDataTypeItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPo
protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
switch (getVisualID(req)) {
case EAnnotationReferencesEditPart.VISUAL_ID:
- return getMSLWrapper(new EAnnotationReferencesReorientCommand(req));
+ return getGEFWrapper(new EAnnotationReferencesReorientCommand(req));
}
return super.getReorientReferenceRelationshipCommand(req);
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnum2ItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnum2ItemSemanticEditPolicy.java
index 369ac4b82..490176e9e 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnum2ItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnum2ItemSemanticEditPolicy.java
@@ -11,7 +11,6 @@
*/
package org.eclipse.gmf.ecore.edit.policies;
-import org.eclipse.emf.ecore.EAnnotation;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EObject;
@@ -19,6 +18,7 @@ import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CompoundCommand;
import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.ecore.edit.commands.EAnnotationReferencesCreateCommand;
import org.eclipse.gmf.ecore.edit.commands.EAnnotationReferencesReorientCommand;
import org.eclipse.gmf.ecore.edit.commands.EReference2CreateCommand;
import org.eclipse.gmf.ecore.edit.commands.EReference2ReorientCommand;
@@ -29,12 +29,10 @@ import org.eclipse.gmf.ecore.edit.parts.EReference2EditPart;
import org.eclipse.gmf.ecore.edit.parts.EReferenceEditPart;
import org.eclipse.gmf.ecore.providers.EcoreElementTypes;
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
/**
* @generated
@@ -45,8 +43,8 @@ public class EEnum2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolic
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- CompoundCommand cc = getDestroyEdgesCommand(req.isConfirmationRequired());
- cc.add(getMSLWrapper(new DestroyElementCommand(req)));
+ CompoundCommand cc = getDestroyEdgesCommand();
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
return cc.unwrap();
}
@@ -70,18 +68,7 @@ public class EEnum2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolic
* @generated
*/
protected Command getCreateCompleteIncomingEAnnotationReferences_4001Command(CreateRelationshipRequest req) {
- EObject sourceEObject = req.getSource();
- EObject targetEObject = req.getTarget();
- if (false == sourceEObject instanceof EAnnotation || false == targetEObject instanceof EObject) {
- return UnexecutableCommand.INSTANCE;
- }
- EAnnotation source = (EAnnotation) sourceEObject;
- EObject target = (EObject) targetEObject;
- if (!EcoreBaseItemSemanticEditPolicy.LinkConstraints.canCreateEAnnotationReferences_4001(source, target)) {
- return UnexecutableCommand.INSTANCE;
- }
- SetRequest setReq = new SetRequest(sourceEObject, EcorePackage.eINSTANCE.getEAnnotation_References(), target);
- return getMSLWrapper(new SetValueCommand(setReq));
+ return getGEFWrapper(new EAnnotationReferencesCreateCommand(req));
}
/**
@@ -101,7 +88,7 @@ public class EEnum2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolic
if (req.getContainmentFeature() == null) {
req.setContainmentFeature(EcorePackage.eINSTANCE.getEClass_EStructuralFeatures());
}
- return getMSLWrapper(new EReferenceCreateCommand(req, source, target));
+ return getGEFWrapper(new EReferenceCreateCommand(req, source, target));
}
/**
@@ -121,7 +108,7 @@ public class EEnum2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolic
if (req.getContainmentFeature() == null) {
req.setContainmentFeature(EcorePackage.eINSTANCE.getEClass_EStructuralFeatures());
}
- return getMSLWrapper(new EReference2CreateCommand(req, source, target));
+ return getGEFWrapper(new EReference2CreateCommand(req, source, target));
}
/**
@@ -133,9 +120,9 @@ public class EEnum2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolic
protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
switch (getVisualID(req)) {
case EReferenceEditPart.VISUAL_ID:
- return getMSLWrapper(new EReferenceReorientCommand(req));
+ return getGEFWrapper(new EReferenceReorientCommand(req));
case EReference2EditPart.VISUAL_ID:
- return getMSLWrapper(new EReference2ReorientCommand(req));
+ return getGEFWrapper(new EReference2ReorientCommand(req));
}
return super.getReorientRelationshipCommand(req);
}
@@ -149,7 +136,7 @@ public class EEnum2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolic
protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
switch (getVisualID(req)) {
case EAnnotationReferencesEditPart.VISUAL_ID:
- return getMSLWrapper(new EAnnotationReferencesReorientCommand(req));
+ return getGEFWrapper(new EAnnotationReferencesReorientCommand(req));
}
return super.getReorientReferenceRelationshipCommand(req);
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumEnumAnnotationsCanonicalEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumEnumAnnotationsCanonicalEditPolicy.java
index 6989b2e3d..f1c632111 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumEnumAnnotationsCanonicalEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumEnumAnnotationsCanonicalEditPolicy.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2007 Borland Software Corp.
+ * Copyright (c) 2006, 2007 Borland Software Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -11,18 +11,16 @@
*/
package org.eclipse.gmf.ecore.edit.policies;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
-import org.eclipse.gmf.runtime.notation.View;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
-import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EObject;
-
import org.eclipse.gmf.ecore.edit.parts.EAnnotation2EditPart;
-
import org.eclipse.gmf.ecore.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
/**
* @generated
@@ -34,14 +32,14 @@ public class EEnumEnumAnnotationsCanonicalEditPolicy extends CanonicalEditPolicy
*/
protected List getSemanticChildrenList() {
List result = new LinkedList();
- EObject modelObject = ((View) getHost().getModel()).getElement();
View viewObject = (View) getHost().getModel();
- EObject nextValue;
- int nodeVID;
- for (Iterator values = ((EModelElement) modelObject).getEAnnotations().iterator(); values.hasNext();) {
- nextValue = (EObject) values.next();
- nodeVID = EcoreVisualIDRegistry.getNodeVisualID(viewObject, nextValue);
- if (EAnnotation2EditPart.VISUAL_ID == nodeVID) {
+ EEnum modelObject = (EEnum) viewObject.getElement();
+ List allValues = new LinkedList();
+ allValues.addAll(modelObject.getEAnnotations());
+ for (Iterator valuesIterator = allValues.iterator(); valuesIterator.hasNext();) {
+ EObject nextValue = (EObject) valuesIterator.next();
+ switch (EcoreVisualIDRegistry.getNodeVisualID(viewObject, nextValue)) {
+ case EAnnotation2EditPart.VISUAL_ID:
result.add(nextValue);
}
}
@@ -52,11 +50,7 @@ public class EEnumEnumAnnotationsCanonicalEditPolicy extends CanonicalEditPolicy
* @generated
*/
protected boolean shouldDeleteView(View view) {
- if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
- return view.isSetElement() && (view.getElement() == null || view.getElement().eIsProxy());
- }
- int nodeVID = EcoreVisualIDRegistry.getVisualID(view);
- switch (nodeVID) {
+ switch (EcoreVisualIDRegistry.getVisualID(view)) {
case EAnnotation2EditPart.VISUAL_ID:
return true;
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumEnumAnnotationsItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumEnumAnnotationsItemSemanticEditPolicy.java
index 0b619cc2d..b885153b4 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumEnumAnnotationsItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumEnumAnnotationsItemSemanticEditPolicy.java
@@ -34,7 +34,7 @@ public class EEnumEnumAnnotationsItemSemanticEditPolicy extends EcoreBaseItemSem
if (req.getContainmentFeature() == null) {
req.setContainmentFeature(EcorePackage.eINSTANCE.getEModelElement_EAnnotations());
}
- return getMSLWrapper(new EAnnotation2CreateCommand(req));
+ return getGEFWrapper(new EAnnotation2CreateCommand(req));
}
return super.getCreateCommand(req);
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumItemSemanticEditPolicy.java
index 7423da0cb..fe2842f32 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumItemSemanticEditPolicy.java
@@ -21,6 +21,7 @@ import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CompoundCommand;
import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.ecore.edit.commands.EAnnotationReferencesCreateCommand;
import org.eclipse.gmf.ecore.edit.commands.EAnnotationReferencesReorientCommand;
import org.eclipse.gmf.ecore.edit.commands.EReference2CreateCommand;
import org.eclipse.gmf.ecore.edit.commands.EReference2ReorientCommand;
@@ -36,12 +37,10 @@ import org.eclipse.gmf.ecore.edit.parts.EReferenceEditPart;
import org.eclipse.gmf.ecore.part.EcoreVisualIDRegistry;
import org.eclipse.gmf.ecore.providers.EcoreElementTypes;
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.View;
@@ -54,27 +53,25 @@ public class EEnumItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- CompoundCommand cc = getDestroyEdgesCommand(req.isConfirmationRequired());
- addDestroyChildNodesCommand(cc, req.isConfirmationRequired());
- cc.add(getMSLWrapper(new DestroyElementCommand(req) {
-
- protected EObject getElementToDestroy() {
- View view = (View) getHost().getModel();
- EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
- if (annotation != null) {
- return view;
- }
- return super.getElementToDestroy();
- }
- }));
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ View view = (View) getHost().getModel();
+ if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
+ req.setElementToDestroy(view);
+ }
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
return cc.unwrap();
}
/**
* @generated
*/
- protected void addDestroyChildNodesCommand(CompoundCommand cmd, boolean confirm) {
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
Node node = (Node) it.next();
switch (EcoreVisualIDRegistry.getVisualID(node)) {
@@ -83,7 +80,7 @@ public class EEnumItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy
Node cnode = (Node) cit.next();
switch (EcoreVisualIDRegistry.getVisualID(cnode)) {
case EEnumLiteralEditPart.VISUAL_ID:
- cmd.add(getDestroyElementCommand(cnode, confirm));
+ cmd.add(getDestroyElementCommand(cnode));
break;
}
}
@@ -93,7 +90,7 @@ public class EEnumItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy
Node cnode = (Node) cit.next();
switch (EcoreVisualIDRegistry.getVisualID(cnode)) {
case EAnnotation2EditPart.VISUAL_ID:
- cmd.add(getDestroyElementCommand(cnode, confirm));
+ cmd.add(getDestroyElementCommand(cnode));
break;
}
}
@@ -122,18 +119,7 @@ public class EEnumItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy
* @generated
*/
protected Command getCreateCompleteIncomingEAnnotationReferences_4001Command(CreateRelationshipRequest req) {
- EObject sourceEObject = req.getSource();
- EObject targetEObject = req.getTarget();
- if (false == sourceEObject instanceof EAnnotation || false == targetEObject instanceof EObject) {
- return UnexecutableCommand.INSTANCE;
- }
- EAnnotation source = (EAnnotation) sourceEObject;
- EObject target = (EObject) targetEObject;
- if (!EcoreBaseItemSemanticEditPolicy.LinkConstraints.canCreateEAnnotationReferences_4001(source, target)) {
- return UnexecutableCommand.INSTANCE;
- }
- SetRequest setReq = new SetRequest(sourceEObject, EcorePackage.eINSTANCE.getEAnnotation_References(), target);
- return getMSLWrapper(new SetValueCommand(setReq));
+ return getGEFWrapper(new EAnnotationReferencesCreateCommand(req));
}
/**
@@ -153,7 +139,7 @@ public class EEnumItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy
if (req.getContainmentFeature() == null) {
req.setContainmentFeature(EcorePackage.eINSTANCE.getEClass_EStructuralFeatures());
}
- return getMSLWrapper(new EReferenceCreateCommand(req, source, target));
+ return getGEFWrapper(new EReferenceCreateCommand(req, source, target));
}
/**
@@ -173,7 +159,7 @@ public class EEnumItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy
if (req.getContainmentFeature() == null) {
req.setContainmentFeature(EcorePackage.eINSTANCE.getEClass_EStructuralFeatures());
}
- return getMSLWrapper(new EReference2CreateCommand(req, source, target));
+ return getGEFWrapper(new EReference2CreateCommand(req, source, target));
}
/**
@@ -185,9 +171,9 @@ public class EEnumItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy
protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
switch (getVisualID(req)) {
case EReferenceEditPart.VISUAL_ID:
- return getMSLWrapper(new EReferenceReorientCommand(req));
+ return getGEFWrapper(new EReferenceReorientCommand(req));
case EReference2EditPart.VISUAL_ID:
- return getMSLWrapper(new EReference2ReorientCommand(req));
+ return getGEFWrapper(new EReference2ReorientCommand(req));
}
return super.getReorientRelationshipCommand(req);
}
@@ -201,7 +187,7 @@ public class EEnumItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy
protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
switch (getVisualID(req)) {
case EAnnotationReferencesEditPart.VISUAL_ID:
- return getMSLWrapper(new EAnnotationReferencesReorientCommand(req));
+ return getGEFWrapper(new EAnnotationReferencesReorientCommand(req));
}
return super.getReorientReferenceRelationshipCommand(req);
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumLiteralItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumLiteralItemSemanticEditPolicy.java
index 5c7a0ae12..8f03fcf06 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumLiteralItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumLiteralItemSemanticEditPolicy.java
@@ -11,21 +11,16 @@
*/
package org.eclipse.gmf.ecore.edit.policies;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CompoundCommand;
-import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.ecore.edit.commands.EAnnotationReferencesCreateCommand;
import org.eclipse.gmf.ecore.edit.commands.EAnnotationReferencesReorientCommand;
import org.eclipse.gmf.ecore.edit.parts.EAnnotationReferencesEditPart;
import org.eclipse.gmf.ecore.providers.EcoreElementTypes;
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
/**
* @generated
@@ -36,8 +31,8 @@ public class EEnumLiteralItemSemanticEditPolicy extends EcoreBaseItemSemanticEdi
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- CompoundCommand cc = getDestroyEdgesCommand(req.isConfirmationRequired());
- cc.add(getMSLWrapper(new DestroyElementCommand(req)));
+ CompoundCommand cc = getDestroyEdgesCommand();
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
return cc.unwrap();
}
@@ -55,18 +50,7 @@ public class EEnumLiteralItemSemanticEditPolicy extends EcoreBaseItemSemanticEdi
* @generated
*/
protected Command getCreateCompleteIncomingEAnnotationReferences_4001Command(CreateRelationshipRequest req) {
- EObject sourceEObject = req.getSource();
- EObject targetEObject = req.getTarget();
- if (false == sourceEObject instanceof EAnnotation || false == targetEObject instanceof EObject) {
- return UnexecutableCommand.INSTANCE;
- }
- EAnnotation source = (EAnnotation) sourceEObject;
- EObject target = (EObject) targetEObject;
- if (!EcoreBaseItemSemanticEditPolicy.LinkConstraints.canCreateEAnnotationReferences_4001(source, target)) {
- return UnexecutableCommand.INSTANCE;
- }
- SetRequest setReq = new SetRequest(sourceEObject, EcorePackage.eINSTANCE.getEAnnotation_References(), target);
- return getMSLWrapper(new SetValueCommand(setReq));
+ return getGEFWrapper(new EAnnotationReferencesCreateCommand(req));
}
/**
@@ -78,7 +62,7 @@ public class EEnumLiteralItemSemanticEditPolicy extends EcoreBaseItemSemanticEdi
protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
switch (getVisualID(req)) {
case EAnnotationReferencesEditPart.VISUAL_ID:
- return getMSLWrapper(new EAnnotationReferencesReorientCommand(req));
+ return getGEFWrapper(new EAnnotationReferencesReorientCommand(req));
}
return super.getReorientReferenceRelationshipCommand(req);
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumLiteralsCanonicalEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumLiteralsCanonicalEditPolicy.java
index 62201b41e..e0e1e6565 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumLiteralsCanonicalEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumLiteralsCanonicalEditPolicy.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2007 Borland Software Corp.
+ * Copyright (c) 2006, 2007 Borland Software Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -11,18 +11,16 @@
*/
package org.eclipse.gmf.ecore.edit.policies;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
-import org.eclipse.gmf.runtime.notation.View;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EObject;
-
import org.eclipse.gmf.ecore.edit.parts.EEnumLiteralEditPart;
-
import org.eclipse.gmf.ecore.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
/**
* @generated
@@ -34,14 +32,14 @@ public class EEnumLiteralsCanonicalEditPolicy extends CanonicalEditPolicy {
*/
protected List getSemanticChildrenList() {
List result = new LinkedList();
- EObject modelObject = ((View) getHost().getModel()).getElement();
View viewObject = (View) getHost().getModel();
- EObject nextValue;
- int nodeVID;
- for (Iterator values = ((EEnum) modelObject).getELiterals().iterator(); values.hasNext();) {
- nextValue = (EObject) values.next();
- nodeVID = EcoreVisualIDRegistry.getNodeVisualID(viewObject, nextValue);
- if (EEnumLiteralEditPart.VISUAL_ID == nodeVID) {
+ EEnum modelObject = (EEnum) viewObject.getElement();
+ List allValues = new LinkedList();
+ allValues.addAll(modelObject.getELiterals());
+ for (Iterator valuesIterator = allValues.iterator(); valuesIterator.hasNext();) {
+ EObject nextValue = (EObject) valuesIterator.next();
+ switch (EcoreVisualIDRegistry.getNodeVisualID(viewObject, nextValue)) {
+ case EEnumLiteralEditPart.VISUAL_ID:
result.add(nextValue);
}
}
@@ -52,11 +50,7 @@ public class EEnumLiteralsCanonicalEditPolicy extends CanonicalEditPolicy {
* @generated
*/
protected boolean shouldDeleteView(View view) {
- if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
- return view.isSetElement() && (view.getElement() == null || view.getElement().eIsProxy());
- }
- int nodeVID = EcoreVisualIDRegistry.getVisualID(view);
- switch (nodeVID) {
+ switch (EcoreVisualIDRegistry.getVisualID(view)) {
case EEnumLiteralEditPart.VISUAL_ID:
return true;
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumLiteralsItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumLiteralsItemSemanticEditPolicy.java
index 14188526a..c7d05c977 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumLiteralsItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EEnumLiteralsItemSemanticEditPolicy.java
@@ -34,7 +34,7 @@ public class EEnumLiteralsItemSemanticEditPolicy extends EcoreBaseItemSemanticEd
if (req.getContainmentFeature() == null) {
req.setContainmentFeature(EcorePackage.eINSTANCE.getEEnum_ELiterals());
}
- return getMSLWrapper(new EEnumLiteralCreateCommand(req));
+ return getGEFWrapper(new EEnumLiteralCreateCommand(req));
}
return super.getCreateCommand(req);
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EOperationItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EOperationItemSemanticEditPolicy.java
index 9caed8b32..640ee3dc7 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EOperationItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EOperationItemSemanticEditPolicy.java
@@ -11,21 +11,16 @@
*/
package org.eclipse.gmf.ecore.edit.policies;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CompoundCommand;
-import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.ecore.edit.commands.EAnnotationReferencesCreateCommand;
import org.eclipse.gmf.ecore.edit.commands.EAnnotationReferencesReorientCommand;
import org.eclipse.gmf.ecore.edit.parts.EAnnotationReferencesEditPart;
import org.eclipse.gmf.ecore.providers.EcoreElementTypes;
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
/**
* @generated
@@ -36,8 +31,8 @@ public class EOperationItemSemanticEditPolicy extends EcoreBaseItemSemanticEditP
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- CompoundCommand cc = getDestroyEdgesCommand(req.isConfirmationRequired());
- cc.add(getMSLWrapper(new DestroyElementCommand(req)));
+ CompoundCommand cc = getDestroyEdgesCommand();
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
return cc.unwrap();
}
@@ -55,18 +50,7 @@ public class EOperationItemSemanticEditPolicy extends EcoreBaseItemSemanticEditP
* @generated
*/
protected Command getCreateCompleteIncomingEAnnotationReferences_4001Command(CreateRelationshipRequest req) {
- EObject sourceEObject = req.getSource();
- EObject targetEObject = req.getTarget();
- if (false == sourceEObject instanceof EAnnotation || false == targetEObject instanceof EObject) {
- return UnexecutableCommand.INSTANCE;
- }
- EAnnotation source = (EAnnotation) sourceEObject;
- EObject target = (EObject) targetEObject;
- if (!EcoreBaseItemSemanticEditPolicy.LinkConstraints.canCreateEAnnotationReferences_4001(source, target)) {
- return UnexecutableCommand.INSTANCE;
- }
- SetRequest setReq = new SetRequest(sourceEObject, EcorePackage.eINSTANCE.getEAnnotation_References(), target);
- return getMSLWrapper(new SetValueCommand(setReq));
+ return getGEFWrapper(new EAnnotationReferencesCreateCommand(req));
}
/**
@@ -78,7 +62,7 @@ public class EOperationItemSemanticEditPolicy extends EcoreBaseItemSemanticEditP
protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
switch (getVisualID(req)) {
case EAnnotationReferencesEditPart.VISUAL_ID:
- return getMSLWrapper(new EAnnotationReferencesReorientCommand(req));
+ return getGEFWrapper(new EAnnotationReferencesReorientCommand(req));
}
return super.getReorientReferenceRelationshipCommand(req);
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackage2ItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackage2ItemSemanticEditPolicy.java
index 3e4126255..173f2c0c0 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackage2ItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackage2ItemSemanticEditPolicy.java
@@ -14,11 +14,9 @@ package org.eclipse.gmf.ecore.edit.policies;
import java.util.Iterator;
import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CompoundCommand;
-import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.ecore.edit.commands.EAnnotationReferencesCreateCommand;
import org.eclipse.gmf.ecore.edit.commands.EAnnotationReferencesReorientCommand;
import org.eclipse.gmf.ecore.edit.parts.EAnnotation2EditPart;
import org.eclipse.gmf.ecore.edit.parts.EAnnotationReferencesEditPart;
@@ -34,11 +32,9 @@ import org.eclipse.gmf.ecore.edit.parts.EPackagePackagesEditPart;
import org.eclipse.gmf.ecore.part.EcoreVisualIDRegistry;
import org.eclipse.gmf.ecore.providers.EcoreElementTypes;
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.View;
@@ -51,27 +47,25 @@ public class EPackage2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPo
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- CompoundCommand cc = getDestroyEdgesCommand(req.isConfirmationRequired());
- addDestroyChildNodesCommand(cc, req.isConfirmationRequired());
- cc.add(getMSLWrapper(new DestroyElementCommand(req) {
-
- protected EObject getElementToDestroy() {
- View view = (View) getHost().getModel();
- EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
- if (annotation != null) {
- return view;
- }
- return super.getElementToDestroy();
- }
- }));
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ View view = (View) getHost().getModel();
+ if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
+ req.setElementToDestroy(view);
+ }
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
return cc.unwrap();
}
/**
* @generated
*/
- protected void addDestroyChildNodesCommand(CompoundCommand cmd, boolean confirm) {
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
Node node = (Node) it.next();
switch (EcoreVisualIDRegistry.getVisualID(node)) {
@@ -80,7 +74,7 @@ public class EPackage2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPo
Node cnode = (Node) cit.next();
switch (EcoreVisualIDRegistry.getVisualID(cnode)) {
case EClass2EditPart.VISUAL_ID:
- cmd.add(getDestroyElementCommand(cnode, confirm));
+ cmd.add(getDestroyElementCommand(cnode));
break;
}
}
@@ -90,7 +84,7 @@ public class EPackage2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPo
Node cnode = (Node) cit.next();
switch (EcoreVisualIDRegistry.getVisualID(cnode)) {
case EPackage3EditPart.VISUAL_ID:
- cmd.add(getDestroyElementCommand(cnode, confirm));
+ cmd.add(getDestroyElementCommand(cnode));
break;
}
}
@@ -100,7 +94,7 @@ public class EPackage2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPo
Node cnode = (Node) cit.next();
switch (EcoreVisualIDRegistry.getVisualID(cnode)) {
case EDataType2EditPart.VISUAL_ID:
- cmd.add(getDestroyElementCommand(cnode, confirm));
+ cmd.add(getDestroyElementCommand(cnode));
break;
}
}
@@ -110,7 +104,7 @@ public class EPackage2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPo
Node cnode = (Node) cit.next();
switch (EcoreVisualIDRegistry.getVisualID(cnode)) {
case EEnum2EditPart.VISUAL_ID:
- cmd.add(getDestroyElementCommand(cnode, confirm));
+ cmd.add(getDestroyElementCommand(cnode));
break;
}
}
@@ -120,7 +114,7 @@ public class EPackage2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPo
Node cnode = (Node) cit.next();
switch (EcoreVisualIDRegistry.getVisualID(cnode)) {
case EAnnotation2EditPart.VISUAL_ID:
- cmd.add(getDestroyElementCommand(cnode, confirm));
+ cmd.add(getDestroyElementCommand(cnode));
break;
}
}
@@ -143,18 +137,7 @@ public class EPackage2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPo
* @generated
*/
protected Command getCreateCompleteIncomingEAnnotationReferences_4001Command(CreateRelationshipRequest req) {
- EObject sourceEObject = req.getSource();
- EObject targetEObject = req.getTarget();
- if (false == sourceEObject instanceof EAnnotation || false == targetEObject instanceof EObject) {
- return UnexecutableCommand.INSTANCE;
- }
- EAnnotation source = (EAnnotation) sourceEObject;
- EObject target = (EObject) targetEObject;
- if (!EcoreBaseItemSemanticEditPolicy.LinkConstraints.canCreateEAnnotationReferences_4001(source, target)) {
- return UnexecutableCommand.INSTANCE;
- }
- SetRequest setReq = new SetRequest(sourceEObject, EcorePackage.eINSTANCE.getEAnnotation_References(), target);
- return getMSLWrapper(new SetValueCommand(setReq));
+ return getGEFWrapper(new EAnnotationReferencesCreateCommand(req));
}
/**
@@ -166,7 +149,7 @@ public class EPackage2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPo
protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
switch (getVisualID(req)) {
case EAnnotationReferencesEditPart.VISUAL_ID:
- return getMSLWrapper(new EAnnotationReferencesReorientCommand(req));
+ return getGEFWrapper(new EAnnotationReferencesReorientCommand(req));
}
return super.getReorientReferenceRelationshipCommand(req);
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackage3ItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackage3ItemSemanticEditPolicy.java
index 59417abe2..dcec2db13 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackage3ItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackage3ItemSemanticEditPolicy.java
@@ -11,21 +11,16 @@
*/
package org.eclipse.gmf.ecore.edit.policies;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CompoundCommand;
-import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.ecore.edit.commands.EAnnotationReferencesCreateCommand;
import org.eclipse.gmf.ecore.edit.commands.EAnnotationReferencesReorientCommand;
import org.eclipse.gmf.ecore.edit.parts.EAnnotationReferencesEditPart;
import org.eclipse.gmf.ecore.providers.EcoreElementTypes;
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
/**
* @generated
@@ -36,8 +31,8 @@ public class EPackage3ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPo
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- CompoundCommand cc = getDestroyEdgesCommand(req.isConfirmationRequired());
- cc.add(getMSLWrapper(new DestroyElementCommand(req)));
+ CompoundCommand cc = getDestroyEdgesCommand();
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
return cc.unwrap();
}
@@ -55,18 +50,7 @@ public class EPackage3ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPo
* @generated
*/
protected Command getCreateCompleteIncomingEAnnotationReferences_4001Command(CreateRelationshipRequest req) {
- EObject sourceEObject = req.getSource();
- EObject targetEObject = req.getTarget();
- if (false == sourceEObject instanceof EAnnotation || false == targetEObject instanceof EObject) {
- return UnexecutableCommand.INSTANCE;
- }
- EAnnotation source = (EAnnotation) sourceEObject;
- EObject target = (EObject) targetEObject;
- if (!EcoreBaseItemSemanticEditPolicy.LinkConstraints.canCreateEAnnotationReferences_4001(source, target)) {
- return UnexecutableCommand.INSTANCE;
- }
- SetRequest setReq = new SetRequest(sourceEObject, EcorePackage.eINSTANCE.getEAnnotation_References(), target);
- return getMSLWrapper(new SetValueCommand(setReq));
+ return getGEFWrapper(new EAnnotationReferencesCreateCommand(req));
}
/**
@@ -78,7 +62,7 @@ public class EPackage3ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPo
protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
switch (getVisualID(req)) {
case EAnnotationReferencesEditPart.VISUAL_ID:
- return getMSLWrapper(new EAnnotationReferencesReorientCommand(req));
+ return getGEFWrapper(new EAnnotationReferencesReorientCommand(req));
}
return super.getReorientReferenceRelationshipCommand(req);
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageClassesCanonicalEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageClassesCanonicalEditPolicy.java
index 56e6a377e..f4c8bb566 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageClassesCanonicalEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageClassesCanonicalEditPolicy.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2007 Borland Software Corp.
+ * Copyright (c) 2006, 2007 Borland Software Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -11,18 +11,16 @@
*/
package org.eclipse.gmf.ecore.edit.policies;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
-import org.eclipse.gmf.runtime.notation.View;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
-
import org.eclipse.gmf.ecore.edit.parts.EClass2EditPart;
-
import org.eclipse.gmf.ecore.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
/**
* @generated
@@ -34,14 +32,14 @@ public class EPackageClassesCanonicalEditPolicy extends CanonicalEditPolicy {
*/
protected List getSemanticChildrenList() {
List result = new LinkedList();
- EObject modelObject = ((View) getHost().getModel()).getElement();
View viewObject = (View) getHost().getModel();
- EObject nextValue;
- int nodeVID;
- for (Iterator values = ((EPackage) modelObject).getEClassifiers().iterator(); values.hasNext();) {
- nextValue = (EObject) values.next();
- nodeVID = EcoreVisualIDRegistry.getNodeVisualID(viewObject, nextValue);
- if (EClass2EditPart.VISUAL_ID == nodeVID) {
+ EPackage modelObject = (EPackage) viewObject.getElement();
+ List allValues = new LinkedList();
+ allValues.addAll(modelObject.getEClassifiers());
+ for (Iterator valuesIterator = allValues.iterator(); valuesIterator.hasNext();) {
+ EObject nextValue = (EObject) valuesIterator.next();
+ switch (EcoreVisualIDRegistry.getNodeVisualID(viewObject, nextValue)) {
+ case EClass2EditPart.VISUAL_ID:
result.add(nextValue);
}
}
@@ -52,11 +50,7 @@ public class EPackageClassesCanonicalEditPolicy extends CanonicalEditPolicy {
* @generated
*/
protected boolean shouldDeleteView(View view) {
- if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
- return view.isSetElement() && (view.getElement() == null || view.getElement().eIsProxy());
- }
- int nodeVID = EcoreVisualIDRegistry.getVisualID(view);
- switch (nodeVID) {
+ switch (EcoreVisualIDRegistry.getVisualID(view)) {
case EClass2EditPart.VISUAL_ID:
return true;
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageClassesItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageClassesItemSemanticEditPolicy.java
index 3465ff1f0..a1d705039 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageClassesItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageClassesItemSemanticEditPolicy.java
@@ -34,7 +34,7 @@ public class EPackageClassesItemSemanticEditPolicy extends EcoreBaseItemSemantic
if (req.getContainmentFeature() == null) {
req.setContainmentFeature(EcorePackage.eINSTANCE.getEPackage_EClassifiers());
}
- return getMSLWrapper(new EClass2CreateCommand(req));
+ return getGEFWrapper(new EClass2CreateCommand(req));
}
return super.getCreateCommand(req);
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageDataTypesCanonicalEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageDataTypesCanonicalEditPolicy.java
index a43390d9e..ad012bf96 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageDataTypesCanonicalEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageDataTypesCanonicalEditPolicy.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2007 Borland Software Corp.
+ * Copyright (c) 2006, 2007 Borland Software Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -11,18 +11,16 @@
*/
package org.eclipse.gmf.ecore.edit.policies;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
-import org.eclipse.gmf.runtime.notation.View;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
-
import org.eclipse.gmf.ecore.edit.parts.EDataType2EditPart;
-
import org.eclipse.gmf.ecore.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
/**
* @generated
@@ -34,14 +32,14 @@ public class EPackageDataTypesCanonicalEditPolicy extends CanonicalEditPolicy {
*/
protected List getSemanticChildrenList() {
List result = new LinkedList();
- EObject modelObject = ((View) getHost().getModel()).getElement();
View viewObject = (View) getHost().getModel();
- EObject nextValue;
- int nodeVID;
- for (Iterator values = ((EPackage) modelObject).getEClassifiers().iterator(); values.hasNext();) {
- nextValue = (EObject) values.next();
- nodeVID = EcoreVisualIDRegistry.getNodeVisualID(viewObject, nextValue);
- if (EDataType2EditPart.VISUAL_ID == nodeVID) {
+ EPackage modelObject = (EPackage) viewObject.getElement();
+ List allValues = new LinkedList();
+ allValues.addAll(modelObject.getEClassifiers());
+ for (Iterator valuesIterator = allValues.iterator(); valuesIterator.hasNext();) {
+ EObject nextValue = (EObject) valuesIterator.next();
+ switch (EcoreVisualIDRegistry.getNodeVisualID(viewObject, nextValue)) {
+ case EDataType2EditPart.VISUAL_ID:
result.add(nextValue);
}
}
@@ -52,11 +50,7 @@ public class EPackageDataTypesCanonicalEditPolicy extends CanonicalEditPolicy {
* @generated
*/
protected boolean shouldDeleteView(View view) {
- if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
- return view.isSetElement() && (view.getElement() == null || view.getElement().eIsProxy());
- }
- int nodeVID = EcoreVisualIDRegistry.getVisualID(view);
- switch (nodeVID) {
+ switch (EcoreVisualIDRegistry.getVisualID(view)) {
case EDataType2EditPart.VISUAL_ID:
return true;
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageDataTypesItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageDataTypesItemSemanticEditPolicy.java
index 2522c07ab..2e7c1d170 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageDataTypesItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageDataTypesItemSemanticEditPolicy.java
@@ -34,7 +34,7 @@ public class EPackageDataTypesItemSemanticEditPolicy extends EcoreBaseItemSemant
if (req.getContainmentFeature() == null) {
req.setContainmentFeature(EcorePackage.eINSTANCE.getEPackage_EClassifiers());
}
- return getMSLWrapper(new EDataType2CreateCommand(req));
+ return getGEFWrapper(new EDataType2CreateCommand(req));
}
return super.getCreateCommand(req);
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageEnumsCanonicalEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageEnumsCanonicalEditPolicy.java
index 1fac77be3..ae87b41dd 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageEnumsCanonicalEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageEnumsCanonicalEditPolicy.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2007 Borland Software Corp.
+ * Copyright (c) 2006, 2007 Borland Software Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -11,18 +11,16 @@
*/
package org.eclipse.gmf.ecore.edit.policies;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
-import org.eclipse.gmf.runtime.notation.View;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
-
import org.eclipse.gmf.ecore.edit.parts.EEnum2EditPart;
-
import org.eclipse.gmf.ecore.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
/**
* @generated
@@ -34,14 +32,14 @@ public class EPackageEnumsCanonicalEditPolicy extends CanonicalEditPolicy {
*/
protected List getSemanticChildrenList() {
List result = new LinkedList();
- EObject modelObject = ((View) getHost().getModel()).getElement();
View viewObject = (View) getHost().getModel();
- EObject nextValue;
- int nodeVID;
- for (Iterator values = ((EPackage) modelObject).getEClassifiers().iterator(); values.hasNext();) {
- nextValue = (EObject) values.next();
- nodeVID = EcoreVisualIDRegistry.getNodeVisualID(viewObject, nextValue);
- if (EEnum2EditPart.VISUAL_ID == nodeVID) {
+ EPackage modelObject = (EPackage) viewObject.getElement();
+ List allValues = new LinkedList();
+ allValues.addAll(modelObject.getEClassifiers());
+ for (Iterator valuesIterator = allValues.iterator(); valuesIterator.hasNext();) {
+ EObject nextValue = (EObject) valuesIterator.next();
+ switch (EcoreVisualIDRegistry.getNodeVisualID(viewObject, nextValue)) {
+ case EEnum2EditPart.VISUAL_ID:
result.add(nextValue);
}
}
@@ -52,11 +50,7 @@ public class EPackageEnumsCanonicalEditPolicy extends CanonicalEditPolicy {
* @generated
*/
protected boolean shouldDeleteView(View view) {
- if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
- return view.isSetElement() && (view.getElement() == null || view.getElement().eIsProxy());
- }
- int nodeVID = EcoreVisualIDRegistry.getVisualID(view);
- switch (nodeVID) {
+ switch (EcoreVisualIDRegistry.getVisualID(view)) {
case EEnum2EditPart.VISUAL_ID:
return true;
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageEnumsItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageEnumsItemSemanticEditPolicy.java
index e3c0a7ede..40de01a6b 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageEnumsItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageEnumsItemSemanticEditPolicy.java
@@ -34,7 +34,7 @@ public class EPackageEnumsItemSemanticEditPolicy extends EcoreBaseItemSemanticEd
if (req.getContainmentFeature() == null) {
req.setContainmentFeature(EcorePackage.eINSTANCE.getEPackage_EClassifiers());
}
- return getMSLWrapper(new EEnum2CreateCommand(req));
+ return getGEFWrapper(new EEnum2CreateCommand(req));
}
return super.getCreateCommand(req);
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageItemSemanticEditPolicy.java
index a1e75eb54..10b0a8f9c 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackageItemSemanticEditPolicy.java
@@ -41,31 +41,31 @@ public class EPackageItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPol
if (req.getContainmentFeature() == null) {
req.setContainmentFeature(EcorePackage.eINSTANCE.getEPackage_EClassifiers());
}
- return getMSLWrapper(new EClassCreateCommand(req));
+ return getGEFWrapper(new EClassCreateCommand(req));
}
if (EcoreElementTypes.EPackage_2002 == req.getElementType()) {
if (req.getContainmentFeature() == null) {
req.setContainmentFeature(EcorePackage.eINSTANCE.getEPackage_ESubpackages());
}
- return getMSLWrapper(new EPackageCreateCommand(req));
+ return getGEFWrapper(new EPackageCreateCommand(req));
}
if (EcoreElementTypes.EAnnotation_2003 == req.getElementType()) {
if (req.getContainmentFeature() == null) {
req.setContainmentFeature(EcorePackage.eINSTANCE.getEModelElement_EAnnotations());
}
- return getMSLWrapper(new EAnnotationCreateCommand(req));
+ return getGEFWrapper(new EAnnotationCreateCommand(req));
}
if (EcoreElementTypes.EDataType_2004 == req.getElementType()) {
if (req.getContainmentFeature() == null) {
req.setContainmentFeature(EcorePackage.eINSTANCE.getEPackage_EClassifiers());
}
- return getMSLWrapper(new EDataTypeCreateCommand(req));
+ return getGEFWrapper(new EDataTypeCreateCommand(req));
}
if (EcoreElementTypes.EEnum_2005 == req.getElementType()) {
if (req.getContainmentFeature() == null) {
req.setContainmentFeature(EcorePackage.eINSTANCE.getEPackage_EClassifiers());
}
- return getMSLWrapper(new EEnumCreateCommand(req));
+ return getGEFWrapper(new EEnumCreateCommand(req));
}
return super.getCreateCommand(req);
}
@@ -75,7 +75,7 @@ public class EPackageItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPol
*/
protected Command getDuplicateCommand(DuplicateElementsRequest req) {
TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
- return getMSLWrapper(new DuplicateAnythingCommand(editingDomain, req));
+ return getGEFWrapper(new DuplicateAnythingCommand(editingDomain, req));
}
/**
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackagePackageAnnotationsCanonicalEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackagePackageAnnotationsCanonicalEditPolicy.java
index 19f229c96..2eda72016 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackagePackageAnnotationsCanonicalEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackagePackageAnnotationsCanonicalEditPolicy.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2007 Borland Software Corp.
+ * Copyright (c) 2006, 2007 Borland Software Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -11,18 +11,16 @@
*/
package org.eclipse.gmf.ecore.edit.policies;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
-import org.eclipse.gmf.runtime.notation.View;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
-import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.ecore.EObject;
-
+import org.eclipse.emf.ecore.EPackage;
import org.eclipse.gmf.ecore.edit.parts.EAnnotation2EditPart;
-
import org.eclipse.gmf.ecore.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
/**
* @generated
@@ -34,14 +32,14 @@ public class EPackagePackageAnnotationsCanonicalEditPolicy extends CanonicalEdit
*/
protected List getSemanticChildrenList() {
List result = new LinkedList();
- EObject modelObject = ((View) getHost().getModel()).getElement();
View viewObject = (View) getHost().getModel();
- EObject nextValue;
- int nodeVID;
- for (Iterator values = ((EModelElement) modelObject).getEAnnotations().iterator(); values.hasNext();) {
- nextValue = (EObject) values.next();
- nodeVID = EcoreVisualIDRegistry.getNodeVisualID(viewObject, nextValue);
- if (EAnnotation2EditPart.VISUAL_ID == nodeVID) {
+ EPackage modelObject = (EPackage) viewObject.getElement();
+ List allValues = new LinkedList();
+ allValues.addAll(modelObject.getEAnnotations());
+ for (Iterator valuesIterator = allValues.iterator(); valuesIterator.hasNext();) {
+ EObject nextValue = (EObject) valuesIterator.next();
+ switch (EcoreVisualIDRegistry.getNodeVisualID(viewObject, nextValue)) {
+ case EAnnotation2EditPart.VISUAL_ID:
result.add(nextValue);
}
}
@@ -52,11 +50,7 @@ public class EPackagePackageAnnotationsCanonicalEditPolicy extends CanonicalEdit
* @generated
*/
protected boolean shouldDeleteView(View view) {
- if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
- return view.isSetElement() && (view.getElement() == null || view.getElement().eIsProxy());
- }
- int nodeVID = EcoreVisualIDRegistry.getVisualID(view);
- switch (nodeVID) {
+ switch (EcoreVisualIDRegistry.getVisualID(view)) {
case EAnnotation2EditPart.VISUAL_ID:
return true;
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackagePackageAnnotationsItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackagePackageAnnotationsItemSemanticEditPolicy.java
index 7be3c71bb..4568f82ac 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackagePackageAnnotationsItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackagePackageAnnotationsItemSemanticEditPolicy.java
@@ -34,7 +34,7 @@ public class EPackagePackageAnnotationsItemSemanticEditPolicy extends EcoreBaseI
if (req.getContainmentFeature() == null) {
req.setContainmentFeature(EcorePackage.eINSTANCE.getEModelElement_EAnnotations());
}
- return getMSLWrapper(new EAnnotation2CreateCommand(req));
+ return getGEFWrapper(new EAnnotation2CreateCommand(req));
}
return super.getCreateCommand(req);
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackagePackagesCanonicalEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackagePackagesCanonicalEditPolicy.java
index 7a4dc193a..d44722959 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackagePackagesCanonicalEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackagePackagesCanonicalEditPolicy.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2007 Borland Software Corp.
+ * Copyright (c) 2006, 2007 Borland Software Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -11,18 +11,16 @@
*/
package org.eclipse.gmf.ecore.edit.policies;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
-import org.eclipse.gmf.runtime.notation.View;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
-
import org.eclipse.gmf.ecore.edit.parts.EPackage3EditPart;
-
import org.eclipse.gmf.ecore.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
/**
* @generated
@@ -34,14 +32,14 @@ public class EPackagePackagesCanonicalEditPolicy extends CanonicalEditPolicy {
*/
protected List getSemanticChildrenList() {
List result = new LinkedList();
- EObject modelObject = ((View) getHost().getModel()).getElement();
View viewObject = (View) getHost().getModel();
- EObject nextValue;
- int nodeVID;
- for (Iterator values = ((EPackage) modelObject).getESubpackages().iterator(); values.hasNext();) {
- nextValue = (EObject) values.next();
- nodeVID = EcoreVisualIDRegistry.getNodeVisualID(viewObject, nextValue);
- if (EPackage3EditPart.VISUAL_ID == nodeVID) {
+ EPackage modelObject = (EPackage) viewObject.getElement();
+ List allValues = new LinkedList();
+ allValues.addAll(modelObject.getESubpackages());
+ for (Iterator valuesIterator = allValues.iterator(); valuesIterator.hasNext();) {
+ EObject nextValue = (EObject) valuesIterator.next();
+ switch (EcoreVisualIDRegistry.getNodeVisualID(viewObject, nextValue)) {
+ case EPackage3EditPart.VISUAL_ID:
result.add(nextValue);
}
}
@@ -52,11 +50,7 @@ public class EPackagePackagesCanonicalEditPolicy extends CanonicalEditPolicy {
* @generated
*/
protected boolean shouldDeleteView(View view) {
- if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
- return view.isSetElement() && (view.getElement() == null || view.getElement().eIsProxy());
- }
- int nodeVID = EcoreVisualIDRegistry.getVisualID(view);
- switch (nodeVID) {
+ switch (EcoreVisualIDRegistry.getVisualID(view)) {
case EPackage3EditPart.VISUAL_ID:
return true;
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackagePackagesItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackagePackagesItemSemanticEditPolicy.java
index 70fe8ea8a..4d1776898 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackagePackagesItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EPackagePackagesItemSemanticEditPolicy.java
@@ -34,7 +34,7 @@ public class EPackagePackagesItemSemanticEditPolicy extends EcoreBaseItemSemanti
if (req.getContainmentFeature() == null) {
req.setContainmentFeature(EcorePackage.eINSTANCE.getEPackage_ESubpackages());
}
- return getMSLWrapper(new EPackage2CreateCommand(req));
+ return getGEFWrapper(new EPackage2CreateCommand(req));
}
return super.getCreateCommand(req);
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EReference2ItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EReference2ItemSemanticEditPolicy.java
index cb07cf696..09bdfe39b 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EReference2ItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EReference2ItemSemanticEditPolicy.java
@@ -11,20 +11,15 @@
*/
package org.eclipse.gmf.ecore.edit.policies;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.ecore.edit.commands.EAnnotationReferencesCreateCommand;
import org.eclipse.gmf.ecore.edit.commands.EAnnotationReferencesReorientCommand;
import org.eclipse.gmf.ecore.edit.parts.EAnnotationReferencesEditPart;
import org.eclipse.gmf.ecore.providers.EcoreElementTypes;
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
/**
* @generated
@@ -35,7 +30,7 @@ public class EReference2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEdit
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- return getMSLWrapper(new DestroyElementCommand(req));
+ return getGEFWrapper(new DestroyElementCommand(req));
}
/**
@@ -52,18 +47,7 @@ public class EReference2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEdit
* @generated
*/
protected Command getCreateCompleteIncomingEAnnotationReferences_4001Command(CreateRelationshipRequest req) {
- EObject sourceEObject = req.getSource();
- EObject targetEObject = req.getTarget();
- if (false == sourceEObject instanceof EAnnotation || false == targetEObject instanceof EObject) {
- return UnexecutableCommand.INSTANCE;
- }
- EAnnotation source = (EAnnotation) sourceEObject;
- EObject target = (EObject) targetEObject;
- if (!EcoreBaseItemSemanticEditPolicy.LinkConstraints.canCreateEAnnotationReferences_4001(source, target)) {
- return UnexecutableCommand.INSTANCE;
- }
- SetRequest setReq = new SetRequest(sourceEObject, EcorePackage.eINSTANCE.getEAnnotation_References(), target);
- return getMSLWrapper(new SetValueCommand(setReq));
+ return getGEFWrapper(new EAnnotationReferencesCreateCommand(req));
}
/**
@@ -75,7 +59,7 @@ public class EReference2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEdit
protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
switch (getVisualID(req)) {
case EAnnotationReferencesEditPart.VISUAL_ID:
- return getMSLWrapper(new EAnnotationReferencesReorientCommand(req));
+ return getGEFWrapper(new EAnnotationReferencesReorientCommand(req));
}
return super.getReorientReferenceRelationshipCommand(req);
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EReferenceItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EReferenceItemSemanticEditPolicy.java
index 184d19cb2..1f8605d3c 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EReferenceItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EReferenceItemSemanticEditPolicy.java
@@ -11,20 +11,15 @@
*/
package org.eclipse.gmf.ecore.edit.policies;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.ecore.edit.commands.EAnnotationReferencesCreateCommand;
import org.eclipse.gmf.ecore.edit.commands.EAnnotationReferencesReorientCommand;
import org.eclipse.gmf.ecore.edit.parts.EAnnotationReferencesEditPart;
import org.eclipse.gmf.ecore.providers.EcoreElementTypes;
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
/**
* @generated
@@ -35,7 +30,7 @@ public class EReferenceItemSemanticEditPolicy extends EcoreBaseItemSemanticEditP
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- return getMSLWrapper(new DestroyElementCommand(req));
+ return getGEFWrapper(new DestroyElementCommand(req));
}
/**
@@ -52,18 +47,7 @@ public class EReferenceItemSemanticEditPolicy extends EcoreBaseItemSemanticEditP
* @generated
*/
protected Command getCreateCompleteIncomingEAnnotationReferences_4001Command(CreateRelationshipRequest req) {
- EObject sourceEObject = req.getSource();
- EObject targetEObject = req.getTarget();
- if (false == sourceEObject instanceof EAnnotation || false == targetEObject instanceof EObject) {
- return UnexecutableCommand.INSTANCE;
- }
- EAnnotation source = (EAnnotation) sourceEObject;
- EObject target = (EObject) targetEObject;
- if (!EcoreBaseItemSemanticEditPolicy.LinkConstraints.canCreateEAnnotationReferences_4001(source, target)) {
- return UnexecutableCommand.INSTANCE;
- }
- SetRequest setReq = new SetRequest(sourceEObject, EcorePackage.eINSTANCE.getEAnnotation_References(), target);
- return getMSLWrapper(new SetValueCommand(setReq));
+ return getGEFWrapper(new EAnnotationReferencesCreateCommand(req));
}
/**
@@ -75,7 +59,7 @@ public class EReferenceItemSemanticEditPolicy extends EcoreBaseItemSemanticEditP
protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
switch (getVisualID(req)) {
case EAnnotationReferencesEditPart.VISUAL_ID:
- return getMSLWrapper(new EAnnotationReferencesReorientCommand(req));
+ return getGEFWrapper(new EAnnotationReferencesReorientCommand(req));
}
return super.getReorientReferenceRelationshipCommand(req);
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EStringToStringMapEntryItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EStringToStringMapEntryItemSemanticEditPolicy.java
index b3f023659..7d7d33b73 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EStringToStringMapEntryItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EStringToStringMapEntryItemSemanticEditPolicy.java
@@ -25,8 +25,8 @@ public class EStringToStringMapEntryItemSemanticEditPolicy extends EcoreBaseItem
* @generated
*/
protected Command getDestroyElementCommand(DestroyElementRequest req) {
- CompoundCommand cc = getDestroyEdgesCommand(req.isConfirmationRequired());
- cc.add(getMSLWrapper(new DestroyElementCommand(req)));
+ CompoundCommand cc = getDestroyEdgesCommand();
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
return cc.unwrap();
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EcoreBaseItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EcoreBaseItemSemanticEditPolicy.java
index 3b9a39383..b93509ed0 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EcoreBaseItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/edit/policies/EcoreBaseItemSemanticEditPolicy.java
@@ -75,6 +75,7 @@ public class EcoreBaseItemSemanticEditPolicy extends SemanticEditPolicy {
public static final String VISUAL_ID_KEY = "visual_id"; //$NON-NLS-1$
/**
+ * Extended request data key to hold editpart visual id.
* Add visual id of edited editpart to extended data of the request
* so command switch can decide what kind of diagram element is being edited.
* It is done in those cases when it's not possible to deduce diagram
@@ -261,11 +262,20 @@ public class EcoreBaseItemSemanticEditPolicy extends SemanticEditPolicy {
/**
* @generated
*/
- protected Command getMSLWrapper(ICommand cmd) {
+ protected final Command getGEFWrapper(ICommand cmd) {
return new ICommandProxy(cmd);
}
/**
+ * @deprecated use getGEFWrapper() instead
+ * @generated
+ */
+ protected final Command getMSLWrapper(ICommand cmd) {
+ // XXX deprecated: use getGEFWrapper() instead
+ return getGEFWrapper(cmd);
+ }
+
+ /**
* @generated
*/
protected EObject getSemanticElement() {
@@ -306,9 +316,9 @@ public class EcoreBaseItemSemanticEditPolicy extends SemanticEditPolicy {
*
* @generated
*/
- protected Command getDestroyElementCommand(View view, boolean confirm) {
+ protected Command getDestroyElementCommand(View view) {
EditPart editPart = (EditPart) getHost().getViewer().getEditPartRegistry().get(view);
- DestroyElementRequest request = new DestroyElementRequest(getEditingDomain(), confirm);
+ DestroyElementRequest request = new DestroyElementRequest(getEditingDomain(), false);
return editPart.getCommand(new EditCommandRequestWrapper(request, Collections.EMPTY_MAP));
}
@@ -317,14 +327,14 @@ public class EcoreBaseItemSemanticEditPolicy extends SemanticEditPolicy {
*
* @generated
*/
- protected CompoundCommand getDestroyEdgesCommand(boolean confirm) {
+ protected CompoundCommand getDestroyEdgesCommand() {
CompoundCommand cmd = new CompoundCommand();
View view = (View) getHost().getModel();
for (Iterator it = view.getSourceEdges().iterator(); it.hasNext();) {
- cmd.add(getDestroyElementCommand((Edge) it.next(), confirm));
+ cmd.add(getDestroyElementCommand((Edge) it.next()));
}
for (Iterator it = view.getTargetEdges().iterator(); it.hasNext();) {
- cmd.add(getDestroyElementCommand((Edge) it.next(), confirm));
+ cmd.add(getDestroyElementCommand((Edge) it.next()));
}
return cmd;
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/part/EcoreDocumentProvider.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/part/EcoreDocumentProvider.java
index 971f10c7e..cb42e2055 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/part/EcoreDocumentProvider.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/part/EcoreDocumentProvider.java
@@ -202,9 +202,6 @@ public class EcoreDocumentProvider extends AbstractDocumentProvider implements I
throw e;
}
}
- if (resource == null) {
- throw new RuntimeException(Messages.EcoreDocumentProvider_UnableToLoadResourceError);
- }
if (uri.fragment() != null) {
EObject rootElement = resource.getEObject(uri.fragment());
if (rootElement instanceof Diagram) {
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/part/Messages.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/part/Messages.java
index 7570fc685..e9f2aa6ca 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/part/Messages.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/part/Messages.java
@@ -69,11 +69,6 @@ public class Messages extends NLS {
/**
* @generated
*/
- public static String EcoreDocumentProvider_UnableToLoadResourceError;
-
- /**
- * @generated
- */
public static String EcoreDocumentProvider_NoDiagramInResourceError;
/**
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/providers/EcoreStructuralFeatureParser.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/providers/EcoreStructuralFeatureParser.java
index 15e0585d2..78067e9cd 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/providers/EcoreStructuralFeatureParser.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/providers/EcoreStructuralFeatureParser.java
@@ -94,7 +94,7 @@ public class EcoreStructuralFeatureParser extends EcoreAbstractParser {
/**
* @generated
*/
- protected IParserEditStatus validateValues(Object[] values) {
+ protected IParserEditStatus validateNewValues(Object[] values) {
if (values.length > 1) {
return ParserEditStatus.UNEDITABLE_STATUS;
}
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/providers/EcoreStructuralFeaturesParser.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/providers/EcoreStructuralFeaturesParser.java
index c5daaf96c..c326b0442 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/providers/EcoreStructuralFeaturesParser.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/providers/EcoreStructuralFeaturesParser.java
@@ -65,7 +65,7 @@ public class EcoreStructuralFeaturesParser extends EcoreAbstractParser {
/**
* @generated
*/
- protected IParserEditStatus validateValues(Object[] values) {
+ protected IParserEditStatus validateNewValues(Object[] values) {
if (values.length != features.size()) {
return ParserEditStatus.UNEDITABLE_STATUS;
}

Back to the top