Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratikhomirov2008-04-17 07:58:45 -0400
committeratikhomirov2008-04-17 07:58:45 -0400
commit3a5a8397886581b96e27957fcb9f40b3013a785f (patch)
tree38f80df9ee7063f49d87e08d5d24335d19fca30a
parent22bff99d0771fbea27263825d4e4b9413ed22445 (diff)
downloadorg.eclipse.gmf-tooling-3a5a8397886581b96e27957fcb9f40b3013a785f.tar.gz
org.eclipse.gmf-tooling-3a5a8397886581b96e27957fcb9f40b3013a785f.tar.xz
org.eclipse.gmf-tooling-3a5a8397886581b96e27957fcb9f40b3013a785f.zip
[227505] Replace FeatureValueSpec generalization of ValueExpression with aggregation, as it's better approach to model such a concept
-rw-r--r--plugins/org.eclipse.gmf.map.edit/icons/full/ctool16/CreateFeatureValueSpec_value_Constraint.gifbin0 -> 223 bytes
-rw-r--r--plugins/org.eclipse.gmf.map.edit/icons/full/ctool16/CreateFeatureValueSpec_value_ValueExpression.gifbin0 -> 223 bytes
-rw-r--r--plugins/org.eclipse.gmf.map.edit/icons/full/obj16/FeatureInitializer.gifbin0 -> 129 bytes
-rw-r--r--plugins/org.eclipse.gmf.map.edit/plugin.properties1
-rw-r--r--plugins/org.eclipse.gmf.map.edit/src/org/eclipse/gmf/mappings/provider/FeatureInitializerItemProvider.java157
-rw-r--r--plugins/org.eclipse.gmf.map.edit/src/org/eclipse/gmf/mappings/provider/FeatureValueSpecItemProvider.java63
-rw-r--r--plugins/org.eclipse.gmf.map.edit/src/org/eclipse/gmf/mappings/provider/ReferenceNewElementSpecItemProvider.java21
7 files changed, 214 insertions, 28 deletions
diff --git a/plugins/org.eclipse.gmf.map.edit/icons/full/ctool16/CreateFeatureValueSpec_value_Constraint.gif b/plugins/org.eclipse.gmf.map.edit/icons/full/ctool16/CreateFeatureValueSpec_value_Constraint.gif
new file mode 100644
index 000000000..64a9ca41f
--- /dev/null
+++ b/plugins/org.eclipse.gmf.map.edit/icons/full/ctool16/CreateFeatureValueSpec_value_Constraint.gif
Binary files differ
diff --git a/plugins/org.eclipse.gmf.map.edit/icons/full/ctool16/CreateFeatureValueSpec_value_ValueExpression.gif b/plugins/org.eclipse.gmf.map.edit/icons/full/ctool16/CreateFeatureValueSpec_value_ValueExpression.gif
new file mode 100644
index 000000000..27c2e4c9e
--- /dev/null
+++ b/plugins/org.eclipse.gmf.map.edit/icons/full/ctool16/CreateFeatureValueSpec_value_ValueExpression.gif
Binary files differ
diff --git a/plugins/org.eclipse.gmf.map.edit/icons/full/obj16/FeatureInitializer.gif b/plugins/org.eclipse.gmf.map.edit/icons/full/obj16/FeatureInitializer.gif
new file mode 100644
index 000000000..7bac4fd38
--- /dev/null
+++ b/plugins/org.eclipse.gmf.map.edit/icons/full/obj16/FeatureInitializer.gif
Binary files differ
diff --git a/plugins/org.eclipse.gmf.map.edit/plugin.properties b/plugins/org.eclipse.gmf.map.edit/plugin.properties
index 25a372eb4..4ec97de49 100644
--- a/plugins/org.eclipse.gmf.map.edit/plugin.properties
+++ b/plugins/org.eclipse.gmf.map.edit/plugin.properties
@@ -227,3 +227,4 @@ _UI_LabelTextAccessMethod_NATIVE_literal = NATIVE
_UI_LabelTextAccessMethod_REGEXP_literal = REGEXP
_UI_LabelTextAccessMethod_PRINTF_literal = PRINTF
_UI_FeatureLabelMapping_editorPattern_feature = Editor Pattern
+_UI_FeatureValueSpec_value_feature = Value
diff --git a/plugins/org.eclipse.gmf.map.edit/src/org/eclipse/gmf/mappings/provider/FeatureInitializerItemProvider.java b/plugins/org.eclipse.gmf.map.edit/src/org/eclipse/gmf/mappings/provider/FeatureInitializerItemProvider.java
new file mode 100644
index 000000000..08f4eea2d
--- /dev/null
+++ b/plugins/org.eclipse.gmf.map.edit/src/org/eclipse/gmf/mappings/provider/FeatureInitializerItemProvider.java
@@ -0,0 +1,157 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.gmf.mappings.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.common.util.ResourceLocator;
+
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+
+import org.eclipse.gmf.mappings.FeatureInitializer;
+import org.eclipse.gmf.mappings.GMFMapPackage;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.gmf.mappings.FeatureInitializer} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class FeatureInitializerItemProvider
+ extends ItemProviderAdapter
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FeatureInitializerItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addFeaturePropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Feature feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addFeaturePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_FeatureInitializer_feature_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_FeatureInitializer_feature_feature", "_UI_FeatureInitializer_type"),
+ GMFMapPackage.eINSTANCE.getFeatureInitializer_Feature(),
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This returns FeatureInitializer.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/FeatureInitializer"));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ return getString("_UI_FeatureInitializer_type");
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(FeatureInitializer.class)) {
+ case GMFMapPackage.FEATURE_INITIALIZER__FEATURE:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return GMFMapEditPlugin.INSTANCE;
+ }
+
+}
diff --git a/plugins/org.eclipse.gmf.map.edit/src/org/eclipse/gmf/mappings/provider/FeatureValueSpecItemProvider.java b/plugins/org.eclipse.gmf.map.edit/src/org/eclipse/gmf/mappings/provider/FeatureValueSpecItemProvider.java
index 3e08451a1..f8d4d0acd 100644
--- a/plugins/org.eclipse.gmf.map.edit/src/org/eclipse/gmf/mappings/provider/FeatureValueSpecItemProvider.java
+++ b/plugins/org.eclipse.gmf.map.edit/src/org/eclipse/gmf/mappings/provider/FeatureValueSpecItemProvider.java
@@ -24,6 +24,7 @@ import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ViewerNotification;
import org.eclipse.gmf.mappings.FeatureInitializer;
import org.eclipse.gmf.mappings.FeatureValueSpec;
+import org.eclipse.gmf.mappings.GMFMapFactory;
import org.eclipse.gmf.mappings.GMFMapPackage;
import org.eclipse.gmf.mappings.presentation.FilterUtil;
@@ -34,7 +35,7 @@ import org.eclipse.gmf.mappings.presentation.FilterUtil;
* @generated
*/
public class FeatureValueSpecItemProvider
- extends ValueExpressionItemProvider
+ extends FeatureInitializerItemProvider
implements
IEditingDomainItemProvider,
IStructuredItemContentProvider,
@@ -62,12 +63,41 @@ public class FeatureValueSpecItemProvider
if (itemPropertyDescriptors == null) {
super.getPropertyDescriptors(object);
- addFeaturePropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
/**
+ * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
+ * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
+ * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
+ if (childrenFeatures == null) {
+ super.getChildrenFeatures(object);
+ childrenFeatures.add(GMFMapPackage.eINSTANCE.getFeatureValueSpec_Value());
+ }
+ return childrenFeatures;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EStructuralFeature getChildFeature(Object object, Object child) {
+ // Check the type of the specified child object and return the proper feature to use for
+ // adding (see {@link AddCommand}) it as a child.
+
+ return super.getChildFeature(object, child);
+ }
+
+ /**
* This adds a property descriptor for the Feature feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -111,14 +141,19 @@ public class FeatureValueSpecItemProvider
}
/**
+ * @generated
+ */
+ public String getTextGen(Object object) {
+ return getString("_UI_FeatureValueSpec_type");
+ }
+
+ /**
* This returns the label text for the adapted class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
* @generated NOT
*/
public String getText(Object object) {
- StringBuffer buf = new StringBuffer();
- buf.append(getString("_UI_FeatureValueSpec_type"));
+ StringBuilder buf = new StringBuilder();
+ buf.append(getTextGen(object));
if(object instanceof FeatureValueSpec) {
FeatureValueSpec featureValueSpec = (FeatureValueSpec)object;
buf.append('<');
@@ -128,7 +163,7 @@ public class FeatureValueSpecItemProvider
buf.append(feature).append(":=");
}
- String body = crop(featureValueSpec.getBody());
+ String body = crop(featureValueSpec.getValue().getBody());
if(body != null && body.length() > 0) {
buf.append(' ').append(body);
}
@@ -149,8 +184,8 @@ public class FeatureValueSpecItemProvider
updateChildren(notification);
switch (notification.getFeatureID(FeatureValueSpec.class)) {
- case GMFMapPackage.FEATURE_VALUE_SPEC__FEATURE:
- fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ case GMFMapPackage.FEATURE_VALUE_SPEC__VALUE:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
return;
}
super.notifyChanged(notification);
@@ -166,6 +201,16 @@ public class FeatureValueSpecItemProvider
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add
+ (createChildParameter
+ (GMFMapPackage.eINSTANCE.getFeatureValueSpec_Value(),
+ GMFMapFactory.eINSTANCE.createValueExpression()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (GMFMapPackage.eINSTANCE.getFeatureValueSpec_Value(),
+ GMFMapFactory.eINSTANCE.createConstraint()));
}
}
diff --git a/plugins/org.eclipse.gmf.map.edit/src/org/eclipse/gmf/mappings/provider/ReferenceNewElementSpecItemProvider.java b/plugins/org.eclipse.gmf.map.edit/src/org/eclipse/gmf/mappings/provider/ReferenceNewElementSpecItemProvider.java
index a7300ca4f..580a8954d 100644
--- a/plugins/org.eclipse.gmf.map.edit/src/org/eclipse/gmf/mappings/provider/ReferenceNewElementSpecItemProvider.java
+++ b/plugins/org.eclipse.gmf.map.edit/src/org/eclipse/gmf/mappings/provider/ReferenceNewElementSpecItemProvider.java
@@ -2,7 +2,7 @@
* <copyright>
* </copyright>
*
- * $Id: ReferenceNewElementSpecItemProvider.java,v 1.6 2007/05/10 17:12:28 atikhomirov Exp $
+ * $Id: ReferenceNewElementSpecItemProvider.java,v 1.7 2008/04/17 11:58:45 atikhomirov Exp $
*/
package org.eclipse.gmf.mappings.provider;
@@ -12,7 +12,6 @@ import java.util.List;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.util.ResourceLocator;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
@@ -22,7 +21,6 @@ import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
-import org.eclipse.emf.edit.provider.ItemProviderAdapter;
import org.eclipse.emf.edit.provider.ViewerNotification;
import org.eclipse.gmf.mappings.FeatureInitializer;
import org.eclipse.gmf.mappings.GMFMapFactory;
@@ -37,7 +35,7 @@ import org.eclipse.gmf.mappings.presentation.FilterUtil;
* @generated
*/
public class ReferenceNewElementSpecItemProvider
- extends ItemProviderAdapter
+ extends FeatureInitializerItemProvider
implements
IEditingDomainItemProvider,
IStructuredItemContentProvider,
@@ -65,7 +63,6 @@ public class ReferenceNewElementSpecItemProvider
if (itemPropertyDescriptors == null) {
super.getPropertyDescriptors(object);
- addFeaturePropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
@@ -182,9 +179,6 @@ public class ReferenceNewElementSpecItemProvider
updateChildren(notification);
switch (notification.getFeatureID(ReferenceNewElementSpec.class)) {
- case GMFMapPackage.REFERENCE_NEW_ELEMENT_SPEC__FEATURE:
- fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
- return;
case GMFMapPackage.REFERENCE_NEW_ELEMENT_SPEC__NEW_ELEMENT_INITIALIZERS:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
return;
@@ -209,15 +203,4 @@ public class ReferenceNewElementSpecItemProvider
GMFMapFactory.eINSTANCE.createFeatureSeqInitializer()));
}
- /**
- * Return the resource locator for this item provider's resources.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public ResourceLocator getResourceLocator() {
- return GMFMapEditPlugin.INSTANCE;
- }
-
}

Back to the top