Browse Source

Added namespace to edit plugin

Andreas Mülder 13 years ago
parent
commit
b06fcfbf9c

+ 1 - 1
plugins/org.yakindu.sct.model.sgraph.edit/.classpath

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
+	<classpathentry kind="src" path="src"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
 	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
-	<classpathentry kind="src" path="src"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>

+ 3 - 0
plugins/org.yakindu.sct.model.sgraph.edit/plugin.properties

@@ -134,3 +134,6 @@ _UI_State_composite_feature = Composite
 _UI_Statement_type = Statement
 _UI_State_isLeaf_feature = Is Leaf
 _UI_State_leaf_feature = Leaf
+pluginName = SGraph Edit Support
+providerName = www.example.org
+


+ 32 - 1
plugins/org.yakindu.sct.model.sgraph.edit/src/org/yakindu/sct/model/sgraph/provider/ScopedElementItemProvider.java

@@ -18,12 +18,14 @@ 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;
 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.ItemPropertyDescriptor;
 import org.eclipse.emf.edit.provider.ItemProviderAdapter;
 import org.eclipse.emf.edit.provider.ViewerNotification;
 import org.yakindu.sct.model.sgraph.SGraphFactory;
@@ -72,10 +74,33 @@ public class ScopedElementItemProvider
 		if (itemPropertyDescriptors == null) {
 			super.getPropertyDescriptors(object);
 
+			addNamespacePropertyDescriptor(object);
 		}
 		return itemPropertyDescriptors;
 	}
 
+	/**
+	 * This adds a property descriptor for the Namespace feature.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	protected void addNamespacePropertyDescriptor(Object object) {
+		itemPropertyDescriptors.add
+			(createItemPropertyDescriptor
+				(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+				 getResourceLocator(),
+				 getString("_UI_ScopedElement_namespace_feature"),
+				 getString("_UI_PropertyDescriptor_description", "_UI_ScopedElement_namespace_feature", "_UI_ScopedElement_type"),
+				 SGraphPackage.Literals.SCOPED_ELEMENT__NAMESPACE,
+				 true,
+				 false,
+				 false,
+				 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+				 null,
+				 null));
+	}
+
 	/**
 	 * 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
@@ -114,7 +139,10 @@ public class ScopedElementItemProvider
 	 */
 	@Override
 	public String getText(Object object) {
-		return getString("_UI_ScopedElement_type");
+		String label = ((ScopedElement)object).getNamespace();
+		return label == null || label.length() == 0 ?
+			getString("_UI_ScopedElement_type") :
+			getString("_UI_ScopedElement_type") + " " + label;
 	}
 
 	/**
@@ -129,6 +157,9 @@ public class ScopedElementItemProvider
 		updateChildren(notification);
 
 		switch (notification.getFeatureID(ScopedElement.class)) {
+			case SGraphPackage.SCOPED_ELEMENT__NAMESPACE:
+				fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+				return;
 			case SGraphPackage.SCOPED_ELEMENT__SCOPES:
 				fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
 				return;

+ 24 - 0
plugins/org.yakindu.sct.model.sgraph.edit/src/org/yakindu/sct/model/sgraph/provider/StateItemProvider.java

@@ -74,6 +74,7 @@ public class StateItemProvider
 
 			addExpressionPropertyDescriptor(object);
 			addReactionsPropertyDescriptor(object);
+			addNamespacePropertyDescriptor(object);
 			addOrthogonalPropertyDescriptor(object);
 			addSubstatechartPropertyDescriptor(object);
 			addSubmachinePropertyDescriptor(object);
@@ -128,6 +129,28 @@ public class StateItemProvider
 				 null));
 	}
 
+	/**
+	 * This adds a property descriptor for the Namespace feature.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	protected void addNamespacePropertyDescriptor(Object object) {
+		itemPropertyDescriptors.add
+			(createItemPropertyDescriptor
+				(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+				 getResourceLocator(),
+				 getString("_UI_ScopedElement_namespace_feature"),
+				 getString("_UI_PropertyDescriptor_description", "_UI_ScopedElement_namespace_feature", "_UI_ScopedElement_type"),
+				 SGraphPackage.Literals.SCOPED_ELEMENT__NAMESPACE,
+				 true,
+				 false,
+				 false,
+				 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+				 null,
+				 null));
+	}
+
 	/**
 	 * This adds a property descriptor for the Orthogonal feature.
 	 * <!-- begin-user-doc -->
@@ -330,6 +353,7 @@ public class StateItemProvider
 
 		switch (notification.getFeatureID(State.class)) {
 			case SGraphPackage.STATE__EXPRESSION:
+			case SGraphPackage.STATE__NAMESPACE:
 			case SGraphPackage.STATE__ORTHOGONAL:
 			case SGraphPackage.STATE__SUBMACHINE:
 			case SGraphPackage.STATE__SIMPLE:

+ 24 - 0
plugins/org.yakindu.sct.model.sgraph.edit/src/org/yakindu/sct/model/sgraph/provider/StatechartItemProvider.java

@@ -74,6 +74,7 @@ public class StatechartItemProvider
 
 			addExpressionPropertyDescriptor(object);
 			addReactionsPropertyDescriptor(object);
+			addNamespacePropertyDescriptor(object);
 		}
 		return itemPropertyDescriptors;
 	}
@@ -122,6 +123,28 @@ public class StatechartItemProvider
 				 null));
 	}
 
+	/**
+	 * This adds a property descriptor for the Namespace feature.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	protected void addNamespacePropertyDescriptor(Object object) {
+		itemPropertyDescriptors.add
+			(createItemPropertyDescriptor
+				(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+				 getResourceLocator(),
+				 getString("_UI_ScopedElement_namespace_feature"),
+				 getString("_UI_PropertyDescriptor_description", "_UI_ScopedElement_namespace_feature", "_UI_ScopedElement_type"),
+				 SGraphPackage.Literals.SCOPED_ELEMENT__NAMESPACE,
+				 true,
+				 false,
+				 false,
+				 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+				 null,
+				 null));
+	}
+
 	/**
 	 * 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
@@ -192,6 +215,7 @@ public class StatechartItemProvider
 
 		switch (notification.getFeatureID(Statechart.class)) {
 			case SGraphPackage.STATECHART__EXPRESSION:
+			case SGraphPackage.STATECHART__NAMESPACE:
 				fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
 				return;
 			case SGraphPackage.STATECHART__LOCAL_REACTIONS: