Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCedric Dumoulin2014-04-07 13:39:00 +0000
committerCedric Dumoulin2014-04-08 07:32:36 +0000
commitda41cbfe25d0e44e32ab7d831f13005e8ef1e1da (patch)
tree28e1c15a6cebe6f6c42e058e6632068e531df8ab /extraplugins
parent4d809b50abd5e485f238fccea008c0c317a9c370 (diff)
downloadorg.eclipse.papyrus-da41cbfe25d0e44e32ab7d831f13005e8ef1e1da.tar.gz
org.eclipse.papyrus-da41cbfe25d0e44e32ab7d831f13005e8ef1e1da.tar.xz
org.eclipse.papyrus-da41cbfe25d0e44e32ab7d831f13005e8ef1e1da.zip
330199 [Layers] - Remove the 'Property' extra node in the Layer
Explorer. Improve the Label of the property instances: now the property name (from the node parent) is shown when available.
Diffstat (limited to 'extraplugins')
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.notationmodel.edit/src/org/eclipse/papyrus/layers/notationmodel/edit/NodeItemProvider.java84
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.notationmodel.edit/src/org/eclipse/papyrus/layers/notationmodel/edit/NotationItemProviderAdapterFactory.java9
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/BooleanInstanceItemProvider.java7
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/ColorInstanceItemProvider.java7
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/FillInstanceItemProvider.java6
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/FontInstanceItemProvider.java12
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/LineInstanceItemProvider.java9
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/TypeInstanceItemProvider.java18
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/custom/AbstractLayerItemProvider.java220
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/custom/AllViewsDerivedLayerItemProvider.java46
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/custom/CustomLayersItemProviderAdapterFactory.java107
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/custom/LayerItemProvider.java58
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/custom/RegExpLayerItemProvider.java57
13 files changed, 617 insertions, 23 deletions
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.notationmodel.edit/src/org/eclipse/papyrus/layers/notationmodel/edit/NodeItemProvider.java b/extraplugins/layers/org.eclipse.papyrus.layers.notationmodel.edit/src/org/eclipse/papyrus/layers/notationmodel/edit/NodeItemProvider.java
new file mode 100644
index 00000000000..5862a30c970
--- /dev/null
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.notationmodel.edit/src/org/eclipse/papyrus/layers/notationmodel/edit/NodeItemProvider.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ * 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:
+ * Cedric Dumoulin - cedric.dumoulin@lifl.fr
+ ******************************************************************************/
+package org.eclipse.papyrus.layers.notationmodel.edit;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.gmf.runtime.notation.Node;
+
+
+
+/**
+ * @author dumoulin
+ *
+ */
+public class NodeItemProvider extends org.eclipse.gmf.runtime.notation.provider.NodeItemProvider {
+
+ protected AdapterFactory domainAdapterFactory;
+
+ /**
+ * Constructor.
+ *
+ * @param adapterFactory
+ */
+ public NodeItemProvider(AdapterFactory adapterFactory, AdapterFactory domainAdapterFactory) {
+ super(adapterFactory);
+ this.domainAdapterFactory = domainAdapterFactory;
+ }
+
+
+ /**
+ * Return the text of the underlying UML element if any.
+ * @see org.eclipse.gmf.runtime.notation.provider.ShapeItemProvider#getText(java.lang.Object)
+ *
+ * @param object
+ * @return
+ */
+ @Override
+ public String getText(Object object) {
+
+// System.err.println("getText()");
+ Node shape = (Node)object;
+
+ Object domainObject = shape.getElement();
+ if( domainObject != null) {
+ IItemLabelProvider nestedProvider = (IItemLabelProvider)domainAdapterFactory.adapt(domainObject, IItemLabelProvider.class);
+ if(nestedProvider != null) {
+ return nestedProvider.getText(domainObject);
+ }
+ }
+ return super.getText(object);
+ }
+
+
+ /**
+ * Return the image of the underlying UML element if any.
+ *
+ * @see org.eclipse.emf.edit.provider.ItemProviderAdapter#getImage(java.lang.String)
+ *
+ * @param key
+ * @return
+ */
+ @Override
+ public Object getImage(Object object) {
+// System.err.println("getImage()");
+ Node shape = (Node)object;
+
+ Object domainObject = shape.getElement();
+ if( domainObject != null) {
+ IItemLabelProvider nestedProvider = (IItemLabelProvider)domainAdapterFactory.adapt(domainObject, IItemLabelProvider.class);
+ if(nestedProvider != null) {
+ return nestedProvider.getImage(domainObject);
+ }
+ }
+ return super.getImage(object);
+ }
+}
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.notationmodel.edit/src/org/eclipse/papyrus/layers/notationmodel/edit/NotationItemProviderAdapterFactory.java b/extraplugins/layers/org.eclipse.papyrus.layers.notationmodel.edit/src/org/eclipse/papyrus/layers/notationmodel/edit/NotationItemProviderAdapterFactory.java
index 78dcf57e572..01d689fd569 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.notationmodel.edit/src/org/eclipse/papyrus/layers/notationmodel/edit/NotationItemProviderAdapterFactory.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.notationmodel.edit/src/org/eclipse/papyrus/layers/notationmodel/edit/NotationItemProviderAdapterFactory.java
@@ -70,4 +70,13 @@ public class NotationItemProviderAdapterFactory extends org.eclipse.gmf.runtime.
return connectorItemProvider;
}
+
+ @Override
+ public Adapter createNodeAdapter() {
+ if (nodeItemProvider == null) {
+ nodeItemProvider = new NodeItemProvider(this, domainAdapterFactory);
+ }
+
+ return nodeItemProvider;
+ }
}
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/BooleanInstanceItemProvider.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/BooleanInstanceItemProvider.java
index 6800910b651..60675e0756d 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/BooleanInstanceItemProvider.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/BooleanInstanceItemProvider.java
@@ -18,7 +18,6 @@ import java.util.List;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
-
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
@@ -28,7 +27,6 @@ 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.ViewerNotification;
-
import org.eclipse.papyrus.layers.stackmodel.layers.BooleanInstance;
import org.eclipse.papyrus.layers.stackmodel.layers.LayersPackage;
@@ -109,12 +107,13 @@ public class BooleanInstanceItemProvider
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @generated
+ * @generated NOT
*/
@Override
public String getText(Object object) {
BooleanInstance booleanInstance = (BooleanInstance)object;
- return getString("_UI_BooleanInstance_type") + " " + booleanInstance.isValue();
+ String propertyName = getInstancePropertyName(object);
+ return ("".equals(propertyName)?getString("_UI_BooleanInstance_type"):"'" + propertyName+"'") + "=" + booleanInstance.isValue();
}
/**
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/ColorInstanceItemProvider.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/ColorInstanceItemProvider.java
index f11ede8cc26..3af7b05b17f 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/ColorInstanceItemProvider.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/ColorInstanceItemProvider.java
@@ -18,7 +18,6 @@ import java.util.List;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
-
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
@@ -28,7 +27,6 @@ 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.ViewerNotification;
-
import org.eclipse.papyrus.layers.stackmodel.layers.ColorInstance;
import org.eclipse.papyrus.layers.stackmodel.layers.LayersPackage;
@@ -109,12 +107,13 @@ public class ColorInstanceItemProvider
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @generated
+ * @generated NOT
*/
@Override
public String getText(Object object) {
ColorInstance colorInstance = (ColorInstance)object;
- return getString("_UI_ColorInstance_type") + " " + colorInstance.getValue();
+ String propertyName = getInstancePropertyName(object);
+ return ("".equals(propertyName)?getString("_UI_ColorInstance_type"):"'" + propertyName+"'") + "=" + colorInstance.getValue();
}
/**
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/FillInstanceItemProvider.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/FillInstanceItemProvider.java
index be4c8e82068..bca8144c1a7 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/FillInstanceItemProvider.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/FillInstanceItemProvider.java
@@ -142,14 +142,16 @@ public class FillInstanceItemProvider
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @generated
+ * @generated NOT
*/
@Override
public String getText(Object object) {
FillInstance fillInstance = (FillInstance)object;
- return getString("_UI_FillInstance_type") + " " + fillInstance.getTransparency();
+ String propertyName = getInstancePropertyName(object);
+ return ("".equals(propertyName)?getString("_UI_FillInstance_type"):"'" + propertyName+"'") + "=" + fillInstance.getTransparency();
}
+
/**
* 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}.
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/FontInstanceItemProvider.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/FontInstanceItemProvider.java
index 1da7492a961..f69fb1732e9 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/FontInstanceItemProvider.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/FontInstanceItemProvider.java
@@ -18,7 +18,6 @@ import java.util.List;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
-
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
@@ -28,7 +27,6 @@ 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.ViewerNotification;
-
import org.eclipse.papyrus.layers.stackmodel.layers.FontInstance;
import org.eclipse.papyrus.layers.stackmodel.layers.LayersPackage;
@@ -178,14 +176,16 @@ public class FontInstanceItemProvider
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @generated
+ * @generated NOT
*/
@Override
public String getText(Object object) {
String label = ((FontInstance)object).getFontName();
- return label == null || label.length() == 0 ?
- getString("_UI_FontInstance_type") :
- getString("_UI_FontInstance_type") + " " + label;
+
+ String propertyName = getInstancePropertyName(object);
+ return ("".equals(propertyName)?getString("_UI_FontInstance_type") : "'" + propertyName+"'")
+ + "=" + label;
+
}
/**
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/LineInstanceItemProvider.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/LineInstanceItemProvider.java
index 3bc3923576a..88fd0f42bb1 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/LineInstanceItemProvider.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/LineInstanceItemProvider.java
@@ -18,7 +18,6 @@ import java.util.List;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
-
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
@@ -28,7 +27,6 @@ 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.ViewerNotification;
-
import org.eclipse.papyrus.layers.stackmodel.layers.LayersPackage;
import org.eclipse.papyrus.layers.stackmodel.layers.LineInstance;
@@ -132,12 +130,15 @@ public class LineInstanceItemProvider
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @generated
+ * @generated NOT
*/
@Override
public String getText(Object object) {
LineInstance lineInstance = (LineInstance)object;
- return getString("_UI_LineInstance_type") + " " + lineInstance.getLineColor();
+ String propertyName = getInstancePropertyName(object);
+ return ("".equals(propertyName)?getString("_UI_LineInstance_type"):"'" + propertyName+"'")
+ + " with=" + lineInstance.getLineWith()
+ + ", color=" + lineInstance.getLineColor();
}
/**
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/TypeInstanceItemProvider.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/TypeInstanceItemProvider.java
index 66afd0d9410..31755fa2478 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/TypeInstanceItemProvider.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/TypeInstanceItemProvider.java
@@ -18,9 +18,7 @@ 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.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
@@ -28,6 +26,8 @@ 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.papyrus.layers.stackmodel.layers.StringToTypeInstanceMap;
+import org.eclipse.papyrus.layers.stackmodel.layers.impl.StringToTypeInstanceMapImpl;
/**
* This is the item provider adapter for a {@link org.eclipse.papyrus.layers.stackmodel.layers.TypeInstance} object.
@@ -80,6 +80,20 @@ public class TypeInstanceItemProvider
}
/**
+ *
+ * @param object
+ * @return
+ */
+ protected String getInstancePropertyName(Object object) {
+
+ Object parent = getParent(object);
+ if( parent instanceof StringToTypeInstanceMapImpl) {
+ return ((StringToTypeInstanceMapImpl)parent).getKey();
+ }
+
+ return "";
+ }
+ /**
* 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 -->
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/custom/AbstractLayerItemProvider.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/custom/AbstractLayerItemProvider.java
new file mode 100644
index 00000000000..cce8dd8453e
--- /dev/null
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/custom/AbstractLayerItemProvider.java
@@ -0,0 +1,220 @@
+/*******************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ * 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:
+ * Cedric Dumoulin - cedric.dumoulin@lifl.fr
+ ******************************************************************************/
+/**
+ */
+package org.eclipse.papyrus.layers.stackmodel.layers.provider.custom;
+
+
+import java.util.ArrayList;
+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.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.command.CommandParameter;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+import org.eclipse.papyrus.layers.stackmodel.layers.LayersPackage;
+import org.eclipse.papyrus.layers.stackmodel.layers.NullInstance;
+import org.eclipse.papyrus.layers.stackmodel.layers.RegExpLayer;
+import org.eclipse.papyrus.layers.stackmodel.layers.impl.StringToTypeInstanceMapImpl;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.papyrus.layers.stackmodel.layers.AbstractLayer} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class AbstractLayerItemProvider
+ extends org.eclipse.papyrus.layers.stackmodel.layers.provider.AbstractLayerItemProvider
+ {
+ /**
+ * The extended object, used as a delegate. This delegate is usually the original implementation
+ * of the ItemProvider.
+ */
+ protected org.eclipse.papyrus.layers.stackmodel.layers.provider.AbstractLayerItemProvider extendedDelegate;
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AbstractLayerItemProvider(AdapterFactory adapterFactory,
+ org.eclipse.papyrus.layers.stackmodel.layers.provider.AbstractLayerItemProvider extendedDelegate) {
+ super(adapterFactory);
+ this.extendedDelegate = extendedDelegate;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.layers.stackmodel.layers.provider.AbstractLayerItemProvider#getChildrenFeatures(java.lang.Object)
+ *
+ * @param object
+ * @return
+ */
+ @Override
+ public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
+ if (childrenFeatures == null) {
+ super.getChildrenFeatures(object);
+ // Add the Property values list. Like that, they will be available directly under the
+ // Layer node.
+ childrenFeatures.add(LayersPackage.Literals.ABSTRACT_LAYER__PROPERTY_VALUES);
+ }
+ return childrenFeatures;
+ }
+
+ /**
+ * We want has children:
+ * <ul>
+ * <li></li>
+ * <li></li>
+ * </ul>
+ * @see org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren(java.lang.Object)
+ *
+ * @param object
+ * @return
+ */
+ @Override
+ public Collection<?> getChildren(Object object) {
+ ChildrenStore store = getChildrenStore(object);
+ if (store != null)
+ {
+ return store.getChildren();
+ }
+
+ store = createChildrenStore(object);
+ List<Object> result = store != null ? null : new ArrayList<Object>();
+ EObject eObject = (EObject)object;
+
+ for (EStructuralFeature feature : getChildrenFeatures(object))
+ {
+ if (feature.isMany())
+ {
+ List<?> children = (List<?>)getValue(eObject, feature);
+ int index = 0;
+ for (Object unwrappedChild : children)
+ {
+ if( ! isValidChild(unwrappedChild)) {
+ continue;
+ }
+ //
+ Object child = wrap(eObject, feature, unwrappedChild, index);
+ if (store != null)
+ {
+ store.getList(feature).add(child);
+ }
+ else if (result != null)
+ {
+ result.add(child);
+ }
+ index++;
+
+ }
+ }
+ else
+ {
+ // Single value
+ Object child = getValue(eObject, feature);
+ if (child != null && isValidChild(child) )
+ {
+ child = wrap(eObject, feature, child, CommandParameter.NO_INDEX);
+ if (store != null)
+ {
+ store.setValue(feature, child);
+ }
+ else if (result != null)
+ {
+ result.add(child);
+ }
+ }
+ }
+ }
+ return store != null ? store.getChildren() : result;
+ }
+
+ /**
+ * Return true if the value should be a children of the node
+ * @param child
+ * @return
+ */
+ private boolean isValidChild(Object child) {
+
+ if( child instanceof StringToTypeInstanceMapImpl
+ || child instanceof NullInstance ) {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * This returns RegExpLayer.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return extendedDelegate.getImage(object);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ return extendedDelegate.getPropertyDescriptors(object);
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ return extendedDelegate.getText(object);
+ }
+
+ /**
+ * 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(RegExpLayer.class)) {
+ case LayersPackage.REG_EXP_LAYER__EXPR:
+ case LayersPackage.REG_EXP_LAYER__LANGUAGE:
+ case LayersPackage.REG_EXP_LAYER__IS_DOMAIN_CHANGED_EVENT_DEPENDANT:
+ case LayersPackage.REG_EXP_LAYER__DOMAIN_CHANGED_EVENT_LEVEL:
+ case LayersPackage.REG_EXP_LAYER__IS_DIAGRAM_CHANGED_EVENT_DEPENDANT:
+ case LayersPackage.REG_EXP_LAYER__DIAGRAM_CHANGED_EVENT_LEVEL:
+ case LayersPackage.REG_EXP_LAYER__EXPRESSION_CONTEXT_OBJECT_TYPE:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+
+}
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/custom/AllViewsDerivedLayerItemProvider.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/custom/AllViewsDerivedLayerItemProvider.java
new file mode 100644
index 00000000000..8ddc96bebc7
--- /dev/null
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/custom/AllViewsDerivedLayerItemProvider.java
@@ -0,0 +1,46 @@
+/**
+ */
+package org.eclipse.papyrus.layers.stackmodel.layers.provider.custom;
+
+
+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.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.papyrus.layers.stackmodel.layers.AllViewsDerivedLayer;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.papyrus.layers.stackmodel.layers.AllViewsDerivedLayer} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class AllViewsDerivedLayerItemProvider
+ extends AbstractLayerItemProvider
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AllViewsDerivedLayerItemProvider(AdapterFactory adapterFactory,
+ org.eclipse.papyrus.layers.stackmodel.layers.provider.AllViewsDerivedLayerItemProvider extendedDelegate) {
+ super(adapterFactory, extendedDelegate);
+ }
+
+}
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/custom/CustomLayersItemProviderAdapterFactory.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/custom/CustomLayersItemProviderAdapterFactory.java
index f5d7bcaace8..b005c48afdb 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/custom/CustomLayersItemProviderAdapterFactory.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/custom/CustomLayersItemProviderAdapterFactory.java
@@ -17,7 +17,40 @@ import org.eclipse.papyrus.layers.stackmodel.layers.provider.LayersItemProviderA
/**
* A custom {@link LayersItemProviderAdapterFactory} used to render layers element
* in a tree.
- * This factory and its oveloaded Providers removed extra nodes in the tree.
+ * This factory and its overloaded Providers removed extra nodes in the tree.
+ * <br>
+ * The factory extends the original one {@link LayersItemProviderAdapterFactory}.
+ * <br>
+ * To override an ItemProvider, different strategies can be used, depending if we override one single node,
+ * or a hierarchy of node (inheritance).
+ * <h2>Single Node</h2>
+ * <ul>
+ * <li>Create, in custom, a new XxxItemProvider extending the original one.</li>
+ * <li>Add corresponding createXxxItemProvider() in {@link LayersItemProviderAdapterFactory}</li>
+ * </ul>
+ *
+ * <h2>Hierarchy of node</h2>
+ * By hierarchy, we mean classes with inheritance, with one common ancestor.
+ * See {@link AbstractLayerItemProvider} as example.
+ * <ul>
+ * <li>Create, in custom package, a new XxxItemProvider for the common ancestor, extending the original ItemProvider.</li>
+ * <ul>
+ * <li>Create a property 'extendedDelegate :: OriginalAncestorItemProvider</li>
+ * <li>Override getImage(), getText(), getPropertyDescriptors() and notifyChanged(), let them return their
+ * counterpart from extendedDelegate (i.e.: extendedDelegate.getText()).</li>
+ * <li>This will allow subclasses to use the counterpart methods from their original implementation.</li>
+ * <li>Create a constructor with the factory and the extendedDelegate as parameter</li>
+ * <li></li>
+ * </ul>
+ * <li>in custom {@link LayersItemProviderAdapterFactory}:</li>
+ * <ul>
+ * <li>Add a property XxxItemAdapter xxxItemAdapter; for each each class of the hierarchy</li>
+ * <li>Override methods createXxxItemAdapter() for each class of the hierarchy.</li>
+ * <li>in the method, create the instance of the property, provide the factory, and an instance of the extendedClass </li>
+ * <li></li>
+ * </ul>
+ * <li></li>
+ * </ul>
*
* <br>
* To use a custom Providers, it is necessary to create it in this factory.
@@ -27,6 +60,10 @@ import org.eclipse.papyrus.layers.stackmodel.layers.provider.LayersItemProviderA
*/
public class CustomLayersItemProviderAdapterFactory extends LayersItemProviderAdapterFactory {
+ protected LayerItemProvider layerItemProvider;
+ protected RegExpLayerItemProvider regExpLayerItemProvider;
+ protected AllViewsDerivedLayerItemProvider allViewsDerivedLayerItemProvider;
+
/**
* Constructor.
*
@@ -36,6 +73,12 @@ public class CustomLayersItemProviderAdapterFactory extends LayersItemProviderAd
}
+ /**
+ *
+ * @see org.eclipse.papyrus.layers.stackmodel.layers.provider.LayersItemProviderAdapterFactory#createLayersStackApplicationAdapter()
+ *
+ * @return
+ */
@Override
public Adapter createLayersStackApplicationAdapter() {
if (layersStackApplicationItemProvider == null) {
@@ -44,4 +87,66 @@ public class CustomLayersItemProviderAdapterFactory extends LayersItemProviderAd
return layersStackApplicationItemProvider;
}
+
+ /**
+ *
+ * @see org.eclipse.papyrus.layers.stackmodel.layers.provider.LayersItemProviderAdapterFactory#createLayerAdapter()
+ *
+ * @return
+ */
+ @Override
+ public Adapter createLayerAdapter() {
+ if (layerItemProvider == null) {
+ layerItemProvider = new LayerItemProvider(this,
+ (org.eclipse.papyrus.layers.stackmodel.layers.provider.LayerItemProvider)super.createLayerAdapter());
+ }
+
+ return layerItemProvider;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.layers.stackmodel.layers.provider.LayersItemProviderAdapterFactory#createRegExpLayerAdapter()
+ *
+ * @return
+ */
+ @Override
+ public Adapter createRegExpLayerAdapter() {
+ if (regExpLayerItemProvider == null) {
+ regExpLayerItemProvider = new RegExpLayerItemProvider(this,
+ (org.eclipse.papyrus.layers.stackmodel.layers.provider.RegExpLayerItemProvider)super.createRegExpLayerAdapter());
+ }
+
+ return regExpLayerItemProvider;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.layers.stackmodel.layers.provider.LayersItemProviderAdapterFactory#createAllViewsDerivedLayerAdapter()
+ *
+ * @return
+ */
+ @Override
+ public Adapter createAllViewsDerivedLayerAdapter() {
+ if (allViewsDerivedLayerItemProvider == null) {
+ allViewsDerivedLayerItemProvider = new AllViewsDerivedLayerItemProvider(this,
+ (org.eclipse.papyrus.layers.stackmodel.layers.provider.AllViewsDerivedLayerItemProvider)super.createAllViewsDerivedLayerAdapter());
+ }
+
+ return allViewsDerivedLayerItemProvider;
+ }
+ /**
+ *
+ * @see org.eclipse.papyrus.layers.stackmodel.layers.provider.LayersItemProviderAdapterFactory#createStringToTypeInstanceMapAdapter()
+ *
+ * @return
+ */
+// @Override
+// public Adapter createStringToTypeInstanceMapAdapter() {
+// if (stringToTypeInstanceMapItemProvider == null) {
+// stringToTypeInstanceMapItemProvider = new StringToTypeInstanceMapItemProvider(this);
+// }
+//
+// return stringToTypeInstanceMapItemProvider;
+// }
}
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/custom/LayerItemProvider.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/custom/LayerItemProvider.java
new file mode 100644
index 00000000000..c55c662aca2
--- /dev/null
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/custom/LayerItemProvider.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ * 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:
+ * Cedric Dumoulin - cedric.dumoulin@lifl.fr
+ ******************************************************************************/
+/**
+ */
+package org.eclipse.papyrus.layers.stackmodel.layers.provider.custom;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.command.CommandParameter;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.papyrus.layers.stackmodel.layers.LayersPackage;
+import org.eclipse.papyrus.layers.stackmodel.layers.NullInstance;
+import org.eclipse.papyrus.layers.stackmodel.layers.impl.StringToTypeInstanceMapImpl;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.papyrus.layers.stackmodel.layers.Layer} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class LayerItemProvider
+ extends AbstractLayerItemProvider
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public LayerItemProvider(AdapterFactory adapterFactory,
+ org.eclipse.papyrus.layers.stackmodel.layers.provider.LayerItemProvider extendedDelegate) {
+ super(adapterFactory, extendedDelegate);
+ }
+
+}
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/custom/RegExpLayerItemProvider.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/custom/RegExpLayerItemProvider.java
new file mode 100644
index 00000000000..306950ddf24
--- /dev/null
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.edit/src/org/eclipse/papyrus/layers/stackmodel/layers/provider/custom/RegExpLayerItemProvider.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ * 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:
+ * Cedric Dumoulin - cedric.dumoulin@lifl.fr
+ ******************************************************************************/
+/**
+ */
+package org.eclipse.papyrus.layers.stackmodel.layers.provider.custom;
+
+
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+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.ViewerNotification;
+import org.eclipse.papyrus.layers.stackmodel.layers.LayersPackage;
+import org.eclipse.papyrus.layers.stackmodel.layers.RegExpLayer;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.papyrus.layers.stackmodel.layers.RegExpLayer} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class RegExpLayerItemProvider
+ extends AbstractLayerItemProvider
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public RegExpLayerItemProvider(AdapterFactory adapterFactory, org.eclipse.papyrus.layers.stackmodel.layers.provider.RegExpLayerItemProvider extendedDelegate) {
+ super(adapterFactory, extendedDelegate);
+ }
+
+
+}

Back to the top