diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..44b6142 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.metadata +**/bin/ diff --git a/ec_ws.tar b/ec_ws.tar deleted file mode 100644 index b0bdbaf..0000000 Binary files a/ec_ws.tar and /dev/null differ diff --git a/fr.n7.petriNet/.project b/fr.n7.petriNet/.project new file mode 100644 index 0000000..7ed2a3b --- /dev/null +++ b/fr.n7.petriNet/.project @@ -0,0 +1,11 @@ + + + fr.n7.petriNet + + + + + + + + diff --git a/fr.n7.petriNet/petriNet.aird b/fr.n7.petriNet/petriNet.aird new file mode 100644 index 0000000..309d716 --- /dev/null +++ b/fr.n7.petriNet/petriNet.aird @@ -0,0 +1,668 @@ + + + + petriNet.ecore + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bold + + + + + + + bold + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + bold + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + bold + + + + + + + + + + + labelSize + + + labelSize + + + + + + + + + + labelSize + + + labelSize + + + + + + + + + + labelSize + + + labelSize + + + + + + + + + + + italic + + + + + + + + + + + + italic + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bold + + + + + + + bold + + + + + + + + + + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + bold + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + bold + + + + + + + + bold + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + italic + + + + + + + + bold + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + bold + + + + + + + + + + + labelSize + + + labelSize + + + + + + + + + + labelSize + + + labelSize + + + + + + + + + + labelSize + + + labelSize + + + + + + + + + + + italic + + + + + + + + + + + + italic + + + + + + + + + + + + + + diff --git a/fr.n7.petriNet/petriNet.ecore b/fr.n7.petriNet/petriNet.ecore new file mode 100644 index 0000000..3deab2f --- /dev/null +++ b/fr.n7.petriNet/petriNet.ecore @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/fr.n7.petriNet/petrinet class diagram.png b/fr.n7.petriNet/petrinet class diagram.png new file mode 100644 index 0000000..bb31ed0 Binary files /dev/null and b/fr.n7.petriNet/petrinet class diagram.png differ diff --git a/fr.n7.simplePDL.edit/.classpath b/fr.n7.simplePDL.edit/.classpath new file mode 100644 index 0000000..c3ba59e --- /dev/null +++ b/fr.n7.simplePDL.edit/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/fr.n7.simplePDL.edit/.project b/fr.n7.simplePDL.edit/.project new file mode 100644 index 0000000..4c30a18 --- /dev/null +++ b/fr.n7.simplePDL.edit/.project @@ -0,0 +1,28 @@ + + + fr.n7.simplePDL.edit + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + diff --git a/fr.n7.simplePDL.edit/META-INF/MANIFEST.MF b/fr.n7.simplePDL.edit/META-INF/MANIFEST.MF new file mode 100644 index 0000000..a3cbb4e --- /dev/null +++ b/fr.n7.simplePDL.edit/META-INF/MANIFEST.MF @@ -0,0 +1,16 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: fr.n7.simplePDL.edit;singleton:=true +Automatic-Module-Name: fr.n7.simplePDL.edit +Bundle-Version: 1.0.0.qualifier +Bundle-ClassPath: . +Bundle-Activator: simplepdl.provider.SimplePDLEditPlugin$Implementation +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Export-Package: simplepdl.provider +Require-Bundle: org.eclipse.core.runtime, + fr.n7.simplePDL;visibility:=reexport, + org.eclipse.emf.edit;visibility:=reexport +Bundle-ActivationPolicy: lazy diff --git a/fr.n7.simplePDL.edit/build.properties b/fr.n7.simplePDL.edit/build.properties new file mode 100644 index 0000000..6e3e902 --- /dev/null +++ b/fr.n7.simplePDL.edit/build.properties @@ -0,0 +1,10 @@ +# + +bin.includes = .,\ + icons/,\ + META-INF/,\ + plugin.xml,\ + plugin.properties +jars.compile.order = . +source.. = src/ +output.. = bin/ diff --git a/fr.n7.simplePDL.edit/icons/full/ctool16/CreateProcess_processElements_Guidance.gif b/fr.n7.simplePDL.edit/icons/full/ctool16/CreateProcess_processElements_Guidance.gif new file mode 100644 index 0000000..cbb9f42 Binary files /dev/null and b/fr.n7.simplePDL.edit/icons/full/ctool16/CreateProcess_processElements_Guidance.gif differ diff --git a/fr.n7.simplePDL.edit/icons/full/ctool16/CreateProcess_processElements_Resource.gif b/fr.n7.simplePDL.edit/icons/full/ctool16/CreateProcess_processElements_Resource.gif new file mode 100644 index 0000000..c0dddc3 Binary files /dev/null and b/fr.n7.simplePDL.edit/icons/full/ctool16/CreateProcess_processElements_Resource.gif differ diff --git a/fr.n7.simplePDL.edit/icons/full/ctool16/CreateProcess_processElements_WorkDefinition.gif b/fr.n7.simplePDL.edit/icons/full/ctool16/CreateProcess_processElements_WorkDefinition.gif new file mode 100644 index 0000000..fce4def Binary files /dev/null and b/fr.n7.simplePDL.edit/icons/full/ctool16/CreateProcess_processElements_WorkDefinition.gif differ diff --git a/fr.n7.simplePDL.edit/icons/full/ctool16/CreateProcess_processElements_WorkSequence.gif b/fr.n7.simplePDL.edit/icons/full/ctool16/CreateProcess_processElements_WorkSequence.gif new file mode 100644 index 0000000..304981b Binary files /dev/null and b/fr.n7.simplePDL.edit/icons/full/ctool16/CreateProcess_processElements_WorkSequence.gif differ diff --git a/fr.n7.simplePDL.edit/icons/full/ctool16/CreateWorkDefinition_requests_Request.gif b/fr.n7.simplePDL.edit/icons/full/ctool16/CreateWorkDefinition_requests_Request.gif new file mode 100644 index 0000000..9398dda Binary files /dev/null and b/fr.n7.simplePDL.edit/icons/full/ctool16/CreateWorkDefinition_requests_Request.gif differ diff --git a/fr.n7.simplePDL.edit/icons/full/obj16/Guidance.gif b/fr.n7.simplePDL.edit/icons/full/obj16/Guidance.gif new file mode 100644 index 0000000..c414fe9 Binary files /dev/null and b/fr.n7.simplePDL.edit/icons/full/obj16/Guidance.gif differ diff --git a/fr.n7.simplePDL.edit/icons/full/obj16/Process.gif b/fr.n7.simplePDL.edit/icons/full/obj16/Process.gif new file mode 100644 index 0000000..c3370c7 Binary files /dev/null and b/fr.n7.simplePDL.edit/icons/full/obj16/Process.gif differ diff --git a/fr.n7.simplePDL.edit/icons/full/obj16/Request.gif b/fr.n7.simplePDL.edit/icons/full/obj16/Request.gif new file mode 100644 index 0000000..c00aedf Binary files /dev/null and b/fr.n7.simplePDL.edit/icons/full/obj16/Request.gif differ diff --git a/fr.n7.simplePDL.edit/icons/full/obj16/Resource.gif b/fr.n7.simplePDL.edit/icons/full/obj16/Resource.gif new file mode 100644 index 0000000..338fb8d Binary files /dev/null and b/fr.n7.simplePDL.edit/icons/full/obj16/Resource.gif differ diff --git a/fr.n7.simplePDL.edit/icons/full/obj16/WorkDefinition.gif b/fr.n7.simplePDL.edit/icons/full/obj16/WorkDefinition.gif new file mode 100644 index 0000000..2124f3e Binary files /dev/null and b/fr.n7.simplePDL.edit/icons/full/obj16/WorkDefinition.gif differ diff --git a/fr.n7.simplePDL.edit/icons/full/obj16/WorkSequence.gif b/fr.n7.simplePDL.edit/icons/full/obj16/WorkSequence.gif new file mode 100644 index 0000000..106881e Binary files /dev/null and b/fr.n7.simplePDL.edit/icons/full/obj16/WorkSequence.gif differ diff --git a/fr.n7.simplePDL.edit/plugin.properties b/fr.n7.simplePDL.edit/plugin.properties new file mode 100644 index 0000000..ecf0a89 --- /dev/null +++ b/fr.n7.simplePDL.edit/plugin.properties @@ -0,0 +1,46 @@ +# + +pluginName = SimplePDL Model Edit Support +providerName = www.example.org + +_UI_CreateChild_text = {0} +_UI_CreateChild_text2 = {1} {0} +_UI_CreateChild_text3 = {1} +_UI_CreateChild_tooltip = Create New {0} Under {1} Feature +_UI_CreateChild_description = Create a new child of type {0} for the {1} feature of the selected {2}. +_UI_CreateSibling_description = Create a new sibling of type {0} for the selected {2}, under the {1} feature of their parent. + +_UI_PropertyDescriptor_description = The {0} of the {1} + +_UI_ProcessElement_type = Process Element +_UI_WorkDefinition_type = Work Definition +_UI_WorkSequence_type = Work Sequence +_UI_Guidance_type = Guidance +_UI_Process_type = Process +_UI_Request_type = Request +_UI_Resource_type = Resource +_UI_Unknown_type = Object + +_UI_Unknown_datatype= Value + +_UI_WorkDefinition_linksToPredecessors_feature = Links To Predecessors +_UI_WorkDefinition_linksToSuccessors_feature = Links To Successors +_UI_WorkDefinition_name_feature = Name +_UI_WorkDefinition_requests_feature = Requests +_UI_WorkSequence_linkType_feature = Link Type +_UI_WorkSequence_predecessor_feature = Predecessor +_UI_WorkSequence_successor_feature = Successor +_UI_Guidance_text_feature = Text +_UI_Guidance_elements_feature = Elements +_UI_Process_name_feature = Name +_UI_Process_processElements_feature = Process Elements +_UI_Request_quantity_feature = Quantity +_UI_Request_target_feature = Target +_UI_Resource_quantity_feature = Quantity +_UI_Resource_name_feature = Name +_UI_Unknown_feature = Unspecified + +_UI_WorkSequenceType_startToStart_literal = startToStart +_UI_WorkSequenceType_finishToStart_literal = finishToStart +_UI_WorkSequenceType_startToFinish_literal = startToFinish +_UI_WorkSequenceType_finishToFinish_literal = finishToFinish diff --git a/fr.n7.simplePDL.edit/plugin.xml b/fr.n7.simplePDL.edit/plugin.xml new file mode 100644 index 0000000..cb596db --- /dev/null +++ b/fr.n7.simplePDL.edit/plugin.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + diff --git a/fr.n7.simplePDL.edit/src/simplepdl/provider/GuidanceItemProvider.java b/fr.n7.simplePDL.edit/src/simplepdl/provider/GuidanceItemProvider.java new file mode 100644 index 0000000..a02e5b4 --- /dev/null +++ b/fr.n7.simplePDL.edit/src/simplepdl/provider/GuidanceItemProvider.java @@ -0,0 +1,155 @@ +/** + */ +package simplepdl.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.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ViewerNotification; + +import simplepdl.Guidance; +import simplepdl.SimplepdlPackage; + +/** + * This is the item provider adapter for a {@link simplepdl.Guidance} object. + * + * + * @generated + */ +public class GuidanceItemProvider extends ProcessElementItemProvider { + /** + * This constructs an instance from a factory and a notifier. + * + * + * @generated + */ + public GuidanceItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addTextPropertyDescriptor(object); + addElementsPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Text feature. + * + * + * @generated + */ + protected void addTextPropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Guidance_text_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_Guidance_text_feature", "_UI_Guidance_type"), + SimplepdlPackage.Literals.GUIDANCE__TEXT, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This adds a property descriptor for the Elements feature. + * + * + * @generated + */ + protected void addElementsPropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Guidance_elements_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_Guidance_elements_feature", "_UI_Guidance_type"), + SimplepdlPackage.Literals.GUIDANCE__ELEMENTS, + true, + false, + true, + null, + null, + null)); + } + + /** + * This returns Guidance.gif. + * + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/Guidance")); + } + + /** + * This returns the label text for the adapted class. + * + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((Guidance)object).getText(); + return label == null || label.length() == 0 ? + getString("_UI_Guidance_type") : + getString("_UI_Guidance_type") + " " + label; + } + + + /** + * 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}. + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(Guidance.class)) { + case SimplepdlPackage.GUIDANCE__TEXT: + 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. + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + +} diff --git a/fr.n7.simplePDL.edit/src/simplepdl/provider/ProcessElementItemProvider.java b/fr.n7.simplePDL.edit/src/simplepdl/provider/ProcessElementItemProvider.java new file mode 100644 index 0000000..8ec405c --- /dev/null +++ b/fr.n7.simplePDL.edit/src/simplepdl/provider/ProcessElementItemProvider.java @@ -0,0 +1,109 @@ +/** + */ +package simplepdl.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.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; + +/** + * This is the item provider adapter for a {@link simplepdl.ProcessElement} object. + * + * + * @generated + */ +public class ProcessElementItemProvider + extends ItemProviderAdapter + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * + * + * @generated + */ + public ProcessElementItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + } + return itemPropertyDescriptors; + } + + /** + * This returns the label text for the adapted class. + * + * + * @generated + */ + @Override + public String getText(Object object) { + return getString("_UI_ProcessElement_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}. + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + + /** + * Return the resource locator for this item provider's resources. + * + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + return SimplePDLEditPlugin.INSTANCE; + } + +} diff --git a/fr.n7.simplePDL.edit/src/simplepdl/provider/ProcessItemProvider.java b/fr.n7.simplePDL.edit/src/simplepdl/provider/ProcessItemProvider.java new file mode 100644 index 0000000..2e0c693 --- /dev/null +++ b/fr.n7.simplePDL.edit/src/simplepdl/provider/ProcessItemProvider.java @@ -0,0 +1,213 @@ +/** + */ +package simplepdl.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.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 simplepdl.SimplepdlFactory; +import simplepdl.SimplepdlPackage; + +/** + * This is the item provider adapter for a {@link simplepdl.Process} object. + * + * + * @generated + */ +public class ProcessItemProvider + extends ItemProviderAdapter + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * + * + * @generated + */ + public ProcessItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addNamePropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Name feature. + * + * + * @generated + */ + protected void addNamePropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Process_name_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_Process_name_feature", "_UI_Process_type"), + SimplepdlPackage.Literals.PROCESS__NAME, + 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 + * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. + * + * + * @generated + */ + @Override + public Collection getChildrenFeatures(Object object) { + if (childrenFeatures == null) { + super.getChildrenFeatures(object); + childrenFeatures.add(SimplepdlPackage.Literals.PROCESS__PROCESS_ELEMENTS); + } + return childrenFeatures; + } + + /** + * + * + * @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 returns Process.gif. + * + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/Process")); + } + + /** + * This returns the label text for the adapted class. + * + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((simplepdl.Process)object).getName(); + return label == null || label.length() == 0 ? + getString("_UI_Process_type") : + getString("_UI_Process_type") + " " + label; + } + + + /** + * 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}. + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(simplepdl.Process.class)) { + case SimplepdlPackage.PROCESS__NAME: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + case SimplepdlPackage.PROCESS__PROCESS_ELEMENTS: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + + newChildDescriptors.add + (createChildParameter + (SimplepdlPackage.Literals.PROCESS__PROCESS_ELEMENTS, + SimplepdlFactory.eINSTANCE.createWorkDefinition())); + + newChildDescriptors.add + (createChildParameter + (SimplepdlPackage.Literals.PROCESS__PROCESS_ELEMENTS, + SimplepdlFactory.eINSTANCE.createWorkSequence())); + + newChildDescriptors.add + (createChildParameter + (SimplepdlPackage.Literals.PROCESS__PROCESS_ELEMENTS, + SimplepdlFactory.eINSTANCE.createGuidance())); + + newChildDescriptors.add + (createChildParameter + (SimplepdlPackage.Literals.PROCESS__PROCESS_ELEMENTS, + SimplepdlFactory.eINSTANCE.createResource())); + } + + /** + * Return the resource locator for this item provider's resources. + * + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + return SimplePDLEditPlugin.INSTANCE; + } + +} diff --git a/fr.n7.simplePDL.edit/src/simplepdl/provider/RequestItemProvider.java b/fr.n7.simplePDL.edit/src/simplepdl/provider/RequestItemProvider.java new file mode 100644 index 0000000..d884e02 --- /dev/null +++ b/fr.n7.simplePDL.edit/src/simplepdl/provider/RequestItemProvider.java @@ -0,0 +1,179 @@ +/** + */ +package simplepdl.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.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ItemProviderAdapter; +import org.eclipse.emf.edit.provider.ViewerNotification; + +import simplepdl.Request; +import simplepdl.SimplepdlPackage; + +/** + * This is the item provider adapter for a {@link simplepdl.Request} object. + * + * + * @generated + */ +public class RequestItemProvider + extends ItemProviderAdapter + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * + * + * @generated + */ + public RequestItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addQuantityPropertyDescriptor(object); + addTargetPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Quantity feature. + * + * + * @generated + */ + protected void addQuantityPropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Request_quantity_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_Request_quantity_feature", "_UI_Request_type"), + SimplepdlPackage.Literals.REQUEST__QUANTITY, + true, + false, + false, + ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, + null, + null)); + } + + /** + * This adds a property descriptor for the Target feature. + * + * + * @generated + */ + protected void addTargetPropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Request_target_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_Request_target_feature", "_UI_Request_type"), + SimplepdlPackage.Literals.REQUEST__TARGET, + true, + false, + true, + null, + null, + null)); + } + + /** + * This returns Request.gif. + * + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/Request")); + } + + /** + * This returns the label text for the adapted class. + * + * + * @generated + */ + @Override + public String getText(Object object) { + Request request = (Request)object; + return getString("_UI_Request_type") + " --" + request.getQuantity() + "--> " + request.getTarget().getName(); + } + + + /** + * 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}. + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(Request.class)) { + case SimplepdlPackage.REQUEST__QUANTITY: + 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. + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + + /** + * Return the resource locator for this item provider's resources. + * + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + return SimplePDLEditPlugin.INSTANCE; + } + +} diff --git a/fr.n7.simplePDL.edit/src/simplepdl/provider/ResourceItemProvider.java b/fr.n7.simplePDL.edit/src/simplepdl/provider/ResourceItemProvider.java new file mode 100644 index 0000000..e31e477 --- /dev/null +++ b/fr.n7.simplePDL.edit/src/simplepdl/provider/ResourceItemProvider.java @@ -0,0 +1,157 @@ +/** + */ +package simplepdl.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.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ViewerNotification; + +import simplepdl.Resource; +import simplepdl.SimplepdlPackage; + +/** + * This is the item provider adapter for a {@link simplepdl.Resource} object. + * + * + * @generated + */ +public class ResourceItemProvider extends ProcessElementItemProvider { + /** + * This constructs an instance from a factory and a notifier. + * + * + * @generated + */ + public ResourceItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addQuantityPropertyDescriptor(object); + addNamePropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Quantity feature. + * + * + * @generated + */ + protected void addQuantityPropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Resource_quantity_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_Resource_quantity_feature", "_UI_Resource_type"), + SimplepdlPackage.Literals.RESOURCE__QUANTITY, + true, + false, + false, + ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, + null, + null)); + } + + /** + * This adds a property descriptor for the Name feature. + * + * + * @generated + */ + protected void addNamePropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Resource_name_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_Resource_name_feature", "_UI_Resource_type"), + SimplepdlPackage.Literals.RESOURCE__NAME, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This returns Resource.gif. + * + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/Resource")); + } + + /** + * This returns the label text for the adapted class. + * + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((Resource)object).getName(); + int qty = ((Resource)object).getQuantity(); + return label == null || label.length() == 0 ? + getString("_UI_Resource_type") : + getString("_UI_Resource_type") + " " + label + "( " + qty + " )"; + } + + + /** + * 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}. + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(Resource.class)) { + case SimplepdlPackage.RESOURCE__QUANTITY: + case SimplepdlPackage.RESOURCE__NAME: + 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. + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + +} diff --git a/fr.n7.simplePDL.edit/src/simplepdl/provider/SimplePDLEditPlugin.java b/fr.n7.simplePDL.edit/src/simplepdl/provider/SimplePDLEditPlugin.java new file mode 100644 index 0000000..fe4b59e --- /dev/null +++ b/fr.n7.simplePDL.edit/src/simplepdl/provider/SimplePDLEditPlugin.java @@ -0,0 +1,89 @@ +/** + */ +package simplepdl.provider; + +import org.eclipse.emf.common.EMFPlugin; + +import org.eclipse.emf.common.util.ResourceLocator; + +/** + * This is the central singleton for the SimplePDL edit plugin. + * + * + * @generated + */ +public final class SimplePDLEditPlugin extends EMFPlugin { + /** + * Keep track of the singleton. + * + * + * @generated + */ + public static final SimplePDLEditPlugin INSTANCE = new SimplePDLEditPlugin(); + + /** + * Keep track of the singleton. + * + * + * @generated + */ + private static Implementation plugin; + + /** + * Create the instance. + * + * + * @generated + */ + public SimplePDLEditPlugin() { + super + (new ResourceLocator [] { + }); + } + + /** + * Returns the singleton instance of the Eclipse plugin. + * + * + * @return the singleton instance. + * @generated + */ + @Override + public ResourceLocator getPluginResourceLocator() { + return plugin; + } + + /** + * Returns the singleton instance of the Eclipse plugin. + * + * + * @return the singleton instance. + * @generated + */ + public static Implementation getPlugin() { + return plugin; + } + + /** + * The actual implementation of the Eclipse Plugin. + * + * + * @generated + */ + public static class Implementation extends EclipsePlugin { + /** + * Creates an instance. + * + * + * @generated + */ + public Implementation() { + super(); + + // Remember the static instance. + // + plugin = this; + } + } + +} diff --git a/fr.n7.simplePDL.edit/src/simplepdl/provider/SimplepdlItemProviderAdapterFactory.java b/fr.n7.simplePDL.edit/src/simplepdl/provider/SimplepdlItemProviderAdapterFactory.java new file mode 100644 index 0000000..b00d99a --- /dev/null +++ b/fr.n7.simplePDL.edit/src/simplepdl/provider/SimplepdlItemProviderAdapterFactory.java @@ -0,0 +1,319 @@ +/** + */ +package simplepdl.provider; + +import java.util.ArrayList; +import java.util.Collection; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.Notifier; + +import org.eclipse.emf.edit.provider.ChangeNotifier; +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.ComposedAdapterFactory; +import org.eclipse.emf.edit.provider.IChangeNotifier; +import org.eclipse.emf.edit.provider.IDisposable; +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.INotifyChangedListener; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; + +import simplepdl.util.SimplepdlAdapterFactory; + +/** + * This is the factory that is used to provide the interfaces needed to support Viewers. + * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}. + * The adapters also support Eclipse property sheets. + * Note that most of the adapters are shared among multiple instances. + * + * + * @generated + */ +public class SimplepdlItemProviderAdapterFactory extends SimplepdlAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable { + /** + * This keeps track of the root adapter factory that delegates to this adapter factory. + * + * + * @generated + */ + protected ComposedAdapterFactory parentAdapterFactory; + + /** + * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}. + * + * + * @generated + */ + protected IChangeNotifier changeNotifier = new ChangeNotifier(); + + /** + * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}. + * + * + * @generated + */ + protected Collection supportedTypes = new ArrayList(); + + /** + * This constructs an instance. + * + * + * @generated + */ + public SimplepdlItemProviderAdapterFactory() { + supportedTypes.add(IEditingDomainItemProvider.class); + supportedTypes.add(IStructuredItemContentProvider.class); + supportedTypes.add(ITreeItemContentProvider.class); + supportedTypes.add(IItemLabelProvider.class); + supportedTypes.add(IItemPropertySource.class); + } + + /** + * This keeps track of the one adapter used for all {@link simplepdl.WorkDefinition} instances. + * + * + * @generated + */ + protected WorkDefinitionItemProvider workDefinitionItemProvider; + + /** + * This creates an adapter for a {@link simplepdl.WorkDefinition}. + * + * + * @generated + */ + @Override + public Adapter createWorkDefinitionAdapter() { + if (workDefinitionItemProvider == null) { + workDefinitionItemProvider = new WorkDefinitionItemProvider(this); + } + + return workDefinitionItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link simplepdl.WorkSequence} instances. + * + * + * @generated + */ + protected WorkSequenceItemProvider workSequenceItemProvider; + + /** + * This creates an adapter for a {@link simplepdl.WorkSequence}. + * + * + * @generated + */ + @Override + public Adapter createWorkSequenceAdapter() { + if (workSequenceItemProvider == null) { + workSequenceItemProvider = new WorkSequenceItemProvider(this); + } + + return workSequenceItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link simplepdl.Guidance} instances. + * + * + * @generated + */ + protected GuidanceItemProvider guidanceItemProvider; + + /** + * This creates an adapter for a {@link simplepdl.Guidance}. + * + * + * @generated + */ + @Override + public Adapter createGuidanceAdapter() { + if (guidanceItemProvider == null) { + guidanceItemProvider = new GuidanceItemProvider(this); + } + + return guidanceItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link simplepdl.Process} instances. + * + * + * @generated + */ + protected ProcessItemProvider processItemProvider; + + /** + * This creates an adapter for a {@link simplepdl.Process}. + * + * + * @generated + */ + @Override + public Adapter createProcessAdapter() { + if (processItemProvider == null) { + processItemProvider = new ProcessItemProvider(this); + } + + return processItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link simplepdl.Request} instances. + * + * + * @generated + */ + protected RequestItemProvider requestItemProvider; + + /** + * This creates an adapter for a {@link simplepdl.Request}. + * + * + * @generated + */ + @Override + public Adapter createRequestAdapter() { + if (requestItemProvider == null) { + requestItemProvider = new RequestItemProvider(this); + } + + return requestItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link simplepdl.Resource} instances. + * + * + * @generated + */ + protected ResourceItemProvider resourceItemProvider; + + /** + * This creates an adapter for a {@link simplepdl.Resource}. + * + * + * @generated + */ + @Override + public Adapter createResourceAdapter() { + if (resourceItemProvider == null) { + resourceItemProvider = new ResourceItemProvider(this); + } + + return resourceItemProvider; + } + + /** + * This returns the root adapter factory that contains this factory. + * + * + * @generated + */ + public ComposeableAdapterFactory getRootAdapterFactory() { + return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory(); + } + + /** + * This sets the composed adapter factory that contains this factory. + * + * + * @generated + */ + public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) { + this.parentAdapterFactory = parentAdapterFactory; + } + + /** + * + * + * @generated + */ + @Override + public boolean isFactoryForType(Object type) { + return supportedTypes.contains(type) || super.isFactoryForType(type); + } + + /** + * This implementation substitutes the factory itself as the key for the adapter. + * + * + * @generated + */ + @Override + public Adapter adapt(Notifier notifier, Object type) { + return super.adapt(notifier, this); + } + + /** + * + * + * @generated + */ + @Override + public Object adapt(Object object, Object type) { + if (isFactoryForType(type)) { + Object adapter = super.adapt(object, type); + if (!(type instanceof Class) || (((Class)type).isInstance(adapter))) { + return adapter; + } + } + + return null; + } + + /** + * This adds a listener. + * + * + * @generated + */ + public void addListener(INotifyChangedListener notifyChangedListener) { + changeNotifier.addListener(notifyChangedListener); + } + + /** + * This removes a listener. + * + * + * @generated + */ + public void removeListener(INotifyChangedListener notifyChangedListener) { + changeNotifier.removeListener(notifyChangedListener); + } + + /** + * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}. + * + * + * @generated + */ + public void fireNotifyChanged(Notification notification) { + changeNotifier.fireNotifyChanged(notification); + + if (parentAdapterFactory != null) { + parentAdapterFactory.fireNotifyChanged(notification); + } + } + + /** + * This disposes all of the item providers created by this factory. + * + * + * @generated + */ + public void dispose() { + if (workDefinitionItemProvider != null) workDefinitionItemProvider.dispose(); + if (workSequenceItemProvider != null) workSequenceItemProvider.dispose(); + if (guidanceItemProvider != null) guidanceItemProvider.dispose(); + if (processItemProvider != null) processItemProvider.dispose(); + if (requestItemProvider != null) requestItemProvider.dispose(); + if (resourceItemProvider != null) resourceItemProvider.dispose(); + } + +} diff --git a/fr.n7.simplePDL.edit/src/simplepdl/provider/WorkDefinitionItemProvider.java b/fr.n7.simplePDL.edit/src/simplepdl/provider/WorkDefinitionItemProvider.java new file mode 100644 index 0000000..5ed7081 --- /dev/null +++ b/fr.n7.simplePDL.edit/src/simplepdl/provider/WorkDefinitionItemProvider.java @@ -0,0 +1,218 @@ +/** + */ +package simplepdl.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.ecore.EStructuralFeature; +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ViewerNotification; + +import simplepdl.SimplepdlFactory; +import simplepdl.SimplepdlPackage; +import simplepdl.WorkDefinition; + +/** + * This is the item provider adapter for a {@link simplepdl.WorkDefinition} object. + * + * + * @generated + */ +public class WorkDefinitionItemProvider extends ProcessElementItemProvider { + /** + * This constructs an instance from a factory and a notifier. + * + * + * @generated + */ + public WorkDefinitionItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addLinksToPredecessorsPropertyDescriptor(object); + addLinksToSuccessorsPropertyDescriptor(object); + addNamePropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Links To Predecessors feature. + * + * + * @generated + */ + protected void addLinksToPredecessorsPropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_WorkDefinition_linksToPredecessors_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_WorkDefinition_linksToPredecessors_feature", "_UI_WorkDefinition_type"), + SimplepdlPackage.Literals.WORK_DEFINITION__LINKS_TO_PREDECESSORS, + true, + false, + true, + null, + null, + null)); + } + + /** + * This adds a property descriptor for the Links To Successors feature. + * + * + * @generated + */ + protected void addLinksToSuccessorsPropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_WorkDefinition_linksToSuccessors_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_WorkDefinition_linksToSuccessors_feature", "_UI_WorkDefinition_type"), + SimplepdlPackage.Literals.WORK_DEFINITION__LINKS_TO_SUCCESSORS, + true, + false, + true, + null, + null, + null)); + } + + /** + * This adds a property descriptor for the Name feature. + * + * + * @generated + */ + protected void addNamePropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_WorkDefinition_name_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_WorkDefinition_name_feature", "_UI_WorkDefinition_type"), + SimplepdlPackage.Literals.WORK_DEFINITION__NAME, + 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 + * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. + * + * + * @generated + */ + @Override + public Collection getChildrenFeatures(Object object) { + if (childrenFeatures == null) { + super.getChildrenFeatures(object); + childrenFeatures.add(SimplepdlPackage.Literals.WORK_DEFINITION__REQUESTS); + } + return childrenFeatures; + } + + /** + * + * + * @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 returns WorkDefinition.gif. + * + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/WorkDefinition")); + } + + /** + * This returns the label text for the adapted class. + * + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((WorkDefinition)object).getName(); + return label == null || label.length() == 0 ? + getString("_UI_WorkDefinition_type") : + getString("_UI_WorkDefinition_type") + " " + label; + } + + + /** + * 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}. + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(WorkDefinition.class)) { + case SimplepdlPackage.WORK_DEFINITION__NAME: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + case SimplepdlPackage.WORK_DEFINITION__REQUESTS: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + + newChildDescriptors.add + (createChildParameter + (SimplepdlPackage.Literals.WORK_DEFINITION__REQUESTS, + SimplepdlFactory.eINSTANCE.createRequest())); + } + +} diff --git a/fr.n7.simplePDL.edit/src/simplepdl/provider/WorkSequenceItemProvider.java b/fr.n7.simplePDL.edit/src/simplepdl/provider/WorkSequenceItemProvider.java new file mode 100644 index 0000000..680995f --- /dev/null +++ b/fr.n7.simplePDL.edit/src/simplepdl/provider/WorkSequenceItemProvider.java @@ -0,0 +1,185 @@ +/** + */ +package simplepdl.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.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ViewerNotification; + +import simplepdl.SimplepdlPackage; +import simplepdl.WorkSequence; +import simplepdl.WorkSequenceType; + +/** + * This is the item provider adapter for a {@link simplepdl.WorkSequence} object. + * + * + * @generated + */ +public class WorkSequenceItemProvider extends ProcessElementItemProvider { + /** + * This constructs an instance from a factory and a notifier. + * + * + * @generated + */ + public WorkSequenceItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addLinkTypePropertyDescriptor(object); + addPredecessorPropertyDescriptor(object); + addSuccessorPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Link Type feature. + * + * + * @generated + */ + protected void addLinkTypePropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_WorkSequence_linkType_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_WorkSequence_linkType_feature", "_UI_WorkSequence_type"), + SimplepdlPackage.Literals.WORK_SEQUENCE__LINK_TYPE, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This adds a property descriptor for the Predecessor feature. + * + * + * @generated + */ + protected void addPredecessorPropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_WorkSequence_predecessor_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_WorkSequence_predecessor_feature", "_UI_WorkSequence_type"), + SimplepdlPackage.Literals.WORK_SEQUENCE__PREDECESSOR, + true, + false, + true, + null, + null, + null)); + } + + /** + * This adds a property descriptor for the Successor feature. + * + * + * @generated + */ + protected void addSuccessorPropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_WorkSequence_successor_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_WorkSequence_successor_feature", "_UI_WorkSequence_type"), + SimplepdlPackage.Literals.WORK_SEQUENCE__SUCCESSOR, + true, + false, + true, + null, + null, + null)); + } + + /** + * This returns WorkSequence.gif. + * + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/WorkSequence")); + } + + /** + * This returns the label text for the adapted class. + * + * + * @generated + */ + @Override + public String getText(Object object) { + WorkSequence ws = (WorkSequence) object; + WorkSequenceType labelValue = ws.getLinkType(); + String label = "--" + (labelValue == null ? "?" : labelValue.toString()) + "-->"; + String previous = ws.getPredecessor() == null ? "?" : ws.getPredecessor().getName(); + String next = ws.getSuccessor() == null ? "?" : ws.getSuccessor().getName(); + return label == null || label.length() == 0 ? + getString("_UI_WorkSequence_type") : + getString("_UI_WorkSequence_type") + " " + previous + " " + label + " " + next; + } + + + /** + * 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}. + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(WorkSequence.class)) { + case SimplepdlPackage.WORK_SEQUENCE__PREDECESSOR: + case SimplepdlPackage.WORK_SEQUENCE__SUCCESSOR: + case SimplepdlPackage.WORK_SEQUENCE__LINK_TYPE: + 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. + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + +} diff --git a/fr.n7.simplePDL.editor/.classpath b/fr.n7.simplePDL.editor/.classpath new file mode 100644 index 0000000..c3ba59e --- /dev/null +++ b/fr.n7.simplePDL.editor/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/fr.n7.simplePDL.editor/.project b/fr.n7.simplePDL.editor/.project new file mode 100644 index 0000000..c784caa --- /dev/null +++ b/fr.n7.simplePDL.editor/.project @@ -0,0 +1,28 @@ + + + fr.n7.simplePDL.editor + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + diff --git a/fr.n7.simplePDL.editor/META-INF/MANIFEST.MF b/fr.n7.simplePDL.editor/META-INF/MANIFEST.MF new file mode 100644 index 0000000..57fd036 --- /dev/null +++ b/fr.n7.simplePDL.editor/META-INF/MANIFEST.MF @@ -0,0 +1,19 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: fr.n7.simplePDL.editor;singleton:=true +Automatic-Module-Name: fr.n7.simplePDL.editor +Bundle-Version: 1.0.0.qualifier +Bundle-ClassPath: . +Bundle-Activator: simplepdl.presentation.SimplePDLEditorPlugin$Implementation +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Export-Package: simplepdl.presentation +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.core.resources;visibility:=reexport, + fr.n7.simplePDL.edit;visibility:=reexport, + org.eclipse.emf.ecore.xmi;visibility:=reexport, + org.eclipse.emf.edit.ui;visibility:=reexport, + org.eclipse.ui.ide;visibility:=reexport +Bundle-ActivationPolicy: lazy diff --git a/fr.n7.simplePDL.editor/build.properties b/fr.n7.simplePDL.editor/build.properties new file mode 100644 index 0000000..5fb0771 --- /dev/null +++ b/fr.n7.simplePDL.editor/build.properties @@ -0,0 +1,10 @@ +# + +bin.includes = .,\ + icons/,\ + META-INF/,\ + plugin.xml,\ + plugin.properties +jars.compile.order = . +source.. = src/ +output.. = bin diff --git a/fr.n7.simplePDL.editor/icons/full/obj16/SimplepdlModelFile.gif b/fr.n7.simplePDL.editor/icons/full/obj16/SimplepdlModelFile.gif new file mode 100644 index 0000000..8b3ad80 Binary files /dev/null and b/fr.n7.simplePDL.editor/icons/full/obj16/SimplepdlModelFile.gif differ diff --git a/fr.n7.simplePDL.editor/icons/full/wizban/NewSimplepdl.gif b/fr.n7.simplePDL.editor/icons/full/wizban/NewSimplepdl.gif new file mode 100644 index 0000000..33f212f Binary files /dev/null and b/fr.n7.simplePDL.editor/icons/full/wizban/NewSimplepdl.gif differ diff --git a/fr.n7.simplePDL.editor/plugin.properties b/fr.n7.simplePDL.editor/plugin.properties new file mode 100644 index 0000000..715e9a2 --- /dev/null +++ b/fr.n7.simplePDL.editor/plugin.properties @@ -0,0 +1,53 @@ +# + +pluginName = SimplePDL Model Editor +providerName = www.example.org + +_UI_SimplepdlEditor_menu = &Simplepdl Editor + +_UI_CreateChild_menu_item = &New Child +_UI_CreateSibling_menu_item = N&ew Sibling + +_UI_ShowPropertiesView_menu_item = Show &Properties View +_UI_RefreshViewer_menu_item = &Refresh + +_UI_SelectionPage_label = Selection +_UI_ParentPage_label = Parent +_UI_ListPage_label = List +_UI_TreePage_label = Tree +_UI_TablePage_label = Table +_UI_TreeWithColumnsPage_label = Tree with Columns +_UI_ObjectColumn_label = Object +_UI_SelfColumn_label = Self + +_UI_NoObjectSelected = Selected Nothing +_UI_SingleObjectSelected = Selected Object: {0} +_UI_MultiObjectSelected = Selected {0} Objects + +_UI_OpenEditorError_label = Open Editor + +_UI_Wizard_category = Example EMF Model Creation Wizards + +_UI_CreateModelError_message = Problems encountered in file "{0}" + +_UI_SimplepdlModelWizard_label = Simplepdl Model +_UI_SimplepdlModelWizard_description = Create a new Simplepdl model + +_UI_SimplepdlEditor_label = Simplepdl Model Editor + +_UI_SimplepdlEditorFilenameDefaultBase = My +_UI_SimplepdlEditorFilenameExtensions = simplepdl + +_UI_Wizard_label = New + +_WARN_FilenameExtension = The file name must end in ''.{0}'' +_WARN_FilenameExtensions = The file name must have one of the following extensions: {0} + +_UI_ModelObject = &Model Object +_UI_XMLEncoding = &XML Encoding +_UI_XMLEncodingChoices = UTF-8 ASCII UTF-16 UTF-16BE UTF-16LE ISO-8859-1 +_UI_Wizard_initial_object_description = Select a model object to create + +_UI_FileConflict_label = File Conflict +_WARN_FileConflict = There are unsaved changes that conflict with changes made outside the editor. Do you wish to discard this editor's changes? + diff --git a/fr.n7.simplePDL.editor/plugin.xml b/fr.n7.simplePDL.editor/plugin.xml new file mode 100644 index 0000000..c3303ce --- /dev/null +++ b/fr.n7.simplePDL.editor/plugin.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + %_UI_SimplepdlModelWizard_description + + + + + + + + + + + diff --git a/fr.n7.simplePDL.editor/src/simplepdl/presentation/SimplePDLEditorPlugin.java b/fr.n7.simplePDL.editor/src/simplepdl/presentation/SimplePDLEditorPlugin.java new file mode 100644 index 0000000..0b54b17 --- /dev/null +++ b/fr.n7.simplePDL.editor/src/simplepdl/presentation/SimplePDLEditorPlugin.java @@ -0,0 +1,91 @@ +/** + */ +package simplepdl.presentation; + +import org.eclipse.emf.common.EMFPlugin; + +import org.eclipse.emf.common.ui.EclipseUIPlugin; + +import org.eclipse.emf.common.util.ResourceLocator; + +/** + * This is the central singleton for the SimplePDL editor plugin. + * + * + * @generated + */ +public final class SimplePDLEditorPlugin extends EMFPlugin { + /** + * Keep track of the singleton. + * + * + * @generated + */ + public static final SimplePDLEditorPlugin INSTANCE = new SimplePDLEditorPlugin(); + + /** + * Keep track of the singleton. + * + * + * @generated + */ + private static Implementation plugin; + + /** + * Create the instance. + * + * + * @generated + */ + public SimplePDLEditorPlugin() { + super + (new ResourceLocator [] { + }); + } + + /** + * Returns the singleton instance of the Eclipse plugin. + * + * + * @return the singleton instance. + * @generated + */ + @Override + public ResourceLocator getPluginResourceLocator() { + return plugin; + } + + /** + * Returns the singleton instance of the Eclipse plugin. + * + * + * @return the singleton instance. + * @generated + */ + public static Implementation getPlugin() { + return plugin; + } + + /** + * The actual implementation of the Eclipse Plugin. + * + * + * @generated + */ + public static class Implementation extends EclipseUIPlugin { + /** + * Creates an instance. + * + * + * @generated + */ + public Implementation() { + super(); + + // Remember the static instance. + // + plugin = this; + } + } + +} diff --git a/fr.n7.simplePDL.editor/src/simplepdl/presentation/SimplepdlActionBarContributor.java b/fr.n7.simplePDL.editor/src/simplepdl/presentation/SimplepdlActionBarContributor.java new file mode 100644 index 0000000..aa0c7c9 --- /dev/null +++ b/fr.n7.simplePDL.editor/src/simplepdl/presentation/SimplepdlActionBarContributor.java @@ -0,0 +1,424 @@ +/** + */ +package simplepdl.presentation; + +import java.util.ArrayList; +import java.util.Collection; + +import org.eclipse.emf.common.ui.viewer.IViewerProvider; + +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.edit.domain.IEditingDomainProvider; + +import org.eclipse.emf.edit.ui.action.ControlAction; +import org.eclipse.emf.edit.ui.action.CreateChildAction; +import org.eclipse.emf.edit.ui.action.CreateSiblingAction; +import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; +import org.eclipse.emf.edit.ui.action.LoadResourceAction; +import org.eclipse.emf.edit.ui.action.ValidateAction; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.ActionContributionItem; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.action.IContributionItem; +import org.eclipse.jface.action.IContributionManager; +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.jface.action.SubContributionItem; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.Viewer; + +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.PartInitException; + +/** + * This is the action bar contributor for the Simplepdl model editor. + * + * + * @generated + */ +public class SimplepdlActionBarContributor + extends EditingDomainActionBarContributor + implements ISelectionChangedListener { + /** + * This keeps track of the active editor. + * + * + * @generated + */ + protected IEditorPart activeEditorPart; + + /** + * This keeps track of the current selection provider. + * + * + * @generated + */ + protected ISelectionProvider selectionProvider; + + /** + * This action opens the Properties view. + * + * + * @generated + */ + protected IAction showPropertiesViewAction = + new Action(SimplePDLEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) { + @Override + public void run() { + try { + getPage().showView("org.eclipse.ui.views.PropertySheet"); + } + catch (PartInitException exception) { + SimplePDLEditorPlugin.INSTANCE.log(exception); + } + } + }; + + /** + * This action refreshes the viewer of the current editor if the editor + * implements {@link org.eclipse.emf.common.ui.viewer.IViewerProvider}. + * + * + * @generated + */ + protected IAction refreshViewerAction = + new Action(SimplePDLEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) { + @Override + public boolean isEnabled() { + return activeEditorPart instanceof IViewerProvider; + } + + @Override + public void run() { + if (activeEditorPart instanceof IViewerProvider) { + Viewer viewer = ((IViewerProvider)activeEditorPart).getViewer(); + if (viewer != null) { + viewer.refresh(); + } + } + } + }; + + /** + * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateChildAction} corresponding to each descriptor + * generated for the current selection by the item provider. + * + * + * @generated + */ + protected Collection createChildActions; + + /** + * This is the menu manager into which menu contribution items should be added for CreateChild actions. + * + * + * @generated + */ + protected IMenuManager createChildMenuManager; + + /** + * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} corresponding to each descriptor + * generated for the current selection by the item provider. + * + * + * @generated + */ + protected Collection createSiblingActions; + + /** + * This is the menu manager into which menu contribution items should be added for CreateSibling actions. + * + * + * @generated + */ + protected IMenuManager createSiblingMenuManager; + + /** + * This creates an instance of the contributor. + * + * + * @generated + */ + public SimplepdlActionBarContributor() { + super(ADDITIONS_LAST_STYLE); + loadResourceAction = new LoadResourceAction(); + validateAction = new ValidateAction(); + controlAction = new ControlAction(); + } + + /** + * This adds Separators for editor additions to the tool bar. + * + * + * @generated + */ + @Override + public void contributeToToolBar(IToolBarManager toolBarManager) { + super.contributeToToolBar(toolBarManager); + toolBarManager.add(new Separator("simplepdl-settings")); + toolBarManager.add(new Separator("simplepdl-additions")); + } + + /** + * This adds to the menu bar a menu and some separators for editor additions, + * as well as the sub-menus for object creation items. + * + * + * @generated + */ + @Override + public void contributeToMenu(IMenuManager menuManager) { + super.contributeToMenu(menuManager); + + IMenuManager submenuManager = new MenuManager(SimplePDLEditorPlugin.INSTANCE.getString("_UI_SimplepdlEditor_menu"), "simplepdlMenuID"); + menuManager.insertAfter("additions", submenuManager); + submenuManager.add(new Separator("settings")); + submenuManager.add(new Separator("actions")); + submenuManager.add(new Separator("additions")); + submenuManager.add(new Separator("additions-end")); + + // Prepare for CreateChild item addition or removal. + // + createChildMenuManager = new MenuManager(SimplePDLEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item")); + submenuManager.insertBefore("additions", createChildMenuManager); + + // Prepare for CreateSibling item addition or removal. + // + createSiblingMenuManager = new MenuManager(SimplePDLEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item")); + submenuManager.insertBefore("additions", createSiblingMenuManager); + + // Force an update because Eclipse hides empty menus now. + // + submenuManager.addMenuListener + (new IMenuListener() { + public void menuAboutToShow(IMenuManager menuManager) { + menuManager.updateAll(true); + } + }); + + addGlobalActions(submenuManager); + } + + /** + * When the active editor changes, this remembers the change and registers with it as a selection provider. + * + * + * @generated + */ + @Override + public void setActiveEditor(IEditorPart part) { + super.setActiveEditor(part); + activeEditorPart = part; + + // Switch to the new selection provider. + // + if (selectionProvider != null) { + selectionProvider.removeSelectionChangedListener(this); + } + if (part == null) { + selectionProvider = null; + } + else { + selectionProvider = part.getSite().getSelectionProvider(); + selectionProvider.addSelectionChangedListener(this); + + // Fake a selection changed event to update the menus. + // + if (selectionProvider.getSelection() != null) { + selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection())); + } + } + } + + /** + * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, + * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings + * that can be added to the selected object and updating the menus accordingly. + * + * + * @generated + */ + public void selectionChanged(SelectionChangedEvent event) { + // Remove any menu items for old selection. + // + if (createChildMenuManager != null) { + depopulateManager(createChildMenuManager, createChildActions); + } + if (createSiblingMenuManager != null) { + depopulateManager(createSiblingMenuManager, createSiblingActions); + } + + // Query the new selection for appropriate new child/sibling descriptors + // + Collection newChildDescriptors = null; + Collection newSiblingDescriptors = null; + + ISelection selection = event.getSelection(); + if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1) { + Object object = ((IStructuredSelection)selection).getFirstElement(); + + EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain(); + + newChildDescriptors = domain.getNewChildDescriptors(object, null); + newSiblingDescriptors = domain.getNewChildDescriptors(null, object); + } + + // Generate actions for selection; populate and redraw the menus. + // + createChildActions = generateCreateChildActions(newChildDescriptors, selection); + createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection); + + if (createChildMenuManager != null) { + populateManager(createChildMenuManager, createChildActions, null); + createChildMenuManager.update(true); + } + if (createSiblingMenuManager != null) { + populateManager(createSiblingMenuManager, createSiblingActions, null); + createSiblingMenuManager.update(true); + } + } + + /** + * This generates a {@link org.eclipse.emf.edit.ui.action.CreateChildAction} for each object in descriptors, + * and returns the collection of these actions. + * + * + * @generated + */ + protected Collection generateCreateChildActions(Collection descriptors, ISelection selection) { + Collection actions = new ArrayList(); + if (descriptors != null) { + for (Object descriptor : descriptors) { + actions.add(new CreateChildAction(activeEditorPart, selection, descriptor)); + } + } + return actions; + } + + /** + * This generates a {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} for each object in descriptors, + * and returns the collection of these actions. + * + * + * @generated + */ + protected Collection generateCreateSiblingActions(Collection descriptors, ISelection selection) { + Collection actions = new ArrayList(); + if (descriptors != null) { + for (Object descriptor : descriptors) { + actions.add(new CreateSiblingAction(activeEditorPart, selection, descriptor)); + } + } + return actions; + } + + /** + * This populates the specified manager with {@link org.eclipse.jface.action.ActionContributionItem}s + * based on the {@link org.eclipse.jface.action.IAction}s contained in the actions collection, + * by inserting them before the specified contribution item contributionID. + * If contributionID is null, they are simply added. + * + * + * @generated + */ + protected void populateManager(IContributionManager manager, Collection actions, String contributionID) { + if (actions != null) { + for (IAction action : actions) { + if (contributionID != null) { + manager.insertBefore(contributionID, action); + } + else { + manager.add(action); + } + } + } + } + + /** + * This removes from the specified manager all {@link org.eclipse.jface.action.ActionContributionItem}s + * based on the {@link org.eclipse.jface.action.IAction}s contained in the actions collection. + * + * + * @generated + */ + protected void depopulateManager(IContributionManager manager, Collection actions) { + if (actions != null) { + IContributionItem[] items = manager.getItems(); + for (int i = 0; i < items.length; i++) { + // Look into SubContributionItems + // + IContributionItem contributionItem = items[i]; + while (contributionItem instanceof SubContributionItem) { + contributionItem = ((SubContributionItem)contributionItem).getInnerItem(); + } + + // Delete the ActionContributionItems with matching action. + // + if (contributionItem instanceof ActionContributionItem) { + IAction action = ((ActionContributionItem)contributionItem).getAction(); + if (actions.contains(action)) { + manager.remove(contributionItem); + } + } + } + } + } + + /** + * This populates the pop-up menu before it appears. + * + * + * @generated + */ + @Override + public void menuAboutToShow(IMenuManager menuManager) { + super.menuAboutToShow(menuManager); + MenuManager submenuManager = null; + + submenuManager = new MenuManager(SimplePDLEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item")); + populateManager(submenuManager, createChildActions, null); + menuManager.insertBefore("edit", submenuManager); + + submenuManager = new MenuManager(SimplePDLEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item")); + populateManager(submenuManager, createSiblingActions, null); + menuManager.insertBefore("edit", submenuManager); + } + + /** + * This inserts global actions before the "additions-end" separator. + * + * + * @generated + */ + @Override + protected void addGlobalActions(IMenuManager menuManager) { + menuManager.insertAfter("additions-end", new Separator("ui-actions")); + menuManager.insertAfter("ui-actions", showPropertiesViewAction); + + refreshViewerAction.setEnabled(refreshViewerAction.isEnabled()); + menuManager.insertAfter("ui-actions", refreshViewerAction); + + super.addGlobalActions(menuManager); + } + + /** + * This ensures that a delete action will clean up all references to deleted objects. + * + * + * @generated + */ + @Override + protected boolean removeAllReferencesOnDelete() { + return true; + } + +} diff --git a/fr.n7.simplePDL.editor/src/simplepdl/presentation/SimplepdlEditor.java b/fr.n7.simplePDL.editor/src/simplepdl/presentation/SimplepdlEditor.java new file mode 100644 index 0000000..ff9caba --- /dev/null +++ b/fr.n7.simplePDL.editor/src/simplepdl/presentation/SimplepdlEditor.java @@ -0,0 +1,1823 @@ +/** + */ +package simplepdl.presentation; + + +import java.io.IOException; +import java.io.InputStream; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.EventObject; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IResourceChangeEvent; +import org.eclipse.core.resources.IResourceChangeListener; +import org.eclipse.core.resources.IResourceDelta; +import org.eclipse.core.resources.IResourceDeltaVisitor; +import org.eclipse.core.resources.ResourcesPlugin; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; + +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.IStatusLineManager; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; + +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; + +import org.eclipse.jface.util.LocalSelectionTransfer; + +import org.eclipse.jface.viewers.ColumnWeightData; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ListViewer; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.StructuredViewer; +import org.eclipse.jface.viewers.TableLayout; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.Viewer; + +import org.eclipse.swt.SWT; + +import org.eclipse.swt.custom.CTabFolder; + +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.FileTransfer; +import org.eclipse.swt.dnd.Transfer; + +import org.eclipse.swt.events.ControlAdapter; +import org.eclipse.swt.events.ControlEvent; + +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; + +import org.eclipse.swt.layout.FillLayout; + +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.swt.widgets.TreeColumn; + +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.IPartListener; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.PartInitException; + +import org.eclipse.ui.dialogs.SaveAsDialog; + +import org.eclipse.ui.ide.IGotoMarker; + +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.part.MultiPageEditorPart; + +import org.eclipse.ui.views.contentoutline.ContentOutline; +import org.eclipse.ui.views.contentoutline.ContentOutlinePage; +import org.eclipse.ui.views.contentoutline.IContentOutlinePage; + +import org.eclipse.ui.views.properties.IPropertySheetPage; +import org.eclipse.ui.views.properties.PropertySheet; +import org.eclipse.ui.views.properties.PropertySheetPage; + +import org.eclipse.emf.common.command.BasicCommandStack; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.command.CommandStack; +import org.eclipse.emf.common.command.CommandStackListener; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.common.ui.MarkerHelper; +import org.eclipse.emf.common.ui.ViewerPane; + +import org.eclipse.emf.common.ui.editor.ProblemEditorPart; + +import org.eclipse.emf.common.ui.viewer.IViewerProvider; + +import org.eclipse.emf.common.util.BasicDiagnostic; +import org.eclipse.emf.common.util.Diagnostic; +import org.eclipse.emf.common.util.URI; + + +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; + +import org.eclipse.emf.ecore.util.EContentAdapter; +import org.eclipse.emf.ecore.util.EcoreUtil; + +import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.edit.domain.IEditingDomainProvider; + +import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator; +import org.eclipse.emf.edit.provider.ComposedAdapterFactory; +import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory; + +import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory; + +import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; + +import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor; + +import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter; +import org.eclipse.emf.edit.ui.dnd.LocalTransfer; +import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter; + +import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; +import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; +import org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider; + +import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper; +import org.eclipse.emf.edit.ui.util.EditUIUtil; + +import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage; + +import simplepdl.provider.SimplepdlItemProviderAdapterFactory; + +import org.eclipse.ui.actions.WorkspaceModifyOperation; + + +/** + * This is an example of a Simplepdl model editor. + * + * + * @generated + */ +public class SimplepdlEditor + extends MultiPageEditorPart + implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker { + /** + * This keeps track of the editing domain that is used to track all changes to the model. + * + * + * @generated + */ + protected AdapterFactoryEditingDomain editingDomain; + + /** + * This is the one adapter factory used for providing views of the model. + * + * + * @generated + */ + protected ComposedAdapterFactory adapterFactory; + + /** + * This is the content outline page. + * + * + * @generated + */ + protected IContentOutlinePage contentOutlinePage; + + /** + * This is a kludge... + * + * + * @generated + */ + protected IStatusLineManager contentOutlineStatusLineManager; + + /** + * This is the content outline page's viewer. + * + * + * @generated + */ + protected TreeViewer contentOutlineViewer; + + /** + * This is the property sheet page. + * + * + * @generated + */ + protected List propertySheetPages = new ArrayList(); + + /** + * This is the viewer that shadows the selection in the content outline. + * The parent relation must be correctly defined for this to work. + * + * + * @generated + */ + protected TreeViewer selectionViewer; + + /** + * This inverts the roll of parent and child in the content provider and show parents as a tree. + * + * + * @generated + */ + protected TreeViewer parentViewer; + + /** + * This shows how a tree view works. + * + * + * @generated + */ + protected TreeViewer treeViewer; + + /** + * This shows how a list view works. + * A list viewer doesn't support icons. + * + * + * @generated + */ + protected ListViewer listViewer; + + /** + * This shows how a table view works. + * A table can be used as a list with icons. + * + * + * @generated + */ + protected TableViewer tableViewer; + + /** + * This shows how a tree view with columns works. + * + * + * @generated + */ + protected TreeViewer treeViewerWithColumns; + + /** + * This keeps track of the active viewer pane, in the book. + * + * + * @generated + */ + protected ViewerPane currentViewerPane; + + /** + * This keeps track of the active content viewer, which may be either one of the viewers in the pages or the content outline viewer. + * + * + * @generated + */ + protected Viewer currentViewer; + + /** + * This listens to which ever viewer is active. + * + * + * @generated + */ + protected ISelectionChangedListener selectionChangedListener; + + /** + * This keeps track of all the {@link org.eclipse.jface.viewers.ISelectionChangedListener}s that are listening to this editor. + * + * + * @generated + */ + protected Collection selectionChangedListeners = new ArrayList(); + + /** + * This keeps track of the selection of the editor as a whole. + * + * + * @generated + */ + protected ISelection editorSelection = StructuredSelection.EMPTY; + + /** + * The MarkerHelper is responsible for creating workspace resource markers presented + * in Eclipse's Problems View. + * + * + * @generated + */ + protected MarkerHelper markerHelper = new EditUIMarkerHelper(); + + /** + * This listens for when the outline becomes active + * + * + * @generated + */ + protected IPartListener partListener = + new IPartListener() { + public void partActivated(IWorkbenchPart p) { + if (p instanceof ContentOutline) { + if (((ContentOutline)p).getCurrentPage() == contentOutlinePage) { + getActionBarContributor().setActiveEditor(SimplepdlEditor.this); + + setCurrentViewer(contentOutlineViewer); + } + } + else if (p instanceof PropertySheet) { + if (propertySheetPages.contains(((PropertySheet)p).getCurrentPage())) { + getActionBarContributor().setActiveEditor(SimplepdlEditor.this); + handleActivate(); + } + } + else if (p == SimplepdlEditor.this) { + handleActivate(); + } + } + public void partBroughtToTop(IWorkbenchPart p) { + // Ignore. + } + public void partClosed(IWorkbenchPart p) { + // Ignore. + } + public void partDeactivated(IWorkbenchPart p) { + // Ignore. + } + public void partOpened(IWorkbenchPart p) { + // Ignore. + } + }; + + /** + * Resources that have been removed since last activation. + * + * + * @generated + */ + protected Collection removedResources = new ArrayList(); + + /** + * Resources that have been changed since last activation. + * + * + * @generated + */ + protected Collection changedResources = new ArrayList(); + + /** + * Resources that have been saved. + * + * + * @generated + */ + protected Collection savedResources = new ArrayList(); + + /** + * Map to store the diagnostic associated with a resource. + * + * + * @generated + */ + protected Map resourceToDiagnosticMap = new LinkedHashMap(); + + /** + * Controls whether the problem indication should be updated. + * + * + * @generated + */ + protected boolean updateProblemIndication = true; + + /** + * Adapter used to update the problem indication when resources are demanded loaded. + * + * + * @generated + */ + protected EContentAdapter problemIndicationAdapter = + new EContentAdapter() { + protected boolean dispatching; + + @Override + public void notifyChanged(Notification notification) { + if (notification.getNotifier() instanceof Resource) { + switch (notification.getFeatureID(Resource.class)) { + case Resource.RESOURCE__IS_LOADED: + case Resource.RESOURCE__ERRORS: + case Resource.RESOURCE__WARNINGS: { + Resource resource = (Resource)notification.getNotifier(); + Diagnostic diagnostic = analyzeResourceProblems(resource, null); + if (diagnostic.getSeverity() != Diagnostic.OK) { + resourceToDiagnosticMap.put(resource, diagnostic); + } + else { + resourceToDiagnosticMap.remove(resource); + } + dispatchUpdateProblemIndication(); + break; + } + } + } + else { + super.notifyChanged(notification); + } + } + + protected void dispatchUpdateProblemIndication() { + if (updateProblemIndication && !dispatching) { + dispatching = true; + getSite().getShell().getDisplay().asyncExec + (new Runnable() { + public void run() { + dispatching = false; + updateProblemIndication(); + } + }); + } + } + + @Override + protected void setTarget(Resource target) { + basicSetTarget(target); + } + + @Override + protected void unsetTarget(Resource target) { + basicUnsetTarget(target); + resourceToDiagnosticMap.remove(target); + dispatchUpdateProblemIndication(); + } + }; + + /** + * This listens for workspace changes. + * + * + * @generated + */ + protected IResourceChangeListener resourceChangeListener = + new IResourceChangeListener() { + public void resourceChanged(IResourceChangeEvent event) { + IResourceDelta delta = event.getDelta(); + try { + class ResourceDeltaVisitor implements IResourceDeltaVisitor { + protected ResourceSet resourceSet = editingDomain.getResourceSet(); + protected Collection changedResources = new ArrayList(); + protected Collection removedResources = new ArrayList(); + + public boolean visit(IResourceDelta delta) { + if (delta.getResource().getType() == IResource.FILE) { + if (delta.getKind() == IResourceDelta.REMOVED || + delta.getKind() == IResourceDelta.CHANGED && delta.getFlags() != IResourceDelta.MARKERS) { + Resource resource = resourceSet.getResource(URI.createPlatformResourceURI(delta.getFullPath().toString(), true), false); + if (resource != null) { + if (delta.getKind() == IResourceDelta.REMOVED) { + removedResources.add(resource); + } + else if (!savedResources.remove(resource)) { + changedResources.add(resource); + } + } + } + return false; + } + + return true; + } + + public Collection getChangedResources() { + return changedResources; + } + + public Collection getRemovedResources() { + return removedResources; + } + } + + final ResourceDeltaVisitor visitor = new ResourceDeltaVisitor(); + delta.accept(visitor); + + if (!visitor.getRemovedResources().isEmpty()) { + getSite().getShell().getDisplay().asyncExec + (new Runnable() { + public void run() { + removedResources.addAll(visitor.getRemovedResources()); + if (!isDirty()) { + getSite().getPage().closeEditor(SimplepdlEditor.this, false); + } + } + }); + } + + if (!visitor.getChangedResources().isEmpty()) { + getSite().getShell().getDisplay().asyncExec + (new Runnable() { + public void run() { + changedResources.addAll(visitor.getChangedResources()); + if (getSite().getPage().getActiveEditor() == SimplepdlEditor.this) { + handleActivate(); + } + } + }); + } + } + catch (CoreException exception) { + SimplePDLEditorPlugin.INSTANCE.log(exception); + } + } + }; + + /** + * Handles activation of the editor or it's associated views. + * + * + * @generated + */ + protected void handleActivate() { + // Recompute the read only state. + // + if (editingDomain.getResourceToReadOnlyMap() != null) { + editingDomain.getResourceToReadOnlyMap().clear(); + + // Refresh any actions that may become enabled or disabled. + // + setSelection(getSelection()); + } + + if (!removedResources.isEmpty()) { + if (handleDirtyConflict()) { + getSite().getPage().closeEditor(SimplepdlEditor.this, false); + } + else { + removedResources.clear(); + changedResources.clear(); + savedResources.clear(); + } + } + else if (!changedResources.isEmpty()) { + changedResources.removeAll(savedResources); + handleChangedResources(); + changedResources.clear(); + savedResources.clear(); + } + } + + /** + * Handles what to do with changed resources on activation. + * + * + * @generated + */ + protected void handleChangedResources() { + if (!changedResources.isEmpty() && (!isDirty() || handleDirtyConflict())) { + ResourceSet resourceSet = editingDomain.getResourceSet(); + if (isDirty()) { + changedResources.addAll(resourceSet.getResources()); + } + editingDomain.getCommandStack().flush(); + + updateProblemIndication = false; + for (Resource resource : changedResources) { + if (resource.isLoaded()) { + resource.unload(); + try { + resource.load(resourceSet.getLoadOptions()); + } + catch (IOException exception) { + if (!resourceToDiagnosticMap.containsKey(resource)) { + resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); + } + } + } + } + + if (AdapterFactoryEditingDomain.isStale(editorSelection)) { + setSelection(StructuredSelection.EMPTY); + } + + updateProblemIndication = true; + updateProblemIndication(); + } + } + + /** + * Updates the problems indication with the information described in the specified diagnostic. + * + * + * @generated + */ + protected void updateProblemIndication() { + if (updateProblemIndication) { + BasicDiagnostic diagnostic = + new BasicDiagnostic + (Diagnostic.OK, + "fr.n7.simplePDL.editor", + 0, + null, + new Object [] { editingDomain.getResourceSet() }); + for (Diagnostic childDiagnostic : resourceToDiagnosticMap.values()) { + if (childDiagnostic.getSeverity() != Diagnostic.OK) { + diagnostic.add(childDiagnostic); + } + } + + int lastEditorPage = getPageCount() - 1; + if (lastEditorPage >= 0 && getEditor(lastEditorPage) instanceof ProblemEditorPart) { + ((ProblemEditorPart)getEditor(lastEditorPage)).setDiagnostic(diagnostic); + if (diagnostic.getSeverity() != Diagnostic.OK) { + setActivePage(lastEditorPage); + } + } + else if (diagnostic.getSeverity() != Diagnostic.OK) { + ProblemEditorPart problemEditorPart = new ProblemEditorPart(); + problemEditorPart.setDiagnostic(diagnostic); + problemEditorPart.setMarkerHelper(markerHelper); + try { + addPage(++lastEditorPage, problemEditorPart, getEditorInput()); + setPageText(lastEditorPage, problemEditorPart.getPartName()); + setActivePage(lastEditorPage); + showTabs(); + } + catch (PartInitException exception) { + SimplePDLEditorPlugin.INSTANCE.log(exception); + } + } + + if (markerHelper.hasMarkers(editingDomain.getResourceSet())) { + try { + markerHelper.updateMarkers(diagnostic); + } + catch (CoreException exception) { + SimplePDLEditorPlugin.INSTANCE.log(exception); + } + } + } + } + + /** + * Shows a dialog that asks if conflicting changes should be discarded. + * + * + * @generated + */ + protected boolean handleDirtyConflict() { + return + MessageDialog.openQuestion + (getSite().getShell(), + getString("_UI_FileConflict_label"), + getString("_WARN_FileConflict")); + } + + /** + * This creates a model editor. + * + * + * @generated + */ + public SimplepdlEditor() { + super(); + initializeEditingDomain(); + } + + /** + * This sets up the editing domain for the model editor. + * + * + * @generated + */ + protected void initializeEditingDomain() { + // Create an adapter factory that yields item providers. + // + adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE); + + adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory()); + adapterFactory.addAdapterFactory(new SimplepdlItemProviderAdapterFactory()); + adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory()); + + // Create the command stack that will notify this editor as commands are executed. + // + BasicCommandStack commandStack = new BasicCommandStack(); + + // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus. + // + commandStack.addCommandStackListener + (new CommandStackListener() { + public void commandStackChanged(final EventObject event) { + getContainer().getDisplay().asyncExec + (new Runnable() { + public void run() { + firePropertyChange(IEditorPart.PROP_DIRTY); + + // Try to select the affected objects. + // + Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand(); + if (mostRecentCommand != null) { + setSelectionToViewer(mostRecentCommand.getAffectedObjects()); + } + for (Iterator i = propertySheetPages.iterator(); i.hasNext(); ) { + PropertySheetPage propertySheetPage = i.next(); + if (propertySheetPage.getControl() == null || propertySheetPage.getControl().isDisposed()) { + i.remove(); + } + else { + propertySheetPage.refresh(); + } + } + } + }); + } + }); + + // Create the editing domain with a special command stack. + // + editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap()); + } + + /** + * This is here for the listener to be able to call it. + * + * + * @generated + */ + @Override + protected void firePropertyChange(int action) { + super.firePropertyChange(action); + } + + /** + * This sets the selection into whichever viewer is active. + * + * + * @generated + */ + public void setSelectionToViewer(Collection collection) { + final Collection theSelection = collection; + // Make sure it's okay. + // + if (theSelection != null && !theSelection.isEmpty()) { + Runnable runnable = + new Runnable() { + public void run() { + // Try to select the items in the current content viewer of the editor. + // + if (currentViewer != null) { + currentViewer.setSelection(new StructuredSelection(theSelection.toArray()), true); + } + } + }; + getSite().getShell().getDisplay().asyncExec(runnable); + } + } + + /** + * This returns the editing domain as required by the {@link IEditingDomainProvider} interface. + * This is important for implementing the static methods of {@link AdapterFactoryEditingDomain} + * and for supporting {@link org.eclipse.emf.edit.ui.action.CommandAction}. + * + * + * @generated + */ + public EditingDomain getEditingDomain() { + return editingDomain; + } + + /** + * + * + * @generated + */ + public class ReverseAdapterFactoryContentProvider extends AdapterFactoryContentProvider { + /** + * + * + * @generated + */ + public ReverseAdapterFactoryContentProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * + * + * @generated + */ + @Override + public Object [] getElements(Object object) { + Object parent = super.getParent(object); + return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray(); + } + + /** + * + * + * @generated + */ + @Override + public Object [] getChildren(Object object) { + Object parent = super.getParent(object); + return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray(); + } + + /** + * + * + * @generated + */ + @Override + public boolean hasChildren(Object object) { + Object parent = super.getParent(object); + return parent != null; + } + + /** + * + * + * @generated + */ + @Override + public Object getParent(Object object) { + return null; + } + } + + /** + * + * + * @generated + */ + public void setCurrentViewerPane(ViewerPane viewerPane) { + if (currentViewerPane != viewerPane) { + if (currentViewerPane != null) { + currentViewerPane.showFocus(false); + } + currentViewerPane = viewerPane; + } + setCurrentViewer(currentViewerPane.getViewer()); + } + + /** + * This makes sure that one content viewer, either for the current page or the outline view, if it has focus, + * is the current one. + * + * + * @generated + */ + public void setCurrentViewer(Viewer viewer) { + // If it is changing... + // + if (currentViewer != viewer) { + if (selectionChangedListener == null) { + // Create the listener on demand. + // + selectionChangedListener = + new ISelectionChangedListener() { + // This just notifies those things that are affected by the section. + // + public void selectionChanged(SelectionChangedEvent selectionChangedEvent) { + setSelection(selectionChangedEvent.getSelection()); + } + }; + } + + // Stop listening to the old one. + // + if (currentViewer != null) { + currentViewer.removeSelectionChangedListener(selectionChangedListener); + } + + // Start listening to the new one. + // + if (viewer != null) { + viewer.addSelectionChangedListener(selectionChangedListener); + } + + // Remember it. + // + currentViewer = viewer; + + // Set the editors selection based on the current viewer's selection. + // + setSelection(currentViewer == null ? StructuredSelection.EMPTY : currentViewer.getSelection()); + } + } + + /** + * This returns the viewer as required by the {@link IViewerProvider} interface. + * + * + * @generated + */ + public Viewer getViewer() { + return currentViewer; + } + + /** + * This creates a context menu for the viewer and adds a listener as well registering the menu for extension. + * + * + * @generated + */ + protected void createContextMenuFor(StructuredViewer viewer) { + MenuManager contextMenu = new MenuManager("#PopUp"); + contextMenu.add(new Separator("additions")); + contextMenu.setRemoveAllWhenShown(true); + contextMenu.addMenuListener(this); + Menu menu= contextMenu.createContextMenu(viewer.getControl()); + viewer.getControl().setMenu(menu); + getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer)); + + int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK; + Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance(), LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance() }; + viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer)); + viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer)); + } + + /** + * This is the method called to load a resource into the editing domain's resource set based on the editor's input. + * + * + * @generated + */ + public void createModel() { + URI resourceURI = EditUIUtil.getURI(getEditorInput(), editingDomain.getResourceSet().getURIConverter()); + Exception exception = null; + Resource resource = null; + try { + // Load the resource through the editing domain. + // + resource = editingDomain.getResourceSet().getResource(resourceURI, true); + } + catch (Exception e) { + exception = e; + resource = editingDomain.getResourceSet().getResource(resourceURI, false); + } + + Diagnostic diagnostic = analyzeResourceProblems(resource, exception); + if (diagnostic.getSeverity() != Diagnostic.OK) { + resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); + } + editingDomain.getResourceSet().eAdapters().add(problemIndicationAdapter); + } + + /** + * Returns a diagnostic describing the errors and warnings listed in the resource + * and the specified exception (if any). + * + * + * @generated + */ + public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) { + boolean hasErrors = !resource.getErrors().isEmpty(); + if (hasErrors || !resource.getWarnings().isEmpty()) { + BasicDiagnostic basicDiagnostic = + new BasicDiagnostic + (hasErrors ? Diagnostic.ERROR : Diagnostic.WARNING, + "fr.n7.simplePDL.editor", + 0, + getString("_UI_CreateModelError_message", resource.getURI()), + new Object [] { exception == null ? (Object)resource : exception }); + basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true)); + return basicDiagnostic; + } + else if (exception != null) { + return + new BasicDiagnostic + (Diagnostic.ERROR, + "fr.n7.simplePDL.editor", + 0, + getString("_UI_CreateModelError_message", resource.getURI()), + new Object[] { exception }); + } + else { + return Diagnostic.OK_INSTANCE; + } + } + + /** + * This is the method used by the framework to install your own controls. + * + * + * @generated + */ + @Override + public void createPages() { + // Creates the model from the editor input + // + createModel(); + + // Only creates the other pages if there is something that can be edited + // + if (!getEditingDomain().getResourceSet().getResources().isEmpty()) { + // Create a page for the selection tree view. + // + { + ViewerPane viewerPane = + new ViewerPane(getSite().getPage(), SimplepdlEditor.this) { + @Override + public Viewer createViewer(Composite composite) { + Tree tree = new Tree(composite, SWT.MULTI); + TreeViewer newTreeViewer = new TreeViewer(tree); + return newTreeViewer; + } + @Override + public void requestActivation() { + super.requestActivation(); + setCurrentViewerPane(this); + } + }; + viewerPane.createControl(getContainer()); + + selectionViewer = (TreeViewer)viewerPane.getViewer(); + selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + selectionViewer.setUseHashlookup(true); + + selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + selectionViewer.setInput(editingDomain.getResourceSet()); + selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); + viewerPane.setTitle(editingDomain.getResourceSet()); + + new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory); + + createContextMenuFor(selectionViewer); + int pageIndex = addPage(viewerPane.getControl()); + setPageText(pageIndex, getString("_UI_SelectionPage_label")); + } + + // Create a page for the parent tree view. + // + { + ViewerPane viewerPane = + new ViewerPane(getSite().getPage(), SimplepdlEditor.this) { + @Override + public Viewer createViewer(Composite composite) { + Tree tree = new Tree(composite, SWT.MULTI); + TreeViewer newTreeViewer = new TreeViewer(tree); + return newTreeViewer; + } + @Override + public void requestActivation() { + super.requestActivation(); + setCurrentViewerPane(this); + } + }; + viewerPane.createControl(getContainer()); + + parentViewer = (TreeViewer)viewerPane.getViewer(); + parentViewer.setAutoExpandLevel(30); + parentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory)); + parentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + + createContextMenuFor(parentViewer); + int pageIndex = addPage(viewerPane.getControl()); + setPageText(pageIndex, getString("_UI_ParentPage_label")); + } + + // This is the page for the list viewer + // + { + ViewerPane viewerPane = + new ViewerPane(getSite().getPage(), SimplepdlEditor.this) { + @Override + public Viewer createViewer(Composite composite) { + return new ListViewer(composite); + } + @Override + public void requestActivation() { + super.requestActivation(); + setCurrentViewerPane(this); + } + }; + viewerPane.createControl(getContainer()); + listViewer = (ListViewer)viewerPane.getViewer(); + listViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + listViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + + createContextMenuFor(listViewer); + int pageIndex = addPage(viewerPane.getControl()); + setPageText(pageIndex, getString("_UI_ListPage_label")); + } + + // This is the page for the tree viewer + // + { + ViewerPane viewerPane = + new ViewerPane(getSite().getPage(), SimplepdlEditor.this) { + @Override + public Viewer createViewer(Composite composite) { + return new TreeViewer(composite); + } + @Override + public void requestActivation() { + super.requestActivation(); + setCurrentViewerPane(this); + } + }; + viewerPane.createControl(getContainer()); + treeViewer = (TreeViewer)viewerPane.getViewer(); + treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + + new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory); + + createContextMenuFor(treeViewer); + int pageIndex = addPage(viewerPane.getControl()); + setPageText(pageIndex, getString("_UI_TreePage_label")); + } + + // This is the page for the table viewer. + // + { + ViewerPane viewerPane = + new ViewerPane(getSite().getPage(), SimplepdlEditor.this) { + @Override + public Viewer createViewer(Composite composite) { + return new TableViewer(composite); + } + @Override + public void requestActivation() { + super.requestActivation(); + setCurrentViewerPane(this); + } + }; + viewerPane.createControl(getContainer()); + tableViewer = (TableViewer)viewerPane.getViewer(); + + Table table = tableViewer.getTable(); + TableLayout layout = new TableLayout(); + table.setLayout(layout); + table.setHeaderVisible(true); + table.setLinesVisible(true); + + TableColumn objectColumn = new TableColumn(table, SWT.NONE); + layout.addColumnData(new ColumnWeightData(3, 100, true)); + objectColumn.setText(getString("_UI_ObjectColumn_label")); + objectColumn.setResizable(true); + + TableColumn selfColumn = new TableColumn(table, SWT.NONE); + layout.addColumnData(new ColumnWeightData(2, 100, true)); + selfColumn.setText(getString("_UI_SelfColumn_label")); + selfColumn.setResizable(true); + + tableViewer.setColumnProperties(new String [] {"a", "b"}); + tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + + createContextMenuFor(tableViewer); + int pageIndex = addPage(viewerPane.getControl()); + setPageText(pageIndex, getString("_UI_TablePage_label")); + } + + // This is the page for the table tree viewer. + // + { + ViewerPane viewerPane = + new ViewerPane(getSite().getPage(), SimplepdlEditor.this) { + @Override + public Viewer createViewer(Composite composite) { + return new TreeViewer(composite); + } + @Override + public void requestActivation() { + super.requestActivation(); + setCurrentViewerPane(this); + } + }; + viewerPane.createControl(getContainer()); + + treeViewerWithColumns = (TreeViewer)viewerPane.getViewer(); + + Tree tree = treeViewerWithColumns.getTree(); + tree.setLayoutData(new FillLayout()); + tree.setHeaderVisible(true); + tree.setLinesVisible(true); + + TreeColumn objectColumn = new TreeColumn(tree, SWT.NONE); + objectColumn.setText(getString("_UI_ObjectColumn_label")); + objectColumn.setResizable(true); + objectColumn.setWidth(250); + + TreeColumn selfColumn = new TreeColumn(tree, SWT.NONE); + selfColumn.setText(getString("_UI_SelfColumn_label")); + selfColumn.setResizable(true); + selfColumn.setWidth(200); + + treeViewerWithColumns.setColumnProperties(new String [] {"a", "b"}); + treeViewerWithColumns.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + treeViewerWithColumns.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + + createContextMenuFor(treeViewerWithColumns); + int pageIndex = addPage(viewerPane.getControl()); + setPageText(pageIndex, getString("_UI_TreeWithColumnsPage_label")); + } + + getSite().getShell().getDisplay().asyncExec + (new Runnable() { + public void run() { + if (!getContainer().isDisposed()) { + setActivePage(0); + } + } + }); + } + + // Ensures that this editor will only display the page's tab + // area if there are more than one page + // + getContainer().addControlListener + (new ControlAdapter() { + boolean guard = false; + @Override + public void controlResized(ControlEvent event) { + if (!guard) { + guard = true; + hideTabs(); + guard = false; + } + } + }); + + getSite().getShell().getDisplay().asyncExec + (new Runnable() { + public void run() { + updateProblemIndication(); + } + }); + } + + /** + * If there is just one page in the multi-page editor part, + * this hides the single tab at the bottom. + * + * + * @generated + */ + protected void hideTabs() { + if (getPageCount() <= 1) { + setPageText(0, ""); + if (getContainer() instanceof CTabFolder) { + Point point = getContainer().getSize(); + Rectangle clientArea = getContainer().getClientArea(); + getContainer().setSize(point.x, 2 * point.y - clientArea.height - clientArea.y); + } + } + } + + /** + * If there is more than one page in the multi-page editor part, + * this shows the tabs at the bottom. + * + * + * @generated + */ + protected void showTabs() { + if (getPageCount() > 1) { + setPageText(0, getString("_UI_SelectionPage_label")); + if (getContainer() instanceof CTabFolder) { + Point point = getContainer().getSize(); + Rectangle clientArea = getContainer().getClientArea(); + getContainer().setSize(point.x, clientArea.height + clientArea.y); + } + } + } + + /** + * This is used to track the active viewer. + * + * + * @generated + */ + @Override + protected void pageChange(int pageIndex) { + super.pageChange(pageIndex); + + if (contentOutlinePage != null) { + handleContentOutlineSelection(contentOutlinePage.getSelection()); + } + } + + /** + * This is how the framework determines which interfaces we implement. + * + * + * @generated + */ + @Override + public T getAdapter(Class key) { + if (key.equals(IContentOutlinePage.class)) { + return showOutlineView() ? key.cast(getContentOutlinePage()) : null; + } + else if (key.equals(IPropertySheetPage.class)) { + return key.cast(getPropertySheetPage()); + } + else if (key.equals(IGotoMarker.class)) { + return key.cast(this); + } + else { + return super.getAdapter(key); + } + } + + /** + * This accesses a cached version of the content outliner. + * + * + * @generated + */ + public IContentOutlinePage getContentOutlinePage() { + if (contentOutlinePage == null) { + // The content outline is just a tree. + // + class MyContentOutlinePage extends ContentOutlinePage { + @Override + public void createControl(Composite parent) { + super.createControl(parent); + contentOutlineViewer = getTreeViewer(); + contentOutlineViewer.addSelectionChangedListener(this); + + // Set up the tree viewer. + // + contentOutlineViewer.setUseHashlookup(true); + contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + contentOutlineViewer.setInput(editingDomain.getResourceSet()); + + // Make sure our popups work. + // + createContextMenuFor(contentOutlineViewer); + + if (!editingDomain.getResourceSet().getResources().isEmpty()) { + // Select the root object in the view. + // + contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); + } + } + + @Override + public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) { + super.makeContributions(menuManager, toolBarManager, statusLineManager); + contentOutlineStatusLineManager = statusLineManager; + } + + @Override + public void setActionBars(IActionBars actionBars) { + super.setActionBars(actionBars); + getActionBarContributor().shareGlobalActions(this, actionBars); + } + } + + contentOutlinePage = new MyContentOutlinePage(); + + // Listen to selection so that we can handle it is a special way. + // + contentOutlinePage.addSelectionChangedListener + (new ISelectionChangedListener() { + // This ensures that we handle selections correctly. + // + public void selectionChanged(SelectionChangedEvent event) { + handleContentOutlineSelection(event.getSelection()); + } + }); + } + + return contentOutlinePage; + } + + /** + * This accesses a cached version of the property sheet. + * + * + * @generated + */ + public IPropertySheetPage getPropertySheetPage() { + PropertySheetPage propertySheetPage = + new ExtendedPropertySheetPage(editingDomain, ExtendedPropertySheetPage.Decoration.NONE, null, 0, false) { + @Override + public void setSelectionToViewer(List selection) { + SimplepdlEditor.this.setSelectionToViewer(selection); + SimplepdlEditor.this.setFocus(); + } + + @Override + public void setActionBars(IActionBars actionBars) { + super.setActionBars(actionBars); + getActionBarContributor().shareGlobalActions(this, actionBars); + } + }; + propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory)); + propertySheetPages.add(propertySheetPage); + + return propertySheetPage; + } + + /** + * This deals with how we want selection in the outliner to affect the other views. + * + * + * @generated + */ + public void handleContentOutlineSelection(ISelection selection) { + if (currentViewerPane != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + Iterator selectedElements = ((IStructuredSelection)selection).iterator(); + if (selectedElements.hasNext()) { + // Get the first selected element. + // + Object selectedElement = selectedElements.next(); + + // If it's the selection viewer, then we want it to select the same selection as this selection. + // + if (currentViewerPane.getViewer() == selectionViewer) { + ArrayList selectionList = new ArrayList(); + selectionList.add(selectedElement); + while (selectedElements.hasNext()) { + selectionList.add(selectedElements.next()); + } + + // Set the selection to the widget. + // + selectionViewer.setSelection(new StructuredSelection(selectionList)); + } + else { + // Set the input to the widget. + // + if (currentViewerPane.getViewer().getInput() != selectedElement) { + currentViewerPane.getViewer().setInput(selectedElement); + currentViewerPane.setTitle(selectedElement); + } + } + } + } + } + + /** + * This is for implementing {@link IEditorPart} and simply tests the command stack. + * + * + * @generated + */ + @Override + public boolean isDirty() { + return ((BasicCommandStack)editingDomain.getCommandStack()).isSaveNeeded(); + } + + /** + * This is for implementing {@link IEditorPart} and simply saves the model file. + * + * + * @generated + */ + @Override + public void doSave(IProgressMonitor progressMonitor) { + // Save only resources that have actually changed. + // + final Map saveOptions = new HashMap(); + saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER); + saveOptions.put(Resource.OPTION_LINE_DELIMITER, Resource.OPTION_LINE_DELIMITER_UNSPECIFIED); + + // Do the work within an operation because this is a long running activity that modifies the workbench. + // + WorkspaceModifyOperation operation = + new WorkspaceModifyOperation() { + // This is the method that gets invoked when the operation runs. + // + @Override + public void execute(IProgressMonitor monitor) { + // Save the resources to the file system. + // + boolean first = true; + List resources = editingDomain.getResourceSet().getResources(); + for (int i = 0; i < resources.size(); ++i) { + Resource resource = resources.get(i); + if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !editingDomain.isReadOnly(resource)) { + try { + long timeStamp = resource.getTimeStamp(); + resource.save(saveOptions); + if (resource.getTimeStamp() != timeStamp) { + savedResources.add(resource); + } + } + catch (Exception exception) { + resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); + } + first = false; + } + } + } + }; + + updateProblemIndication = false; + try { + // This runs the options, and shows progress. + // + new ProgressMonitorDialog(getSite().getShell()).run(true, false, operation); + + // Refresh the necessary state. + // + ((BasicCommandStack)editingDomain.getCommandStack()).saveIsDone(); + firePropertyChange(IEditorPart.PROP_DIRTY); + } + catch (Exception exception) { + // Something went wrong that shouldn't. + // + SimplePDLEditorPlugin.INSTANCE.log(exception); + } + updateProblemIndication = true; + updateProblemIndication(); + } + + /** + * This returns whether something has been persisted to the URI of the specified resource. + * The implementation uses the URI converter from the editor's resource set to try to open an input stream. + * + * + * @generated + */ + protected boolean isPersisted(Resource resource) { + boolean result = false; + try { + InputStream stream = editingDomain.getResourceSet().getURIConverter().createInputStream(resource.getURI()); + if (stream != null) { + result = true; + stream.close(); + } + } + catch (IOException e) { + // Ignore + } + return result; + } + + /** + * This always returns true because it is not currently supported. + * + * + * @generated + */ + @Override + public boolean isSaveAsAllowed() { + return true; + } + + /** + * This also changes the editor's input. + * + * + * @generated + */ + @Override + public void doSaveAs() { + SaveAsDialog saveAsDialog = new SaveAsDialog(getSite().getShell()); + saveAsDialog.open(); + IPath path = saveAsDialog.getResult(); + if (path != null) { + IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path); + if (file != null) { + doSaveAs(URI.createPlatformResourceURI(file.getFullPath().toString(), true), new FileEditorInput(file)); + } + } + } + + /** + * + * + * @generated + */ + protected void doSaveAs(URI uri, IEditorInput editorInput) { + (editingDomain.getResourceSet().getResources().get(0)).setURI(uri); + setInputWithNotify(editorInput); + setPartName(editorInput.getName()); + IProgressMonitor progressMonitor = + getActionBars().getStatusLineManager() != null ? + getActionBars().getStatusLineManager().getProgressMonitor() : + new NullProgressMonitor(); + doSave(progressMonitor); + } + + /** + * + * + * @generated + */ + public void gotoMarker(IMarker marker) { + List targetObjects = markerHelper.getTargetObjects(editingDomain, marker); + if (!targetObjects.isEmpty()) { + setSelectionToViewer(targetObjects); + } + } + + /** + * This is called during startup. + * + * + * @generated + */ + @Override + public void init(IEditorSite site, IEditorInput editorInput) { + setSite(site); + setInputWithNotify(editorInput); + setPartName(editorInput.getName()); + site.setSelectionProvider(this); + site.getPage().addPartListener(partListener); + ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener, IResourceChangeEvent.POST_CHANGE); + } + + /** + * + * + * @generated + */ + @Override + public void setFocus() { + if (currentViewerPane != null) { + currentViewerPane.setFocus(); + } + else { + getControl(getActivePage()).setFocus(); + } + } + + /** + * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}. + * + * + * @generated + */ + public void addSelectionChangedListener(ISelectionChangedListener listener) { + selectionChangedListeners.add(listener); + } + + /** + * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}. + * + * + * @generated + */ + public void removeSelectionChangedListener(ISelectionChangedListener listener) { + selectionChangedListeners.remove(listener); + } + + /** + * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to return this editor's overall selection. + * + * + * @generated + */ + public ISelection getSelection() { + return editorSelection; + } + + /** + * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection. + * Calling this result will notify the listeners. + * + * + * @generated + */ + public void setSelection(ISelection selection) { + editorSelection = selection; + + for (ISelectionChangedListener listener : selectionChangedListeners) { + listener.selectionChanged(new SelectionChangedEvent(this, selection)); + } + setStatusLineManager(selection); + } + + /** + * + * + * @generated + */ + public void setStatusLineManager(ISelection selection) { + IStatusLineManager statusLineManager = currentViewer != null && currentViewer == contentOutlineViewer ? + contentOutlineStatusLineManager : getActionBars().getStatusLineManager(); + + if (statusLineManager != null) { + if (selection instanceof IStructuredSelection) { + Collection collection = ((IStructuredSelection)selection).toList(); + switch (collection.size()) { + case 0: { + statusLineManager.setMessage(getString("_UI_NoObjectSelected")); + break; + } + case 1: { + String text = new AdapterFactoryItemDelegator(adapterFactory).getText(collection.iterator().next()); + statusLineManager.setMessage(getString("_UI_SingleObjectSelected", text)); + break; + } + default: { + statusLineManager.setMessage(getString("_UI_MultiObjectSelected", Integer.toString(collection.size()))); + break; + } + } + } + else { + statusLineManager.setMessage(""); + } + } + } + + /** + * This looks up a string in the plugin's plugin.properties file. + * + * + * @generated + */ + private static String getString(String key) { + return SimplePDLEditorPlugin.INSTANCE.getString(key); + } + + /** + * This looks up a string in plugin.properties, making a substitution. + * + * + * @generated + */ + private static String getString(String key, Object s1) { + return SimplePDLEditorPlugin.INSTANCE.getString(key, new Object [] { s1 }); + } + + /** + * This implements {@link org.eclipse.jface.action.IMenuListener} to help fill the context menus with contributions from the Edit menu. + * + * + * @generated + */ + public void menuAboutToShow(IMenuManager menuManager) { + ((IMenuListener)getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager); + } + + /** + * + * + * @generated + */ + public EditingDomainActionBarContributor getActionBarContributor() { + return (EditingDomainActionBarContributor)getEditorSite().getActionBarContributor(); + } + + /** + * + * + * @generated + */ + public IActionBars getActionBars() { + return getActionBarContributor().getActionBars(); + } + + /** + * + * + * @generated + */ + public AdapterFactory getAdapterFactory() { + return adapterFactory; + } + + /** + * + * + * @generated + */ + @Override + public void dispose() { + updateProblemIndication = false; + + ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener); + + getSite().getPage().removePartListener(partListener); + + adapterFactory.dispose(); + + if (getActionBarContributor().getActiveEditor() == this) { + getActionBarContributor().setActiveEditor(null); + } + + for (PropertySheetPage propertySheetPage : propertySheetPages) { + propertySheetPage.dispose(); + } + + if (contentOutlinePage != null) { + contentOutlinePage.dispose(); + } + + super.dispose(); + } + + /** + * Returns whether the outline view should be presented to the user. + * + * + * @generated + */ + protected boolean showOutlineView() { + return true; + } +} diff --git a/fr.n7.simplePDL.editor/src/simplepdl/presentation/SimplepdlModelWizard.java b/fr.n7.simplePDL.editor/src/simplepdl/presentation/SimplepdlModelWizard.java new file mode 100644 index 0000000..d97fe76 --- /dev/null +++ b/fr.n7.simplePDL.editor/src/simplepdl/presentation/SimplepdlModelWizard.java @@ -0,0 +1,627 @@ +/** + */ +package simplepdl.presentation; + + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.MissingResourceException; +import java.util.StringTokenizer; + +import org.eclipse.emf.common.CommonPlugin; + +import org.eclipse.emf.common.util.URI; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; + +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; + +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; + +import org.eclipse.emf.ecore.EObject; + +import org.eclipse.emf.ecore.xmi.XMLResource; + +import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; + +import org.eclipse.core.runtime.IProgressMonitor; + +import org.eclipse.jface.dialogs.MessageDialog; + +import org.eclipse.jface.viewers.IStructuredSelection; + +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.jface.wizard.WizardPage; + +import org.eclipse.swt.SWT; + +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.ModifyEvent; + +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; + +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; + +import org.eclipse.ui.INewWizard; +import org.eclipse.ui.IWorkbench; + +import org.eclipse.ui.actions.WorkspaceModifyOperation; + +import org.eclipse.ui.dialogs.WizardNewFileCreationPage; + +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.part.ISetSelectionTarget; + +import simplepdl.SimplepdlFactory; +import simplepdl.SimplepdlPackage; +import simplepdl.provider.SimplePDLEditPlugin; + + +import org.eclipse.core.runtime.Path; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.StructuredSelection; + +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PartInitException; + + +/** + * This is a simple wizard for creating a new model file. + * + * + * @generated + */ +public class SimplepdlModelWizard extends Wizard implements INewWizard { + /** + * The supported extensions for created files. + * + * + * @generated + */ + public static final List FILE_EXTENSIONS = + Collections.unmodifiableList(Arrays.asList(SimplePDLEditorPlugin.INSTANCE.getString("_UI_SimplepdlEditorFilenameExtensions").split("\\s*,\\s*"))); + + /** + * A formatted list of supported file extensions, suitable for display. + * + * + * @generated + */ + public static final String FORMATTED_FILE_EXTENSIONS = + SimplePDLEditorPlugin.INSTANCE.getString("_UI_SimplepdlEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", "); + + /** + * This caches an instance of the model package. + * + * + * @generated + */ + protected SimplepdlPackage simplepdlPackage = SimplepdlPackage.eINSTANCE; + + /** + * This caches an instance of the model factory. + * + * + * @generated + */ + protected SimplepdlFactory simplepdlFactory = simplepdlPackage.getSimplepdlFactory(); + + /** + * This is the file creation page. + * + * + * @generated + */ + protected SimplepdlModelWizardNewFileCreationPage newFileCreationPage; + + /** + * This is the initial object creation page. + * + * + * @generated + */ + protected SimplepdlModelWizardInitialObjectCreationPage initialObjectCreationPage; + + /** + * Remember the selection during initialization for populating the default container. + * + * + * @generated + */ + protected IStructuredSelection selection; + + /** + * Remember the workbench during initialization. + * + * + * @generated + */ + protected IWorkbench workbench; + + /** + * Caches the names of the types that can be created as the root object. + * + * + * @generated + */ + protected List initialObjectNames; + + /** + * This just records the information. + * + * + * @generated + */ + public void init(IWorkbench workbench, IStructuredSelection selection) { + this.workbench = workbench; + this.selection = selection; + setWindowTitle(SimplePDLEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); + setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(SimplePDLEditorPlugin.INSTANCE.getImage("full/wizban/NewSimplepdl"))); + } + + /** + * Returns the names of the types that can be created as the root object. + * + * + * @generated + */ + protected Collection getInitialObjectNames() { + if (initialObjectNames == null) { + initialObjectNames = new ArrayList(); + for (EClassifier eClassifier : simplepdlPackage.getEClassifiers()) { + if (eClassifier instanceof EClass) { + EClass eClass = (EClass)eClassifier; + if (!eClass.isAbstract()) { + initialObjectNames.add(eClass.getName()); + } + } + } + Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator()); + } + return initialObjectNames; + } + + /** + * Create a new model. + * + * + * @generated + */ + protected EObject createInitialModel() { + EClass eClass = (EClass)simplepdlPackage.getEClassifier(initialObjectCreationPage.getInitialObjectName()); + EObject rootObject = simplepdlFactory.create(eClass); + return rootObject; + } + + /** + * Do the work after everything is specified. + * + * + * @generated + */ + @Override + public boolean performFinish() { + try { + // Remember the file. + // + final IFile modelFile = getModelFile(); + + // Do the work within an operation. + // + WorkspaceModifyOperation operation = + new WorkspaceModifyOperation() { + @Override + protected void execute(IProgressMonitor progressMonitor) { + try { + // Create a resource set + // + ResourceSet resourceSet = new ResourceSetImpl(); + + // Get the URI of the model file. + // + URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true); + + // Create a resource for this file. + // + Resource resource = resourceSet.createResource(fileURI); + + // Add the initial model object to the contents. + // + EObject rootObject = createInitialModel(); + if (rootObject != null) { + resource.getContents().add(rootObject); + } + + // Save the contents of the resource to the file system. + // + Map options = new HashMap(); + options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding()); + resource.save(options); + } + catch (Exception exception) { + SimplePDLEditorPlugin.INSTANCE.log(exception); + } + finally { + progressMonitor.done(); + } + } + }; + + getContainer().run(false, false, operation); + + // Select the new file resource in the current view. + // + IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); + IWorkbenchPage page = workbenchWindow.getActivePage(); + final IWorkbenchPart activePart = page.getActivePart(); + if (activePart instanceof ISetSelectionTarget) { + final ISelection targetSelection = new StructuredSelection(modelFile); + getShell().getDisplay().asyncExec + (new Runnable() { + public void run() { + ((ISetSelectionTarget)activePart).selectReveal(targetSelection); + } + }); + } + + // Open an editor on the new file. + // + try { + page.openEditor + (new FileEditorInput(modelFile), + workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId()); + } + catch (PartInitException exception) { + MessageDialog.openError(workbenchWindow.getShell(), SimplePDLEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage()); + return false; + } + + return true; + } + catch (Exception exception) { + SimplePDLEditorPlugin.INSTANCE.log(exception); + return false; + } + } + + /** + * This is the one page of the wizard. + * + * + * @generated + */ + public class SimplepdlModelWizardNewFileCreationPage extends WizardNewFileCreationPage { + /** + * Pass in the selection. + * + * + * @generated + */ + public SimplepdlModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) { + super(pageId, selection); + } + + /** + * The framework calls this to see if the file is correct. + * + * + * @generated + */ + @Override + protected boolean validatePage() { + if (super.validatePage()) { + String extension = new Path(getFileName()).getFileExtension(); + if (extension == null || !FILE_EXTENSIONS.contains(extension)) { + String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension"; + setErrorMessage(SimplePDLEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS })); + return false; + } + return true; + } + return false; + } + + /** + * + * + * @generated + */ + public IFile getModelFile() { + return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName())); + } + } + + /** + * This is the page where the type of object to create is selected. + * + * + * @generated + */ + public class SimplepdlModelWizardInitialObjectCreationPage extends WizardPage { + /** + * + * + * @generated + */ + protected Combo initialObjectField; + + /** + * @generated + * + * + */ + protected List encodings; + + /** + * + * + * @generated + */ + protected Combo encodingField; + + /** + * Pass in the selection. + * + * + * @generated + */ + public SimplepdlModelWizardInitialObjectCreationPage(String pageId) { + super(pageId); + } + + /** + * + * + * @generated + */ + public void createControl(Composite parent) { + Composite composite = new Composite(parent, SWT.NONE); { + GridLayout layout = new GridLayout(); + layout.numColumns = 1; + layout.verticalSpacing = 12; + composite.setLayout(layout); + + GridData data = new GridData(); + data.verticalAlignment = GridData.FILL; + data.grabExcessVerticalSpace = true; + data.horizontalAlignment = GridData.FILL; + composite.setLayoutData(data); + } + + Label containerLabel = new Label(composite, SWT.LEFT); + { + containerLabel.setText(SimplePDLEditorPlugin.INSTANCE.getString("_UI_ModelObject")); + + GridData data = new GridData(); + data.horizontalAlignment = GridData.FILL; + containerLabel.setLayoutData(data); + } + + initialObjectField = new Combo(composite, SWT.BORDER); + { + GridData data = new GridData(); + data.horizontalAlignment = GridData.FILL; + data.grabExcessHorizontalSpace = true; + initialObjectField.setLayoutData(data); + } + + for (String objectName : getInitialObjectNames()) { + initialObjectField.add(getLabel(objectName)); + } + + if (initialObjectField.getItemCount() == 1) { + initialObjectField.select(0); + } + initialObjectField.addModifyListener(validator); + + Label encodingLabel = new Label(composite, SWT.LEFT); + { + encodingLabel.setText(SimplePDLEditorPlugin.INSTANCE.getString("_UI_XMLEncoding")); + + GridData data = new GridData(); + data.horizontalAlignment = GridData.FILL; + encodingLabel.setLayoutData(data); + } + encodingField = new Combo(composite, SWT.BORDER); + { + GridData data = new GridData(); + data.horizontalAlignment = GridData.FILL; + data.grabExcessHorizontalSpace = true; + encodingField.setLayoutData(data); + } + + for (String encoding : getEncodings()) { + encodingField.add(encoding); + } + + encodingField.select(0); + encodingField.addModifyListener(validator); + + setPageComplete(validatePage()); + setControl(composite); + } + + /** + * + * + * @generated + */ + protected ModifyListener validator = + new ModifyListener() { + public void modifyText(ModifyEvent e) { + setPageComplete(validatePage()); + } + }; + + /** + * + * + * @generated + */ + protected boolean validatePage() { + return getInitialObjectName() != null && getEncodings().contains(encodingField.getText()); + } + + /** + * + * + * @generated + */ + @Override + public void setVisible(boolean visible) { + super.setVisible(visible); + if (visible) { + if (initialObjectField.getItemCount() == 1) { + initialObjectField.clearSelection(); + encodingField.setFocus(); + } + else { + encodingField.clearSelection(); + initialObjectField.setFocus(); + } + } + } + + /** + * + * + * @generated + */ + public String getInitialObjectName() { + String label = initialObjectField.getText(); + + for (String name : getInitialObjectNames()) { + if (getLabel(name).equals(label)) { + return name; + } + } + return null; + } + + /** + * + * + * @generated + */ + public String getEncoding() { + return encodingField.getText(); + } + + /** + * Returns the label for the specified type name. + * + * + * @generated + */ + protected String getLabel(String typeName) { + try { + return SimplePDLEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type"); + } + catch(MissingResourceException mre) { + SimplePDLEditorPlugin.INSTANCE.log(mre); + } + return typeName; + } + + /** + * + * + * @generated + */ + protected Collection getEncodings() { + if (encodings == null) { + encodings = new ArrayList(); + for (StringTokenizer stringTokenizer = new StringTokenizer(SimplePDLEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens(); ) { + encodings.add(stringTokenizer.nextToken()); + } + } + return encodings; + } + } + + /** + * The framework calls this to create the contents of the wizard. + * + * + * @generated + */ + @Override + public void addPages() { + // Create a page, set the title, and the initial model file name. + // + newFileCreationPage = new SimplepdlModelWizardNewFileCreationPage("Whatever", selection); + newFileCreationPage.setTitle(SimplePDLEditorPlugin.INSTANCE.getString("_UI_SimplepdlModelWizard_label")); + newFileCreationPage.setDescription(SimplePDLEditorPlugin.INSTANCE.getString("_UI_SimplepdlModelWizard_description")); + newFileCreationPage.setFileName(SimplePDLEditorPlugin.INSTANCE.getString("_UI_SimplepdlEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0)); + addPage(newFileCreationPage); + + // Try and get the resource selection to determine a current directory for the file dialog. + // + if (selection != null && !selection.isEmpty()) { + // Get the resource... + // + Object selectedElement = selection.iterator().next(); + if (selectedElement instanceof IResource) { + // Get the resource parent, if its a file. + // + IResource selectedResource = (IResource)selectedElement; + if (selectedResource.getType() == IResource.FILE) { + selectedResource = selectedResource.getParent(); + } + + // This gives us a directory... + // + if (selectedResource instanceof IFolder || selectedResource instanceof IProject) { + // Set this for the container. + // + newFileCreationPage.setContainerFullPath(selectedResource.getFullPath()); + + // Make up a unique new name here. + // + String defaultModelBaseFilename = SimplePDLEditorPlugin.INSTANCE.getString("_UI_SimplepdlEditorFilenameDefaultBase"); + String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0); + String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension; + for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) { + modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; + } + newFileCreationPage.setFileName(modelFilename); + } + } + } + initialObjectCreationPage = new SimplepdlModelWizardInitialObjectCreationPage("Whatever2"); + initialObjectCreationPage.setTitle(SimplePDLEditorPlugin.INSTANCE.getString("_UI_SimplepdlModelWizard_label")); + initialObjectCreationPage.setDescription(SimplePDLEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description")); + addPage(initialObjectCreationPage); + } + + /** + * Get the file from the page. + * + * + * @generated + */ + public IFile getModelFile() { + return newFileCreationPage.getModelFile(); + } + +} diff --git a/fr.n7.simplePDL.exemple/.project b/fr.n7.simplePDL.exemple/.project new file mode 100644 index 0000000..895f5cf --- /dev/null +++ b/fr.n7.simplePDL.exemple/.project @@ -0,0 +1,11 @@ + + + fr.n7.simplePDL.exemple + + + + + + + + diff --git a/fr.n7.simplePDL.exemple/My.simplepdl b/fr.n7.simplePDL.exemple/My.simplepdl new file mode 100644 index 0000000..3f2253c --- /dev/null +++ b/fr.n7.simplePDL.exemple/My.simplepdl @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/fr.n7.simplePDL.feature/.project b/fr.n7.simplePDL.feature/.project new file mode 100644 index 0000000..ed97441 --- /dev/null +++ b/fr.n7.simplePDL.feature/.project @@ -0,0 +1,17 @@ + + + fr.n7.simplePDL.feature + + + + + + org.eclipse.pde.FeatureBuilder + + + + + + org.eclipse.pde.FeatureNature + + diff --git a/fr.n7.simplePDL.feature/build.properties b/fr.n7.simplePDL.feature/build.properties new file mode 100644 index 0000000..64f93a9 --- /dev/null +++ b/fr.n7.simplePDL.feature/build.properties @@ -0,0 +1 @@ +bin.includes = feature.xml diff --git a/fr.n7.simplePDL.feature/feature.xml b/fr.n7.simplePDL.feature/feature.xml new file mode 100644 index 0000000..81dcb11 --- /dev/null +++ b/fr.n7.simplePDL.feature/feature.xml @@ -0,0 +1,47 @@ + + + + + [Enter Feature Description here.] + + + + [Enter Copyright Description here.] + + + + [Enter License Description here.] + + + + + + + + + + + diff --git a/fr.n7.simplePDL.tests/.classpath b/fr.n7.simplePDL.tests/.classpath new file mode 100644 index 0000000..c3ba59e --- /dev/null +++ b/fr.n7.simplePDL.tests/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/fr.n7.simplePDL.tests/.project b/fr.n7.simplePDL.tests/.project new file mode 100644 index 0000000..8e217a6 --- /dev/null +++ b/fr.n7.simplePDL.tests/.project @@ -0,0 +1,28 @@ + + + fr.n7.simplePDL.tests + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + diff --git a/fr.n7.simplePDL.tests/META-INF/MANIFEST.MF b/fr.n7.simplePDL.tests/META-INF/MANIFEST.MF new file mode 100644 index 0000000..9f069ea --- /dev/null +++ b/fr.n7.simplePDL.tests/META-INF/MANIFEST.MF @@ -0,0 +1,16 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: fr.n7.simplePDL.tests;singleton:=true +Automatic-Module-Name: fr.n7.simplePDL.tests +Bundle-Version: 1.0.0.qualifier +Bundle-ClassPath: . +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Export-Package: simplepdl.tests +Require-Bundle: org.eclipse.core.runtime, + fr.n7.simplePDL;visibility:=reexport, + org.eclipse.emf.ecore.xmi;visibility:=reexport, + org.junit;visibility:=reexport +Bundle-ActivationPolicy: lazy diff --git a/fr.n7.simplePDL.tests/build.properties b/fr.n7.simplePDL.tests/build.properties new file mode 100644 index 0000000..08af068 --- /dev/null +++ b/fr.n7.simplePDL.tests/build.properties @@ -0,0 +1,8 @@ +# + +bin.includes = .,\ + META-INF/,\ + plugin.properties +jars.compile.order = . +source.. = src/ +output.. = bin/ diff --git a/fr.n7.simplePDL.tests/plugin.properties b/fr.n7.simplePDL.tests/plugin.properties new file mode 100644 index 0000000..fdd5cc2 --- /dev/null +++ b/fr.n7.simplePDL.tests/plugin.properties @@ -0,0 +1,4 @@ +# + +pluginName = SimplePDL Model Tests +providerName = www.example.org diff --git a/fr.n7.simplePDL.tests/src/simplepdl/tests/GuidanceTest.java b/fr.n7.simplePDL.tests/src/simplepdl/tests/GuidanceTest.java new file mode 100644 index 0000000..03f5092 --- /dev/null +++ b/fr.n7.simplePDL.tests/src/simplepdl/tests/GuidanceTest.java @@ -0,0 +1,70 @@ +/** + */ +package simplepdl.tests; + +import junit.textui.TestRunner; + +import simplepdl.Guidance; +import simplepdl.SimplepdlFactory; + +/** + * + * A test case for the model object 'Guidance'. + * + * @generated + */ +public class GuidanceTest extends ProcessElementTest { + + /** + * + * + * @generated + */ + public static void main(String[] args) { + TestRunner.run(GuidanceTest.class); + } + + /** + * Constructs a new Guidance test case with the given name. + * + * + * @generated + */ + public GuidanceTest(String name) { + super(name); + } + + /** + * Returns the fixture for this Guidance test case. + * + * + * @generated + */ + @Override + protected Guidance getFixture() { + return (Guidance)fixture; + } + + /** + * + * + * @see junit.framework.TestCase#setUp() + * @generated + */ + @Override + protected void setUp() throws Exception { + setFixture(SimplepdlFactory.eINSTANCE.createGuidance()); + } + + /** + * + * + * @see junit.framework.TestCase#tearDown() + * @generated + */ + @Override + protected void tearDown() throws Exception { + setFixture(null); + } + +} //GuidanceTest diff --git a/fr.n7.simplePDL.tests/src/simplepdl/tests/ProcessElementTest.java b/fr.n7.simplePDL.tests/src/simplepdl/tests/ProcessElementTest.java new file mode 100644 index 0000000..854fab1 --- /dev/null +++ b/fr.n7.simplePDL.tests/src/simplepdl/tests/ProcessElementTest.java @@ -0,0 +1,55 @@ +/** + */ +package simplepdl.tests; + +import junit.framework.TestCase; + +import simplepdl.ProcessElement; + +/** + * + * A test case for the model object 'Process Element'. + * + * @generated + */ +public abstract class ProcessElementTest extends TestCase { + + /** + * The fixture for this Process Element test case. + * + * + * @generated + */ + protected ProcessElement fixture = null; + + /** + * Constructs a new Process Element test case with the given name. + * + * + * @generated + */ + public ProcessElementTest(String name) { + super(name); + } + + /** + * Sets the fixture for this Process Element test case. + * + * + * @generated + */ + protected void setFixture(ProcessElement fixture) { + this.fixture = fixture; + } + + /** + * Returns the fixture for this Process Element test case. + * + * + * @generated + */ + protected ProcessElement getFixture() { + return fixture; + } + +} //ProcessElementTest diff --git a/fr.n7.simplePDL.tests/src/simplepdl/tests/ProcessTest.java b/fr.n7.simplePDL.tests/src/simplepdl/tests/ProcessTest.java new file mode 100644 index 0000000..e00e451 --- /dev/null +++ b/fr.n7.simplePDL.tests/src/simplepdl/tests/ProcessTest.java @@ -0,0 +1,88 @@ +/** + */ +package simplepdl.tests; + +import junit.framework.TestCase; + +import junit.textui.TestRunner; + +import simplepdl.SimplepdlFactory; + +/** + * + * A test case for the model object 'Process'. + * + * @generated + */ +public class ProcessTest extends TestCase { + + /** + * The fixture for this Process test case. + * + * + * @generated + */ + protected simplepdl.Process fixture = null; + + /** + * + * + * @generated + */ + public static void main(String[] args) { + TestRunner.run(ProcessTest.class); + } + + /** + * Constructs a new Process test case with the given name. + * + * + * @generated + */ + public ProcessTest(String name) { + super(name); + } + + /** + * Sets the fixture for this Process test case. + * + * + * @generated + */ + protected void setFixture(simplepdl.Process fixture) { + this.fixture = fixture; + } + + /** + * Returns the fixture for this Process test case. + * + * + * @generated + */ + protected simplepdl.Process getFixture() { + return fixture; + } + + /** + * + * + * @see junit.framework.TestCase#setUp() + * @generated + */ + @Override + protected void setUp() throws Exception { + setFixture(SimplepdlFactory.eINSTANCE.createProcess()); + } + + /** + * + * + * @see junit.framework.TestCase#tearDown() + * @generated + */ + @Override + protected void tearDown() throws Exception { + setFixture(null); + } + +} //ProcessTest diff --git a/fr.n7.simplePDL.tests/src/simplepdl/tests/RequestTest.java b/fr.n7.simplePDL.tests/src/simplepdl/tests/RequestTest.java new file mode 100644 index 0000000..cb24227 --- /dev/null +++ b/fr.n7.simplePDL.tests/src/simplepdl/tests/RequestTest.java @@ -0,0 +1,89 @@ +/** + */ +package simplepdl.tests; + +import junit.framework.TestCase; + +import junit.textui.TestRunner; + +import simplepdl.Request; +import simplepdl.SimplepdlFactory; + +/** + * + * A test case for the model object 'Request'. + * + * @generated + */ +public class RequestTest extends TestCase { + + /** + * The fixture for this Request test case. + * + * + * @generated + */ + protected Request fixture = null; + + /** + * + * + * @generated + */ + public static void main(String[] args) { + TestRunner.run(RequestTest.class); + } + + /** + * Constructs a new Request test case with the given name. + * + * + * @generated + */ + public RequestTest(String name) { + super(name); + } + + /** + * Sets the fixture for this Request test case. + * + * + * @generated + */ + protected void setFixture(Request fixture) { + this.fixture = fixture; + } + + /** + * Returns the fixture for this Request test case. + * + * + * @generated + */ + protected Request getFixture() { + return fixture; + } + + /** + * + * + * @see junit.framework.TestCase#setUp() + * @generated + */ + @Override + protected void setUp() throws Exception { + setFixture(SimplepdlFactory.eINSTANCE.createRequest()); + } + + /** + * + * + * @see junit.framework.TestCase#tearDown() + * @generated + */ + @Override + protected void tearDown() throws Exception { + setFixture(null); + } + +} //RequestTest diff --git a/fr.n7.simplePDL.tests/src/simplepdl/tests/ResourceTest.java b/fr.n7.simplePDL.tests/src/simplepdl/tests/ResourceTest.java new file mode 100644 index 0000000..23eb32e --- /dev/null +++ b/fr.n7.simplePDL.tests/src/simplepdl/tests/ResourceTest.java @@ -0,0 +1,70 @@ +/** + */ +package simplepdl.tests; + +import junit.textui.TestRunner; + +import simplepdl.Resource; +import simplepdl.SimplepdlFactory; + +/** + * + * A test case for the model object 'Resource'. + * + * @generated + */ +public class ResourceTest extends ProcessElementTest { + + /** + * + * + * @generated + */ + public static void main(String[] args) { + TestRunner.run(ResourceTest.class); + } + + /** + * Constructs a new Resource test case with the given name. + * + * + * @generated + */ + public ResourceTest(String name) { + super(name); + } + + /** + * Returns the fixture for this Resource test case. + * + * + * @generated + */ + @Override + protected Resource getFixture() { + return (Resource)fixture; + } + + /** + * + * + * @see junit.framework.TestCase#setUp() + * @generated + */ + @Override + protected void setUp() throws Exception { + setFixture(SimplepdlFactory.eINSTANCE.createResource()); + } + + /** + * + * + * @see junit.framework.TestCase#tearDown() + * @generated + */ + @Override + protected void tearDown() throws Exception { + setFixture(null); + } + +} //ResourceTest diff --git a/fr.n7.simplePDL.tests/src/simplepdl/tests/SimplePDLAllTests.java b/fr.n7.simplePDL.tests/src/simplepdl/tests/SimplePDLAllTests.java new file mode 100644 index 0000000..1d44e34 --- /dev/null +++ b/fr.n7.simplePDL.tests/src/simplepdl/tests/SimplePDLAllTests.java @@ -0,0 +1,46 @@ +/** + */ +package simplepdl.tests; + +import junit.framework.Test; +import junit.framework.TestSuite; + +import junit.textui.TestRunner; + +/** + * + * A test suite for the 'SimplePDL' model. + * + * @generated + */ +public class SimplePDLAllTests extends TestSuite { + + /** + * + * + * @generated + */ + public static void main(String[] args) { + TestRunner.run(suite()); + } + + /** + * + * + * @generated + */ + public static Test suite() { + TestSuite suite = new SimplePDLAllTests("SimplePDL Tests"); + return suite; + } + + /** + * + * + * @generated + */ + public SimplePDLAllTests(String name) { + super(name); + } + +} //SimplePDLAllTests diff --git a/fr.n7.simplePDL.tests/src/simplepdl/tests/SimplepdlExample.java b/fr.n7.simplePDL.tests/src/simplepdl/tests/SimplepdlExample.java new file mode 100644 index 0000000..bcbf1f5 --- /dev/null +++ b/fr.n7.simplePDL.tests/src/simplepdl/tests/SimplepdlExample.java @@ -0,0 +1,121 @@ +/** + */ +package simplepdl.tests; + +import java.io.File; +import java.io.IOException; + +import org.eclipse.emf.common.util.Diagnostic; +import org.eclipse.emf.common.util.URI; + +import org.eclipse.emf.ecore.EObject; + +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; + +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; + +import org.eclipse.emf.ecore.util.Diagnostician; + +import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; + +import simplepdl.SimplepdlFactory; +import simplepdl.SimplepdlPackage; +import simplepdl.WorkDefinition; + +/** + * + * A sample utility for the 'simplepdl' package. + * + * @generated + */ +public class SimplepdlExample { + /** + * + * Load all the argument file paths or URIs as instances of the model. + * + * @param args the file paths or URIs. + * @generated + */ + public static void main(String[] args) { + // Create a resource set to hold the resources. + // + ResourceSet resourceSet = new ResourceSetImpl(); + + // Register the appropriate resource factory to handle all file extensions. + // + resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put + (Resource.Factory.Registry.DEFAULT_EXTENSION, + new XMIResourceFactoryImpl()); + + // Register the package to ensure it is available during loading. + // + resourceSet.getPackageRegistry().put + (SimplepdlPackage.eNS_URI, + SimplepdlPackage.eINSTANCE); + + // If there are no arguments, emit an appropriate usage message. + // + if (args.length == 0) { + System.out.println("Enter a list of file paths or URIs that have content like this:"); + try { + Resource resource = resourceSet.createResource(URI.createURI("http:///My.simplepdl")); + WorkDefinition root = SimplepdlFactory.eINSTANCE.createWorkDefinition(); + resource.getContents().add(root); + resource.save(System.out, null); + } + catch (IOException exception) { + exception.printStackTrace(); + } + } + else { + // Iterate over all the arguments. + // + for (int i = 0; i < args.length; ++i) { + // Construct the URI for the instance file. + // The argument is treated as a file path only if it denotes an existing file. + // Otherwise, it's directly treated as a URL. + // + File file = new File(args[i]); + URI uri = file.isFile() ? URI.createFileURI(file.getAbsolutePath()): URI.createURI(args[i]); + + try { + // Demand load resource for this file. + // + Resource resource = resourceSet.getResource(uri, true); + System.out.println("Loaded " + uri); + + // Validate the contents of the loaded resource. + // + for (EObject eObject : resource.getContents()) { + Diagnostic diagnostic = Diagnostician.INSTANCE.validate(eObject); + if (diagnostic.getSeverity() != Diagnostic.OK) { + printDiagnostic(diagnostic, ""); + } + } + } + catch (RuntimeException exception) { + System.out.println("Problem loading " + uri); + exception.printStackTrace(); + } + } + } + } + + /** + * + * Prints diagnostics with indentation. + * + * @param diagnostic the diagnostic to print. + * @param indent the indentation for printing. + * @generated + */ + protected static void printDiagnostic(Diagnostic diagnostic, String indent) { + System.out.print(indent); + System.out.println(diagnostic.getMessage()); + for (Diagnostic child : diagnostic.getChildren()) { + printDiagnostic(child, indent + " "); + } + } + +} //SimplepdlExample diff --git a/fr.n7.simplePDL.tests/src/simplepdl/tests/SimplepdlTests.java b/fr.n7.simplePDL.tests/src/simplepdl/tests/SimplepdlTests.java new file mode 100644 index 0000000..03c63f1 --- /dev/null +++ b/fr.n7.simplePDL.tests/src/simplepdl/tests/SimplepdlTests.java @@ -0,0 +1,46 @@ +/** + */ +package simplepdl.tests; + +import junit.framework.Test; +import junit.framework.TestSuite; + +import junit.textui.TestRunner; + +/** + * + * A test suite for the 'simplepdl' package. + * + * @generated + */ +public class SimplepdlTests extends TestSuite { + + /** + * + * + * @generated + */ + public static void main(String[] args) { + TestRunner.run(suite()); + } + + /** + * + * + * @generated + */ + public static Test suite() { + TestSuite suite = new SimplepdlTests("simplepdl Tests"); + return suite; + } + + /** + * + * + * @generated + */ + public SimplepdlTests(String name) { + super(name); + } + +} //SimplepdlTests diff --git a/fr.n7.simplePDL.tests/src/simplepdl/tests/WorkDefinitionTest.java b/fr.n7.simplePDL.tests/src/simplepdl/tests/WorkDefinitionTest.java new file mode 100644 index 0000000..fc9e71b --- /dev/null +++ b/fr.n7.simplePDL.tests/src/simplepdl/tests/WorkDefinitionTest.java @@ -0,0 +1,70 @@ +/** + */ +package simplepdl.tests; + +import junit.textui.TestRunner; + +import simplepdl.SimplepdlFactory; +import simplepdl.WorkDefinition; + +/** + * + * A test case for the model object 'Work Definition'. + * + * @generated + */ +public class WorkDefinitionTest extends ProcessElementTest { + + /** + * + * + * @generated + */ + public static void main(String[] args) { + TestRunner.run(WorkDefinitionTest.class); + } + + /** + * Constructs a new Work Definition test case with the given name. + * + * + * @generated + */ + public WorkDefinitionTest(String name) { + super(name); + } + + /** + * Returns the fixture for this Work Definition test case. + * + * + * @generated + */ + @Override + protected WorkDefinition getFixture() { + return (WorkDefinition)fixture; + } + + /** + * + * + * @see junit.framework.TestCase#setUp() + * @generated + */ + @Override + protected void setUp() throws Exception { + setFixture(SimplepdlFactory.eINSTANCE.createWorkDefinition()); + } + + /** + * + * + * @see junit.framework.TestCase#tearDown() + * @generated + */ + @Override + protected void tearDown() throws Exception { + setFixture(null); + } + +} //WorkDefinitionTest diff --git a/fr.n7.simplePDL.tests/src/simplepdl/tests/WorkSequenceTest.java b/fr.n7.simplePDL.tests/src/simplepdl/tests/WorkSequenceTest.java new file mode 100644 index 0000000..6687b75 --- /dev/null +++ b/fr.n7.simplePDL.tests/src/simplepdl/tests/WorkSequenceTest.java @@ -0,0 +1,70 @@ +/** + */ +package simplepdl.tests; + +import junit.textui.TestRunner; + +import simplepdl.SimplepdlFactory; +import simplepdl.WorkSequence; + +/** + * + * A test case for the model object 'Work Sequence'. + * + * @generated + */ +public class WorkSequenceTest extends ProcessElementTest { + + /** + * + * + * @generated + */ + public static void main(String[] args) { + TestRunner.run(WorkSequenceTest.class); + } + + /** + * Constructs a new Work Sequence test case with the given name. + * + * + * @generated + */ + public WorkSequenceTest(String name) { + super(name); + } + + /** + * Returns the fixture for this Work Sequence test case. + * + * + * @generated + */ + @Override + protected WorkSequence getFixture() { + return (WorkSequence)fixture; + } + + /** + * + * + * @see junit.framework.TestCase#setUp() + * @generated + */ + @Override + protected void setUp() throws Exception { + setFixture(SimplepdlFactory.eINSTANCE.createWorkSequence()); + } + + /** + * + * + * @see junit.framework.TestCase#tearDown() + * @generated + */ + @Override + protected void tearDown() throws Exception { + setFixture(null); + } + +} //WorkSequenceTest diff --git a/fr.n7.simplePDL/.classpath b/fr.n7.simplePDL/.classpath new file mode 100644 index 0000000..c3ba59e --- /dev/null +++ b/fr.n7.simplePDL/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/fr.n7.simplePDL/.project b/fr.n7.simplePDL/.project new file mode 100644 index 0000000..53be262 --- /dev/null +++ b/fr.n7.simplePDL/.project @@ -0,0 +1,50 @@ + + + fr.n7.simplePDL + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.ocl.pivot.ui.oclbuilder + + + disabledExtensions + *,essentialocl + + + disabledPaths + bin/**,target/** + + + enabledExtensions + ecore,ocl,oclinecore,oclstdlib,uml + + + enabledPaths + ** + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.ocl.pivot.ui.oclnature + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + diff --git a/fr.n7.simplePDL/META-INF/MANIFEST.MF b/fr.n7.simplePDL/META-INF/MANIFEST.MF new file mode 100644 index 0000000..7c61513 --- /dev/null +++ b/fr.n7.simplePDL/META-INF/MANIFEST.MF @@ -0,0 +1,17 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: fr.n7.simplePDL;singleton:=true +Automatic-Module-Name: fr.n7.simplePDL +Bundle-Version: 1.0.0.qualifier +Bundle-ClassPath: . +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Export-Package: simplepdl, + simplepdl.impl, + simplepdl.util +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.emf.ecore;visibility:=reexport +Bundle-ActivationPolicy: lazy +Import-Package: org.eclipse.emf.ecore.xmi.impl diff --git a/fr.n7.simplePDL/SimplePDL.aird b/fr.n7.simplePDL/SimplePDL.aird new file mode 100644 index 0000000..9258eec --- /dev/null +++ b/fr.n7.simplePDL/SimplePDL.aird @@ -0,0 +1,1541 @@ + + + + SimplePDL.ecore + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bold + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + bold + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + bold + + + + + + + + + + + + + + + + bold + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + bold + + + + + + + + + + + labelSize + + + labelSize + + + + + + + + + + labelSize + + + labelSize + + + + + + + + + + + italic + + + + + + + + + + + + italic + + + + + + + + + + + + italic + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bold + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + bold + + + + + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + bold + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + bold + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + bold + + + + + + + + + + + labelSize + + + labelSize + + + + + + + + + + labelSize + + + labelSize + + + + + + + + + + + italic + + + + + + + + + + + + italic + + + + + + + + + + + + italic + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bold + + + + + + + + + + + + + + + + bold + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + italic + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + bold + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + bold + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + bold + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + bold + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + bold + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + bold + + + + + + + + bold + + + + + + + + + + + + + + + + + + + + labelSize + + + labelSize + + + + + + + + + + labelSize + + + labelSize + + + + + + + + + + labelSize + bold + + + labelSize + + + + + + + + + + + italic + + + + + + + + + + + + italic + + + + + + + + + + + + italic + + + + + + + + + + + + italic + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/fr.n7.simplePDL/SimplePDL.ecore b/fr.n7.simplePDL/SimplePDL.ecore new file mode 100644 index 0000000..03208a7 --- /dev/null +++ b/fr.n7.simplePDL/SimplePDL.ecore @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/fr.n7.simplePDL/SimplePDL.genmodel b/fr.n7.simplePDL/SimplePDL.genmodel new file mode 100644 index 0000000..8b440d5 --- /dev/null +++ b/fr.n7.simplePDL/SimplePDL.genmodel @@ -0,0 +1,44 @@ + + + SimplePDL.ecore + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/fr.n7.simplePDL/SimplePDL.ocl b/fr.n7.simplePDL/SimplePDL.ocl new file mode 100644 index 0000000..2db1ed8 --- /dev/null +++ b/fr.n7.simplePDL/SimplePDL.ocl @@ -0,0 +1,28 @@ +import 'SimplePDL.ecore' + +package simplepdl + +context Process +inv warningSeverity: false +inv withMessage('Explicit message in process ' + self.name + ' (withMessage)'): false +--inv errorSeverity: null + +context Process +inv validName('Invalid name: ' + self.name): + self.name.matches('[A-Za-z_][A-Za-z0-9_]*') + +context ProcessElement +def: process(): Process = + Process.allInstances() + ->select(p | p.processElements->includes(self)) + ->asSequence()->first() + +context WorkSequence +inv successorAndPredecessorInSameProcess('Activities not in the same process : ' + + self.predecessor.name + ' in ' + self.predecessor.process().name+ ' and ' + + self.successor.name + ' in ' + self.successor.process().name +): + self.process() = self.successor.process() + and self.process() = self.predecessor.process() + +endpackage \ No newline at end of file diff --git a/fr.n7.simplePDL/build.properties b/fr.n7.simplePDL/build.properties new file mode 100644 index 0000000..4465407 --- /dev/null +++ b/fr.n7.simplePDL/build.properties @@ -0,0 +1,10 @@ +# + +bin.includes = .,\ + model/,\ + META-INF/,\ + plugin.xml,\ + plugin.properties +jars.compile.order = . +source.. = src/ +output.. = bin/ diff --git a/fr.n7.simplePDL/models/SimplePDLCreator_Created_Process.xmi b/fr.n7.simplePDL/models/SimplePDLCreator_Created_Process.xmi new file mode 100644 index 0000000..e77e0c4 --- /dev/null +++ b/fr.n7.simplePDL/models/SimplePDLCreator_Created_Process.xmi @@ -0,0 +1,7 @@ + + + + + + + diff --git a/fr.n7.simplePDL/nouveau.ocl b/fr.n7.simplePDL/nouveau.ocl new file mode 100644 index 0000000..24a0088 --- /dev/null +++ b/fr.n7.simplePDL/nouveau.ocl @@ -0,0 +1,26 @@ +import 'SimplePDL.ecore' + +package simplepdl + +context Process +inv uniqNames: self.processElements + ->select(pe | pe.oclIsKindOf(WorkDefinition)) + ->collect(pe | pe.oclAsType(WorkDefinition)) + ->forAll(w1, w2 | w1 = w2 or w1.name <> w2.name) + +context WorkSequence +inv notReflexive: self.predecessor <> self.successor + +context Process +inv nameMin2Char: self.processElements + ->select(pe | pe.oclIsKindOf(WorkDefinition)) + ->collect(pe | pe.oclAsType(WorkDefinition)) + ->forAll(w | w.name.matches('..+')) + +context Process +inv weirdName: self.processElements + ->select(pe | pe.oclIsKindOf(WorkDefinition)) + ->collect(pe | pe.oclAsType(WorkDefinition)) + ->forAll(w | not w.name.matches('([0-9]*|[a-zA-Z]*|_*)')) + +endpackage diff --git a/fr.n7.simplePDL/plugin.properties b/fr.n7.simplePDL/plugin.properties new file mode 100644 index 0000000..f5a92ae --- /dev/null +++ b/fr.n7.simplePDL/plugin.properties @@ -0,0 +1,4 @@ +# + +pluginName = SimplePDL Model +providerName = www.example.org diff --git a/fr.n7.simplePDL/plugin.xml b/fr.n7.simplePDL/plugin.xml new file mode 100644 index 0000000..da327c7 --- /dev/null +++ b/fr.n7.simplePDL/plugin.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + diff --git a/fr.n7.simplePDL/process1-ko.xmi b/fr.n7.simplePDL/process1-ko.xmi new file mode 100644 index 0000000..7b75b5a --- /dev/null +++ b/fr.n7.simplePDL/process1-ko.xmi @@ -0,0 +1,32 @@ + + + + + + + + + diff --git a/fr.n7.simplePDL/simplepdl class diagram.png b/fr.n7.simplePDL/simplepdl class diagram.png new file mode 100644 index 0000000..d0c9277 Binary files /dev/null and b/fr.n7.simplePDL/simplepdl class diagram.png differ diff --git a/fr.n7.simplePDL/src/simplepdl/Guidance.java b/fr.n7.simplePDL/src/simplepdl/Guidance.java new file mode 100644 index 0000000..7a79f9d --- /dev/null +++ b/fr.n7.simplePDL/src/simplepdl/Guidance.java @@ -0,0 +1,59 @@ +/** + */ +package simplepdl; + +import org.eclipse.emf.common.util.EList; + +/** + * + * A representation of the model object 'Guidance'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link simplepdl.Guidance#getText Text}
  • + *
  • {@link simplepdl.Guidance#getElements Elements}
  • + *
+ * + * @see simplepdl.SimplepdlPackage#getGuidance() + * @model + * @generated + */ +public interface Guidance extends ProcessElement { + /** + * Returns the value of the 'Text' attribute. + * + * + * @return the value of the 'Text' attribute. + * @see #setText(String) + * @see simplepdl.SimplepdlPackage#getGuidance_Text() + * @model required="true" + * @generated + */ + String getText(); + + /** + * Sets the value of the '{@link simplepdl.Guidance#getText Text}' attribute. + * + * + * @param value the new value of the 'Text' attribute. + * @see #getText() + * @generated + */ + void setText(String value); + + /** + * Returns the value of the 'Elements' reference list. + * The list contents are of type {@link simplepdl.ProcessElement}. + * + * + * @return the value of the 'Elements' reference list. + * @see simplepdl.SimplepdlPackage#getGuidance_Elements() + * @model + * @generated + */ + EList getElements(); + +} // Guidance diff --git a/fr.n7.simplePDL/src/simplepdl/Process.java b/fr.n7.simplePDL/src/simplepdl/Process.java new file mode 100644 index 0000000..7457b4c --- /dev/null +++ b/fr.n7.simplePDL/src/simplepdl/Process.java @@ -0,0 +1,61 @@ +/** + */ +package simplepdl; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Process'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link simplepdl.Process#getName Name}
  • + *
  • {@link simplepdl.Process#getProcessElements Process Elements}
  • + *
+ * + * @see simplepdl.SimplepdlPackage#getProcess() + * @model + * @generated + */ +public interface Process extends EObject { + /** + * Returns the value of the 'Name' attribute. + * + * + * @return the value of the 'Name' attribute. + * @see #setName(String) + * @see simplepdl.SimplepdlPackage#getProcess_Name() + * @model required="true" + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link simplepdl.Process#getName Name}' attribute. + * + * + * @param value the new value of the 'Name' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + + /** + * Returns the value of the 'Process Elements' containment reference list. + * The list contents are of type {@link simplepdl.ProcessElement}. + * + * + * @return the value of the 'Process Elements' containment reference list. + * @see simplepdl.SimplepdlPackage#getProcess_ProcessElements() + * @model containment="true" + * @generated + */ + EList getProcessElements(); + +} // Process diff --git a/fr.n7.simplePDL/src/simplepdl/ProcessElement.java b/fr.n7.simplePDL/src/simplepdl/ProcessElement.java new file mode 100644 index 0000000..f8bf674 --- /dev/null +++ b/fr.n7.simplePDL/src/simplepdl/ProcessElement.java @@ -0,0 +1,18 @@ +/** + */ +package simplepdl; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Process Element'. + * + * + * + * @see simplepdl.SimplepdlPackage#getProcessElement() + * @model abstract="true" + * @generated + */ +public interface ProcessElement extends EObject { +} // ProcessElement diff --git a/fr.n7.simplePDL/src/simplepdl/Request.java b/fr.n7.simplePDL/src/simplepdl/Request.java new file mode 100644 index 0000000..f7efba5 --- /dev/null +++ b/fr.n7.simplePDL/src/simplepdl/Request.java @@ -0,0 +1,69 @@ +/** + */ +package simplepdl; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Request'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link simplepdl.Request#getQuantity Quantity}
  • + *
  • {@link simplepdl.Request#getTarget Target}
  • + *
+ * + * @see simplepdl.SimplepdlPackage#getRequest() + * @model + * @generated + */ +public interface Request extends EObject { + /** + * Returns the value of the 'Quantity' attribute. + * + * + * @return the value of the 'Quantity' attribute. + * @see #setQuantity(int) + * @see simplepdl.SimplepdlPackage#getRequest_Quantity() + * @model required="true" + * @generated + */ + int getQuantity(); + + /** + * Sets the value of the '{@link simplepdl.Request#getQuantity Quantity}' attribute. + * + * + * @param value the new value of the 'Quantity' attribute. + * @see #getQuantity() + * @generated + */ + void setQuantity(int value); + + /** + * Returns the value of the 'Target' reference. + * + * + * @return the value of the 'Target' reference. + * @see #setTarget(Resource) + * @see simplepdl.SimplepdlPackage#getRequest_Target() + * @model required="true" + * @generated + */ + Resource getTarget(); + + /** + * Sets the value of the '{@link simplepdl.Request#getTarget Target}' reference. + * + * + * @param value the new value of the 'Target' reference. + * @see #getTarget() + * @generated + */ + void setTarget(Resource value); + +} // Request diff --git a/fr.n7.simplePDL/src/simplepdl/Resource.java b/fr.n7.simplePDL/src/simplepdl/Resource.java new file mode 100644 index 0000000..5947a8a --- /dev/null +++ b/fr.n7.simplePDL/src/simplepdl/Resource.java @@ -0,0 +1,68 @@ +/** + */ +package simplepdl; + + +/** + * + * A representation of the model object 'Resource'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link simplepdl.Resource#getQuantity Quantity}
  • + *
  • {@link simplepdl.Resource#getName Name}
  • + *
+ * + * @see simplepdl.SimplepdlPackage#getResource() + * @model + * @generated + */ +public interface Resource extends ProcessElement { + /** + * Returns the value of the 'Quantity' attribute. + * + * + * @return the value of the 'Quantity' attribute. + * @see #setQuantity(int) + * @see simplepdl.SimplepdlPackage#getResource_Quantity() + * @model required="true" + * @generated + */ + int getQuantity(); + + /** + * Sets the value of the '{@link simplepdl.Resource#getQuantity Quantity}' attribute. + * + * + * @param value the new value of the 'Quantity' attribute. + * @see #getQuantity() + * @generated + */ + void setQuantity(int value); + + /** + * Returns the value of the 'Name' attribute. + * + * + * @return the value of the 'Name' attribute. + * @see #setName(String) + * @see simplepdl.SimplepdlPackage#getResource_Name() + * @model required="true" + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link simplepdl.Resource#getName Name}' attribute. + * + * + * @param value the new value of the 'Name' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + +} // Resource diff --git a/fr.n7.simplePDL/src/simplepdl/SimplepdlFactory.java b/fr.n7.simplePDL/src/simplepdl/SimplepdlFactory.java new file mode 100644 index 0000000..7e3c9c5 --- /dev/null +++ b/fr.n7.simplePDL/src/simplepdl/SimplepdlFactory.java @@ -0,0 +1,87 @@ +/** + */ +package simplepdl; + +import org.eclipse.emf.ecore.EFactory; + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @see simplepdl.SimplepdlPackage + * @generated + */ +public interface SimplepdlFactory extends EFactory { + /** + * The singleton instance of the factory. + * + * + * @generated + */ + SimplepdlFactory eINSTANCE = simplepdl.impl.SimplepdlFactoryImpl.init(); + + /** + * Returns a new object of class 'Work Definition'. + * + * + * @return a new object of class 'Work Definition'. + * @generated + */ + WorkDefinition createWorkDefinition(); + + /** + * Returns a new object of class 'Work Sequence'. + * + * + * @return a new object of class 'Work Sequence'. + * @generated + */ + WorkSequence createWorkSequence(); + + /** + * Returns a new object of class 'Guidance'. + * + * + * @return a new object of class 'Guidance'. + * @generated + */ + Guidance createGuidance(); + + /** + * Returns a new object of class 'Process'. + * + * + * @return a new object of class 'Process'. + * @generated + */ + Process createProcess(); + + /** + * Returns a new object of class 'Request'. + * + * + * @return a new object of class 'Request'. + * @generated + */ + Request createRequest(); + + /** + * Returns a new object of class 'Resource'. + * + * + * @return a new object of class 'Resource'. + * @generated + */ + Resource createResource(); + + /** + * Returns the package supported by this factory. + * + * + * @return the package supported by this factory. + * @generated + */ + SimplepdlPackage getSimplepdlPackage(); + +} //SimplepdlFactory diff --git a/fr.n7.simplePDL/src/simplepdl/SimplepdlPackage.java b/fr.n7.simplePDL/src/simplepdl/SimplepdlPackage.java new file mode 100644 index 0000000..2ec4af1 --- /dev/null +++ b/fr.n7.simplePDL/src/simplepdl/SimplepdlPackage.java @@ -0,0 +1,872 @@ +/** + */ +package simplepdl; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EEnum; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +/** + * + * The Package for the model. + * It contains accessors for the meta objects to represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each operation of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @see simplepdl.SimplepdlFactory + * @model kind="package" + * @generated + */ +public interface SimplepdlPackage extends EPackage { + /** + * The package name. + * + * + * @generated + */ + String eNAME = "simplepdl"; + + /** + * The package namespace URI. + * + * + * @generated + */ + String eNS_URI = "http://simplepdl"; + + /** + * The package namespace name. + * + * + * @generated + */ + String eNS_PREFIX = "simplepdl"; + + /** + * The singleton instance of the package. + * + * + * @generated + */ + SimplepdlPackage eINSTANCE = simplepdl.impl.SimplepdlPackageImpl.init(); + + /** + * The meta object id for the '{@link simplepdl.impl.ProcessElementImpl Process Element}' class. + * + * + * @see simplepdl.impl.ProcessElementImpl + * @see simplepdl.impl.SimplepdlPackageImpl#getProcessElement() + * @generated + */ + int PROCESS_ELEMENT = 0; + + /** + * The number of structural features of the 'Process Element' class. + * + * + * @generated + * @ordered + */ + int PROCESS_ELEMENT_FEATURE_COUNT = 0; + + /** + * The number of operations of the 'Process Element' class. + * + * + * @generated + * @ordered + */ + int PROCESS_ELEMENT_OPERATION_COUNT = 0; + + /** + * The meta object id for the '{@link simplepdl.impl.WorkDefinitionImpl Work Definition}' class. + * + * + * @see simplepdl.impl.WorkDefinitionImpl + * @see simplepdl.impl.SimplepdlPackageImpl#getWorkDefinition() + * @generated + */ + int WORK_DEFINITION = 1; + + /** + * The feature id for the 'Links To Predecessors' reference list. + * + * + * @generated + * @ordered + */ + int WORK_DEFINITION__LINKS_TO_PREDECESSORS = PROCESS_ELEMENT_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Links To Successors' reference list. + * + * + * @generated + * @ordered + */ + int WORK_DEFINITION__LINKS_TO_SUCCESSORS = PROCESS_ELEMENT_FEATURE_COUNT + 1; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + int WORK_DEFINITION__NAME = PROCESS_ELEMENT_FEATURE_COUNT + 2; + + /** + * The feature id for the 'Requests' containment reference list. + * + * + * @generated + * @ordered + */ + int WORK_DEFINITION__REQUESTS = PROCESS_ELEMENT_FEATURE_COUNT + 3; + + /** + * The number of structural features of the 'Work Definition' class. + * + * + * @generated + * @ordered + */ + int WORK_DEFINITION_FEATURE_COUNT = PROCESS_ELEMENT_FEATURE_COUNT + 4; + + /** + * The number of operations of the 'Work Definition' class. + * + * + * @generated + * @ordered + */ + int WORK_DEFINITION_OPERATION_COUNT = PROCESS_ELEMENT_OPERATION_COUNT + 0; + + /** + * The meta object id for the '{@link simplepdl.impl.WorkSequenceImpl Work Sequence}' class. + * + * + * @see simplepdl.impl.WorkSequenceImpl + * @see simplepdl.impl.SimplepdlPackageImpl#getWorkSequence() + * @generated + */ + int WORK_SEQUENCE = 2; + + /** + * The feature id for the 'Link Type' attribute. + * + * + * @generated + * @ordered + */ + int WORK_SEQUENCE__LINK_TYPE = PROCESS_ELEMENT_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Predecessor' reference. + * + * + * @generated + * @ordered + */ + int WORK_SEQUENCE__PREDECESSOR = PROCESS_ELEMENT_FEATURE_COUNT + 1; + + /** + * The feature id for the 'Successor' reference. + * + * + * @generated + * @ordered + */ + int WORK_SEQUENCE__SUCCESSOR = PROCESS_ELEMENT_FEATURE_COUNT + 2; + + /** + * The number of structural features of the 'Work Sequence' class. + * + * + * @generated + * @ordered + */ + int WORK_SEQUENCE_FEATURE_COUNT = PROCESS_ELEMENT_FEATURE_COUNT + 3; + + /** + * The number of operations of the 'Work Sequence' class. + * + * + * @generated + * @ordered + */ + int WORK_SEQUENCE_OPERATION_COUNT = PROCESS_ELEMENT_OPERATION_COUNT + 0; + + /** + * The meta object id for the '{@link simplepdl.impl.GuidanceImpl Guidance}' class. + * + * + * @see simplepdl.impl.GuidanceImpl + * @see simplepdl.impl.SimplepdlPackageImpl#getGuidance() + * @generated + */ + int GUIDANCE = 3; + + /** + * The feature id for the 'Text' attribute. + * + * + * @generated + * @ordered + */ + int GUIDANCE__TEXT = PROCESS_ELEMENT_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Elements' reference list. + * + * + * @generated + * @ordered + */ + int GUIDANCE__ELEMENTS = PROCESS_ELEMENT_FEATURE_COUNT + 1; + + /** + * The number of structural features of the 'Guidance' class. + * + * + * @generated + * @ordered + */ + int GUIDANCE_FEATURE_COUNT = PROCESS_ELEMENT_FEATURE_COUNT + 2; + + /** + * The number of operations of the 'Guidance' class. + * + * + * @generated + * @ordered + */ + int GUIDANCE_OPERATION_COUNT = PROCESS_ELEMENT_OPERATION_COUNT + 0; + + /** + * The meta object id for the '{@link simplepdl.impl.ProcessImpl Process}' class. + * + * + * @see simplepdl.impl.ProcessImpl + * @see simplepdl.impl.SimplepdlPackageImpl#getProcess() + * @generated + */ + int PROCESS = 4; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + int PROCESS__NAME = 0; + + /** + * The feature id for the 'Process Elements' containment reference list. + * + * + * @generated + * @ordered + */ + int PROCESS__PROCESS_ELEMENTS = 1; + + /** + * The number of structural features of the 'Process' class. + * + * + * @generated + * @ordered + */ + int PROCESS_FEATURE_COUNT = 2; + + /** + * The number of operations of the 'Process' class. + * + * + * @generated + * @ordered + */ + int PROCESS_OPERATION_COUNT = 0; + + /** + * The meta object id for the '{@link simplepdl.impl.RequestImpl Request}' class. + * + * + * @see simplepdl.impl.RequestImpl + * @see simplepdl.impl.SimplepdlPackageImpl#getRequest() + * @generated + */ + int REQUEST = 5; + + /** + * The feature id for the 'Quantity' attribute. + * + * + * @generated + * @ordered + */ + int REQUEST__QUANTITY = 0; + + /** + * The feature id for the 'Target' reference. + * + * + * @generated + * @ordered + */ + int REQUEST__TARGET = 1; + + /** + * The number of structural features of the 'Request' class. + * + * + * @generated + * @ordered + */ + int REQUEST_FEATURE_COUNT = 2; + + /** + * The number of operations of the 'Request' class. + * + * + * @generated + * @ordered + */ + int REQUEST_OPERATION_COUNT = 0; + + /** + * The meta object id for the '{@link simplepdl.impl.ResourceImpl Resource}' class. + * + * + * @see simplepdl.impl.ResourceImpl + * @see simplepdl.impl.SimplepdlPackageImpl#getResource() + * @generated + */ + int RESOURCE = 6; + + /** + * The feature id for the 'Quantity' attribute. + * + * + * @generated + * @ordered + */ + int RESOURCE__QUANTITY = PROCESS_ELEMENT_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + int RESOURCE__NAME = PROCESS_ELEMENT_FEATURE_COUNT + 1; + + /** + * The number of structural features of the 'Resource' class. + * + * + * @generated + * @ordered + */ + int RESOURCE_FEATURE_COUNT = PROCESS_ELEMENT_FEATURE_COUNT + 2; + + /** + * The number of operations of the 'Resource' class. + * + * + * @generated + * @ordered + */ + int RESOURCE_OPERATION_COUNT = PROCESS_ELEMENT_OPERATION_COUNT + 0; + + /** + * The meta object id for the '{@link simplepdl.WorkSequenceType Work Sequence Type}' enum. + * + * + * @see simplepdl.WorkSequenceType + * @see simplepdl.impl.SimplepdlPackageImpl#getWorkSequenceType() + * @generated + */ + int WORK_SEQUENCE_TYPE = 7; + + + /** + * Returns the meta object for class '{@link simplepdl.ProcessElement Process Element}'. + * + * + * @return the meta object for class 'Process Element'. + * @see simplepdl.ProcessElement + * @generated + */ + EClass getProcessElement(); + + /** + * Returns the meta object for class '{@link simplepdl.WorkDefinition Work Definition}'. + * + * + * @return the meta object for class 'Work Definition'. + * @see simplepdl.WorkDefinition + * @generated + */ + EClass getWorkDefinition(); + + /** + * Returns the meta object for the reference list '{@link simplepdl.WorkDefinition#getLinksToPredecessors Links To Predecessors}'. + * + * + * @return the meta object for the reference list 'Links To Predecessors'. + * @see simplepdl.WorkDefinition#getLinksToPredecessors() + * @see #getWorkDefinition() + * @generated + */ + EReference getWorkDefinition_LinksToPredecessors(); + + /** + * Returns the meta object for the reference list '{@link simplepdl.WorkDefinition#getLinksToSuccessors Links To Successors}'. + * + * + * @return the meta object for the reference list 'Links To Successors'. + * @see simplepdl.WorkDefinition#getLinksToSuccessors() + * @see #getWorkDefinition() + * @generated + */ + EReference getWorkDefinition_LinksToSuccessors(); + + /** + * Returns the meta object for the attribute '{@link simplepdl.WorkDefinition#getName Name}'. + * + * + * @return the meta object for the attribute 'Name'. + * @see simplepdl.WorkDefinition#getName() + * @see #getWorkDefinition() + * @generated + */ + EAttribute getWorkDefinition_Name(); + + /** + * Returns the meta object for the containment reference list '{@link simplepdl.WorkDefinition#getRequests Requests}'. + * + * + * @return the meta object for the containment reference list 'Requests'. + * @see simplepdl.WorkDefinition#getRequests() + * @see #getWorkDefinition() + * @generated + */ + EReference getWorkDefinition_Requests(); + + /** + * Returns the meta object for class '{@link simplepdl.WorkSequence Work Sequence}'. + * + * + * @return the meta object for class 'Work Sequence'. + * @see simplepdl.WorkSequence + * @generated + */ + EClass getWorkSequence(); + + /** + * Returns the meta object for the attribute '{@link simplepdl.WorkSequence#getLinkType Link Type}'. + * + * + * @return the meta object for the attribute 'Link Type'. + * @see simplepdl.WorkSequence#getLinkType() + * @see #getWorkSequence() + * @generated + */ + EAttribute getWorkSequence_LinkType(); + + /** + * Returns the meta object for the reference '{@link simplepdl.WorkSequence#getPredecessor Predecessor}'. + * + * + * @return the meta object for the reference 'Predecessor'. + * @see simplepdl.WorkSequence#getPredecessor() + * @see #getWorkSequence() + * @generated + */ + EReference getWorkSequence_Predecessor(); + + /** + * Returns the meta object for the reference '{@link simplepdl.WorkSequence#getSuccessor Successor}'. + * + * + * @return the meta object for the reference 'Successor'. + * @see simplepdl.WorkSequence#getSuccessor() + * @see #getWorkSequence() + * @generated + */ + EReference getWorkSequence_Successor(); + + /** + * Returns the meta object for class '{@link simplepdl.Guidance Guidance}'. + * + * + * @return the meta object for class 'Guidance'. + * @see simplepdl.Guidance + * @generated + */ + EClass getGuidance(); + + /** + * Returns the meta object for the attribute '{@link simplepdl.Guidance#getText Text}'. + * + * + * @return the meta object for the attribute 'Text'. + * @see simplepdl.Guidance#getText() + * @see #getGuidance() + * @generated + */ + EAttribute getGuidance_Text(); + + /** + * Returns the meta object for the reference list '{@link simplepdl.Guidance#getElements Elements}'. + * + * + * @return the meta object for the reference list 'Elements'. + * @see simplepdl.Guidance#getElements() + * @see #getGuidance() + * @generated + */ + EReference getGuidance_Elements(); + + /** + * Returns the meta object for class '{@link simplepdl.Process Process}'. + * + * + * @return the meta object for class 'Process'. + * @see simplepdl.Process + * @generated + */ + EClass getProcess(); + + /** + * Returns the meta object for the attribute '{@link simplepdl.Process#getName Name}'. + * + * + * @return the meta object for the attribute 'Name'. + * @see simplepdl.Process#getName() + * @see #getProcess() + * @generated + */ + EAttribute getProcess_Name(); + + /** + * Returns the meta object for the containment reference list '{@link simplepdl.Process#getProcessElements Process Elements}'. + * + * + * @return the meta object for the containment reference list 'Process Elements'. + * @see simplepdl.Process#getProcessElements() + * @see #getProcess() + * @generated + */ + EReference getProcess_ProcessElements(); + + /** + * Returns the meta object for class '{@link simplepdl.Request Request}'. + * + * + * @return the meta object for class 'Request'. + * @see simplepdl.Request + * @generated + */ + EClass getRequest(); + + /** + * Returns the meta object for the attribute '{@link simplepdl.Request#getQuantity Quantity}'. + * + * + * @return the meta object for the attribute 'Quantity'. + * @see simplepdl.Request#getQuantity() + * @see #getRequest() + * @generated + */ + EAttribute getRequest_Quantity(); + + /** + * Returns the meta object for the reference '{@link simplepdl.Request#getTarget Target}'. + * + * + * @return the meta object for the reference 'Target'. + * @see simplepdl.Request#getTarget() + * @see #getRequest() + * @generated + */ + EReference getRequest_Target(); + + /** + * Returns the meta object for class '{@link simplepdl.Resource Resource}'. + * + * + * @return the meta object for class 'Resource'. + * @see simplepdl.Resource + * @generated + */ + EClass getResource(); + + /** + * Returns the meta object for the attribute '{@link simplepdl.Resource#getQuantity Quantity}'. + * + * + * @return the meta object for the attribute 'Quantity'. + * @see simplepdl.Resource#getQuantity() + * @see #getResource() + * @generated + */ + EAttribute getResource_Quantity(); + + /** + * Returns the meta object for the attribute '{@link simplepdl.Resource#getName Name}'. + * + * + * @return the meta object for the attribute 'Name'. + * @see simplepdl.Resource#getName() + * @see #getResource() + * @generated + */ + EAttribute getResource_Name(); + + /** + * Returns the meta object for enum '{@link simplepdl.WorkSequenceType Work Sequence Type}'. + * + * + * @return the meta object for enum 'Work Sequence Type'. + * @see simplepdl.WorkSequenceType + * @generated + */ + EEnum getWorkSequenceType(); + + /** + * Returns the factory that creates the instances of the model. + * + * + * @return the factory that creates the instances of the model. + * @generated + */ + SimplepdlFactory getSimplepdlFactory(); + + /** + * + * Defines literals for the meta objects that represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each operation of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link simplepdl.impl.ProcessElementImpl Process Element}' class. + * + * + * @see simplepdl.impl.ProcessElementImpl + * @see simplepdl.impl.SimplepdlPackageImpl#getProcessElement() + * @generated + */ + EClass PROCESS_ELEMENT = eINSTANCE.getProcessElement(); + + /** + * The meta object literal for the '{@link simplepdl.impl.WorkDefinitionImpl Work Definition}' class. + * + * + * @see simplepdl.impl.WorkDefinitionImpl + * @see simplepdl.impl.SimplepdlPackageImpl#getWorkDefinition() + * @generated + */ + EClass WORK_DEFINITION = eINSTANCE.getWorkDefinition(); + + /** + * The meta object literal for the 'Links To Predecessors' reference list feature. + * + * + * @generated + */ + EReference WORK_DEFINITION__LINKS_TO_PREDECESSORS = eINSTANCE.getWorkDefinition_LinksToPredecessors(); + + /** + * The meta object literal for the 'Links To Successors' reference list feature. + * + * + * @generated + */ + EReference WORK_DEFINITION__LINKS_TO_SUCCESSORS = eINSTANCE.getWorkDefinition_LinksToSuccessors(); + + /** + * The meta object literal for the 'Name' attribute feature. + * + * + * @generated + */ + EAttribute WORK_DEFINITION__NAME = eINSTANCE.getWorkDefinition_Name(); + + /** + * The meta object literal for the 'Requests' containment reference list feature. + * + * + * @generated + */ + EReference WORK_DEFINITION__REQUESTS = eINSTANCE.getWorkDefinition_Requests(); + + /** + * The meta object literal for the '{@link simplepdl.impl.WorkSequenceImpl Work Sequence}' class. + * + * + * @see simplepdl.impl.WorkSequenceImpl + * @see simplepdl.impl.SimplepdlPackageImpl#getWorkSequence() + * @generated + */ + EClass WORK_SEQUENCE = eINSTANCE.getWorkSequence(); + + /** + * The meta object literal for the 'Link Type' attribute feature. + * + * + * @generated + */ + EAttribute WORK_SEQUENCE__LINK_TYPE = eINSTANCE.getWorkSequence_LinkType(); + + /** + * The meta object literal for the 'Predecessor' reference feature. + * + * + * @generated + */ + EReference WORK_SEQUENCE__PREDECESSOR = eINSTANCE.getWorkSequence_Predecessor(); + + /** + * The meta object literal for the 'Successor' reference feature. + * + * + * @generated + */ + EReference WORK_SEQUENCE__SUCCESSOR = eINSTANCE.getWorkSequence_Successor(); + + /** + * The meta object literal for the '{@link simplepdl.impl.GuidanceImpl Guidance}' class. + * + * + * @see simplepdl.impl.GuidanceImpl + * @see simplepdl.impl.SimplepdlPackageImpl#getGuidance() + * @generated + */ + EClass GUIDANCE = eINSTANCE.getGuidance(); + + /** + * The meta object literal for the 'Text' attribute feature. + * + * + * @generated + */ + EAttribute GUIDANCE__TEXT = eINSTANCE.getGuidance_Text(); + + /** + * The meta object literal for the 'Elements' reference list feature. + * + * + * @generated + */ + EReference GUIDANCE__ELEMENTS = eINSTANCE.getGuidance_Elements(); + + /** + * The meta object literal for the '{@link simplepdl.impl.ProcessImpl Process}' class. + * + * + * @see simplepdl.impl.ProcessImpl + * @see simplepdl.impl.SimplepdlPackageImpl#getProcess() + * @generated + */ + EClass PROCESS = eINSTANCE.getProcess(); + + /** + * The meta object literal for the 'Name' attribute feature. + * + * + * @generated + */ + EAttribute PROCESS__NAME = eINSTANCE.getProcess_Name(); + + /** + * The meta object literal for the 'Process Elements' containment reference list feature. + * + * + * @generated + */ + EReference PROCESS__PROCESS_ELEMENTS = eINSTANCE.getProcess_ProcessElements(); + + /** + * The meta object literal for the '{@link simplepdl.impl.RequestImpl Request}' class. + * + * + * @see simplepdl.impl.RequestImpl + * @see simplepdl.impl.SimplepdlPackageImpl#getRequest() + * @generated + */ + EClass REQUEST = eINSTANCE.getRequest(); + + /** + * The meta object literal for the 'Quantity' attribute feature. + * + * + * @generated + */ + EAttribute REQUEST__QUANTITY = eINSTANCE.getRequest_Quantity(); + + /** + * The meta object literal for the 'Target' reference feature. + * + * + * @generated + */ + EReference REQUEST__TARGET = eINSTANCE.getRequest_Target(); + + /** + * The meta object literal for the '{@link simplepdl.impl.ResourceImpl Resource}' class. + * + * + * @see simplepdl.impl.ResourceImpl + * @see simplepdl.impl.SimplepdlPackageImpl#getResource() + * @generated + */ + EClass RESOURCE = eINSTANCE.getResource(); + + /** + * The meta object literal for the 'Quantity' attribute feature. + * + * + * @generated + */ + EAttribute RESOURCE__QUANTITY = eINSTANCE.getResource_Quantity(); + + /** + * The meta object literal for the 'Name' attribute feature. + * + * + * @generated + */ + EAttribute RESOURCE__NAME = eINSTANCE.getResource_Name(); + + /** + * The meta object literal for the '{@link simplepdl.WorkSequenceType Work Sequence Type}' enum. + * + * + * @see simplepdl.WorkSequenceType + * @see simplepdl.impl.SimplepdlPackageImpl#getWorkSequenceType() + * @generated + */ + EEnum WORK_SEQUENCE_TYPE = eINSTANCE.getWorkSequenceType(); + + } + +} //SimplepdlPackage diff --git a/fr.n7.simplePDL/src/simplepdl/WorkDefinition.java b/fr.n7.simplePDL/src/simplepdl/WorkDefinition.java new file mode 100644 index 0000000..b4c6357 --- /dev/null +++ b/fr.n7.simplePDL/src/simplepdl/WorkDefinition.java @@ -0,0 +1,89 @@ +/** + */ +package simplepdl; + +import org.eclipse.emf.common.util.EList; + +/** + * + * A representation of the model object 'Work Definition'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link simplepdl.WorkDefinition#getLinksToPredecessors Links To Predecessors}
  • + *
  • {@link simplepdl.WorkDefinition#getLinksToSuccessors Links To Successors}
  • + *
  • {@link simplepdl.WorkDefinition#getName Name}
  • + *
  • {@link simplepdl.WorkDefinition#getRequests Requests}
  • + *
+ * + * @see simplepdl.SimplepdlPackage#getWorkDefinition() + * @model + * @generated + */ +public interface WorkDefinition extends ProcessElement { + /** + * Returns the value of the 'Links To Predecessors' reference list. + * The list contents are of type {@link simplepdl.WorkSequence}. + * It is bidirectional and its opposite is '{@link simplepdl.WorkSequence#getSuccessor Successor}'. + * + * + * @return the value of the 'Links To Predecessors' reference list. + * @see simplepdl.SimplepdlPackage#getWorkDefinition_LinksToPredecessors() + * @see simplepdl.WorkSequence#getSuccessor + * @model opposite="successor" + * @generated + */ + EList getLinksToPredecessors(); + + /** + * Returns the value of the 'Links To Successors' reference list. + * The list contents are of type {@link simplepdl.WorkSequence}. + * It is bidirectional and its opposite is '{@link simplepdl.WorkSequence#getPredecessor Predecessor}'. + * + * + * @return the value of the 'Links To Successors' reference list. + * @see simplepdl.SimplepdlPackage#getWorkDefinition_LinksToSuccessors() + * @see simplepdl.WorkSequence#getPredecessor + * @model opposite="predecessor" + * @generated + */ + EList getLinksToSuccessors(); + + /** + * Returns the value of the 'Name' attribute. + * + * + * @return the value of the 'Name' attribute. + * @see #setName(String) + * @see simplepdl.SimplepdlPackage#getWorkDefinition_Name() + * @model required="true" + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link simplepdl.WorkDefinition#getName Name}' attribute. + * + * + * @param value the new value of the 'Name' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + + /** + * Returns the value of the 'Requests' containment reference list. + * The list contents are of type {@link simplepdl.Request}. + * + * + * @return the value of the 'Requests' containment reference list. + * @see simplepdl.SimplepdlPackage#getWorkDefinition_Requests() + * @model containment="true" + * @generated + */ + EList getRequests(); + +} // WorkDefinition diff --git a/fr.n7.simplePDL/src/simplepdl/WorkSequence.java b/fr.n7.simplePDL/src/simplepdl/WorkSequence.java new file mode 100644 index 0000000..51755aa --- /dev/null +++ b/fr.n7.simplePDL/src/simplepdl/WorkSequence.java @@ -0,0 +1,98 @@ +/** + */ +package simplepdl; + + +/** + * + * A representation of the model object 'Work Sequence'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link simplepdl.WorkSequence#getLinkType Link Type}
  • + *
  • {@link simplepdl.WorkSequence#getPredecessor Predecessor}
  • + *
  • {@link simplepdl.WorkSequence#getSuccessor Successor}
  • + *
+ * + * @see simplepdl.SimplepdlPackage#getWorkSequence() + * @model + * @generated + */ +public interface WorkSequence extends ProcessElement { + /** + * Returns the value of the 'Link Type' attribute. + * The literals are from the enumeration {@link simplepdl.WorkSequenceType}. + * + * + * @return the value of the 'Link Type' attribute. + * @see simplepdl.WorkSequenceType + * @see #setLinkType(WorkSequenceType) + * @see simplepdl.SimplepdlPackage#getWorkSequence_LinkType() + * @model required="true" + * @generated + */ + WorkSequenceType getLinkType(); + + /** + * Sets the value of the '{@link simplepdl.WorkSequence#getLinkType Link Type}' attribute. + * + * + * @param value the new value of the 'Link Type' attribute. + * @see simplepdl.WorkSequenceType + * @see #getLinkType() + * @generated + */ + void setLinkType(WorkSequenceType value); + + /** + * Returns the value of the 'Predecessor' reference. + * It is bidirectional and its opposite is '{@link simplepdl.WorkDefinition#getLinksToSuccessors Links To Successors}'. + * + * + * @return the value of the 'Predecessor' reference. + * @see #setPredecessor(WorkDefinition) + * @see simplepdl.SimplepdlPackage#getWorkSequence_Predecessor() + * @see simplepdl.WorkDefinition#getLinksToSuccessors + * @model opposite="linksToSuccessors" required="true" + * @generated + */ + WorkDefinition getPredecessor(); + + /** + * Sets the value of the '{@link simplepdl.WorkSequence#getPredecessor Predecessor}' reference. + * + * + * @param value the new value of the 'Predecessor' reference. + * @see #getPredecessor() + * @generated + */ + void setPredecessor(WorkDefinition value); + + /** + * Returns the value of the 'Successor' reference. + * It is bidirectional and its opposite is '{@link simplepdl.WorkDefinition#getLinksToPredecessors Links To Predecessors}'. + * + * + * @return the value of the 'Successor' reference. + * @see #setSuccessor(WorkDefinition) + * @see simplepdl.SimplepdlPackage#getWorkSequence_Successor() + * @see simplepdl.WorkDefinition#getLinksToPredecessors + * @model opposite="linksToPredecessors" required="true" + * @generated + */ + WorkDefinition getSuccessor(); + + /** + * Sets the value of the '{@link simplepdl.WorkSequence#getSuccessor Successor}' reference. + * + * + * @param value the new value of the 'Successor' reference. + * @see #getSuccessor() + * @generated + */ + void setSuccessor(WorkDefinition value); + +} // WorkSequence diff --git a/fr.n7.simplePDL/src/simplepdl/WorkSequenceType.java b/fr.n7.simplePDL/src/simplepdl/WorkSequenceType.java new file mode 100644 index 0000000..a43c5a3 --- /dev/null +++ b/fr.n7.simplePDL/src/simplepdl/WorkSequenceType.java @@ -0,0 +1,252 @@ +/** + */ +package simplepdl; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Work Sequence Type', + * and utility methods for working with them. + * + * @see simplepdl.SimplepdlPackage#getWorkSequenceType() + * @model + * @generated + */ +public enum WorkSequenceType implements Enumerator { + /** + * The 'Start To Start' literal object. + * + * + * @see #START_TO_START_VALUE + * @generated + * @ordered + */ + START_TO_START(0, "startToStart", "startToStart"), + + /** + * The 'Finish To Start' literal object. + * + * + * @see #FINISH_TO_START_VALUE + * @generated + * @ordered + */ + FINISH_TO_START(1, "finishToStart", "finishToStart"), + + /** + * The 'Start To Finish' literal object. + * + * + * @see #START_TO_FINISH_VALUE + * @generated + * @ordered + */ + START_TO_FINISH(2, "startToFinish", "startToFinish"), + + /** + * The 'Finish To Finish' literal object. + * + * + * @see #FINISH_TO_FINISH_VALUE + * @generated + * @ordered + */ + FINISH_TO_FINISH(3, "finishToFinish", "finishToFinish"); + + /** + * The 'Start To Start' literal value. + * + * + * @see #START_TO_START + * @model name="startToStart" + * @generated + * @ordered + */ + public static final int START_TO_START_VALUE = 0; + + /** + * The 'Finish To Start' literal value. + * + * + * @see #FINISH_TO_START + * @model name="finishToStart" + * @generated + * @ordered + */ + public static final int FINISH_TO_START_VALUE = 1; + + /** + * The 'Start To Finish' literal value. + * + * + * @see #START_TO_FINISH + * @model name="startToFinish" + * @generated + * @ordered + */ + public static final int START_TO_FINISH_VALUE = 2; + + /** + * The 'Finish To Finish' literal value. + * + * + * @see #FINISH_TO_FINISH + * @model name="finishToFinish" + * @generated + * @ordered + */ + public static final int FINISH_TO_FINISH_VALUE = 3; + + /** + * An array of all the 'Work Sequence Type' enumerators. + * + * + * @generated + */ + private static final WorkSequenceType[] VALUES_ARRAY = + new WorkSequenceType[] { + START_TO_START, + FINISH_TO_START, + START_TO_FINISH, + FINISH_TO_FINISH, + }; + + /** + * A public read-only list of all the 'Work Sequence Type' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Work Sequence Type' literal with the specified literal value. + * + * + * @param literal the literal. + * @return the matching enumerator or null. + * @generated + */ + public static WorkSequenceType get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + WorkSequenceType result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Work Sequence Type' literal with the specified name. + * + * + * @param name the name. + * @return the matching enumerator or null. + * @generated + */ + public static WorkSequenceType getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + WorkSequenceType result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Work Sequence Type' literal with the specified integer value. + * + * + * @param value the integer value. + * @return the matching enumerator or null. + * @generated + */ + public static WorkSequenceType get(int value) { + switch (value) { + case START_TO_START_VALUE: return START_TO_START; + case FINISH_TO_START_VALUE: return FINISH_TO_START; + case START_TO_FINISH_VALUE: return START_TO_FINISH; + case FINISH_TO_FINISH_VALUE: return FINISH_TO_FINISH; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private WorkSequenceType(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //WorkSequenceType diff --git a/fr.n7.simplePDL/src/simplepdl/impl/GuidanceImpl.java b/fr.n7.simplePDL/src/simplepdl/impl/GuidanceImpl.java new file mode 100644 index 0000000..fb8f7a0 --- /dev/null +++ b/fr.n7.simplePDL/src/simplepdl/impl/GuidanceImpl.java @@ -0,0 +1,204 @@ +/** + */ +package simplepdl.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +import org.eclipse.emf.ecore.util.EObjectResolvingEList; + +import simplepdl.Guidance; +import simplepdl.ProcessElement; +import simplepdl.SimplepdlPackage; + +/** + * + * An implementation of the model object 'Guidance'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link simplepdl.impl.GuidanceImpl#getText Text}
  • + *
  • {@link simplepdl.impl.GuidanceImpl#getElements Elements}
  • + *
+ * + * @generated + */ +public class GuidanceImpl extends ProcessElementImpl implements Guidance { + /** + * The default value of the '{@link #getText() Text}' attribute. + * + * + * @see #getText() + * @generated + * @ordered + */ + protected static final String TEXT_EDEFAULT = null; + + /** + * The cached value of the '{@link #getText() Text}' attribute. + * + * + * @see #getText() + * @generated + * @ordered + */ + protected String text = TEXT_EDEFAULT; + + /** + * The cached value of the '{@link #getElements() Elements}' reference list. + * + * + * @see #getElements() + * @generated + * @ordered + */ + protected EList elements; + + /** + * + * + * @generated + */ + protected GuidanceImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return SimplepdlPackage.Literals.GUIDANCE; + } + + /** + * + * + * @generated + */ + public String getText() { + return text; + } + + /** + * + * + * @generated + */ + public void setText(String newText) { + String oldText = text; + text = newText; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SimplepdlPackage.GUIDANCE__TEXT, oldText, text)); + } + + /** + * + * + * @generated + */ + public EList getElements() { + if (elements == null) { + elements = new EObjectResolvingEList(ProcessElement.class, this, SimplepdlPackage.GUIDANCE__ELEMENTS); + } + return elements; + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case SimplepdlPackage.GUIDANCE__TEXT: + return getText(); + case SimplepdlPackage.GUIDANCE__ELEMENTS: + return getElements(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case SimplepdlPackage.GUIDANCE__TEXT: + setText((String)newValue); + return; + case SimplepdlPackage.GUIDANCE__ELEMENTS: + getElements().clear(); + getElements().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case SimplepdlPackage.GUIDANCE__TEXT: + setText(TEXT_EDEFAULT); + return; + case SimplepdlPackage.GUIDANCE__ELEMENTS: + getElements().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case SimplepdlPackage.GUIDANCE__TEXT: + return TEXT_EDEFAULT == null ? text != null : !TEXT_EDEFAULT.equals(text); + case SimplepdlPackage.GUIDANCE__ELEMENTS: + return elements != null && !elements.isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuilder result = new StringBuilder(super.toString()); + result.append(" (text: "); + result.append(text); + result.append(')'); + return result.toString(); + } + +} //GuidanceImpl diff --git a/fr.n7.simplePDL/src/simplepdl/impl/ProcessElementImpl.java b/fr.n7.simplePDL/src/simplepdl/impl/ProcessElementImpl.java new file mode 100644 index 0000000..0df9f5f --- /dev/null +++ b/fr.n7.simplePDL/src/simplepdl/impl/ProcessElementImpl.java @@ -0,0 +1,39 @@ +/** + */ +package simplepdl.impl; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; + +import simplepdl.ProcessElement; +import simplepdl.SimplepdlPackage; + +/** + * + * An implementation of the model object 'Process Element'. + * + * + * @generated + */ +public abstract class ProcessElementImpl extends MinimalEObjectImpl.Container implements ProcessElement { + /** + * + * + * @generated + */ + protected ProcessElementImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return SimplepdlPackage.Literals.PROCESS_ELEMENT; + } + +} //ProcessElementImpl diff --git a/fr.n7.simplePDL/src/simplepdl/impl/ProcessImpl.java b/fr.n7.simplePDL/src/simplepdl/impl/ProcessImpl.java new file mode 100644 index 0000000..a6908b3 --- /dev/null +++ b/fr.n7.simplePDL/src/simplepdl/impl/ProcessImpl.java @@ -0,0 +1,221 @@ +/** + */ +package simplepdl.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; + +import simplepdl.ProcessElement; +import simplepdl.SimplepdlPackage; + +/** + * + * An implementation of the model object 'Process'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link simplepdl.impl.ProcessImpl#getName Name}
  • + *
  • {@link simplepdl.impl.ProcessImpl#getProcessElements Process Elements}
  • + *
+ * + * @generated + */ +public class ProcessImpl extends MinimalEObjectImpl.Container implements simplepdl.Process { + /** + * The default value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected String name = NAME_EDEFAULT; + + /** + * The cached value of the '{@link #getProcessElements() Process Elements}' containment reference list. + * + * + * @see #getProcessElements() + * @generated + * @ordered + */ + protected EList processElements; + + /** + * + * + * @generated + */ + protected ProcessImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return SimplepdlPackage.Literals.PROCESS; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public void setName(String newName) { + String oldName = name; + name = newName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SimplepdlPackage.PROCESS__NAME, oldName, name)); + } + + /** + * + * + * @generated + */ + public EList getProcessElements() { + if (processElements == null) { + processElements = new EObjectContainmentEList(ProcessElement.class, this, SimplepdlPackage.PROCESS__PROCESS_ELEMENTS); + } + return processElements; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case SimplepdlPackage.PROCESS__PROCESS_ELEMENTS: + return ((InternalEList)getProcessElements()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case SimplepdlPackage.PROCESS__NAME: + return getName(); + case SimplepdlPackage.PROCESS__PROCESS_ELEMENTS: + return getProcessElements(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case SimplepdlPackage.PROCESS__NAME: + setName((String)newValue); + return; + case SimplepdlPackage.PROCESS__PROCESS_ELEMENTS: + getProcessElements().clear(); + getProcessElements().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case SimplepdlPackage.PROCESS__NAME: + setName(NAME_EDEFAULT); + return; + case SimplepdlPackage.PROCESS__PROCESS_ELEMENTS: + getProcessElements().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case SimplepdlPackage.PROCESS__NAME: + return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + case SimplepdlPackage.PROCESS__PROCESS_ELEMENTS: + return processElements != null && !processElements.isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuilder result = new StringBuilder(super.toString()); + result.append(" (name: "); + result.append(name); + result.append(')'); + return result.toString(); + } + +} //ProcessImpl diff --git a/fr.n7.simplePDL/src/simplepdl/impl/RequestImpl.java b/fr.n7.simplePDL/src/simplepdl/impl/RequestImpl.java new file mode 100644 index 0000000..4489022 --- /dev/null +++ b/fr.n7.simplePDL/src/simplepdl/impl/RequestImpl.java @@ -0,0 +1,225 @@ +/** + */ +package simplepdl.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; + +import simplepdl.Request; +import simplepdl.Resource; +import simplepdl.SimplepdlPackage; + +/** + * + * An implementation of the model object 'Request'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link simplepdl.impl.RequestImpl#getQuantity Quantity}
  • + *
  • {@link simplepdl.impl.RequestImpl#getTarget Target}
  • + *
+ * + * @generated + */ +public class RequestImpl extends MinimalEObjectImpl.Container implements Request { + /** + * The default value of the '{@link #getQuantity() Quantity}' attribute. + * + * + * @see #getQuantity() + * @generated + * @ordered + */ + protected static final int QUANTITY_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getQuantity() Quantity}' attribute. + * + * + * @see #getQuantity() + * @generated + * @ordered + */ + protected int quantity = QUANTITY_EDEFAULT; + + /** + * The cached value of the '{@link #getTarget() Target}' reference. + * + * + * @see #getTarget() + * @generated + * @ordered + */ + protected Resource target; + + /** + * + * + * @generated + */ + protected RequestImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return SimplepdlPackage.Literals.REQUEST; + } + + /** + * + * + * @generated + */ + public int getQuantity() { + return quantity; + } + + /** + * + * + * @generated + */ + public void setQuantity(int newQuantity) { + int oldQuantity = quantity; + quantity = newQuantity; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SimplepdlPackage.REQUEST__QUANTITY, oldQuantity, quantity)); + } + + /** + * + * + * @generated + */ + public Resource getTarget() { + if (target != null && target.eIsProxy()) { + InternalEObject oldTarget = (InternalEObject)target; + target = (Resource)eResolveProxy(oldTarget); + if (target != oldTarget) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, SimplepdlPackage.REQUEST__TARGET, oldTarget, target)); + } + } + return target; + } + + /** + * + * + * @generated + */ + public Resource basicGetTarget() { + return target; + } + + /** + * + * + * @generated + */ + public void setTarget(Resource newTarget) { + Resource oldTarget = target; + target = newTarget; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SimplepdlPackage.REQUEST__TARGET, oldTarget, target)); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case SimplepdlPackage.REQUEST__QUANTITY: + return getQuantity(); + case SimplepdlPackage.REQUEST__TARGET: + if (resolve) return getTarget(); + return basicGetTarget(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case SimplepdlPackage.REQUEST__QUANTITY: + setQuantity((Integer)newValue); + return; + case SimplepdlPackage.REQUEST__TARGET: + setTarget((Resource)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case SimplepdlPackage.REQUEST__QUANTITY: + setQuantity(QUANTITY_EDEFAULT); + return; + case SimplepdlPackage.REQUEST__TARGET: + setTarget((Resource)null); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case SimplepdlPackage.REQUEST__QUANTITY: + return quantity != QUANTITY_EDEFAULT; + case SimplepdlPackage.REQUEST__TARGET: + return target != null; + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuilder result = new StringBuilder(super.toString()); + result.append(" (quantity: "); + result.append(quantity); + result.append(')'); + return result.toString(); + } + +} //RequestImpl diff --git a/fr.n7.simplePDL/src/simplepdl/impl/ResourceImpl.java b/fr.n7.simplePDL/src/simplepdl/impl/ResourceImpl.java new file mode 100644 index 0000000..3c36103 --- /dev/null +++ b/fr.n7.simplePDL/src/simplepdl/impl/ResourceImpl.java @@ -0,0 +1,216 @@ +/** + */ +package simplepdl.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +import simplepdl.Resource; +import simplepdl.SimplepdlPackage; + +/** + * + * An implementation of the model object 'Resource'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link simplepdl.impl.ResourceImpl#getQuantity Quantity}
  • + *
  • {@link simplepdl.impl.ResourceImpl#getName Name}
  • + *
+ * + * @generated + */ +public class ResourceImpl extends ProcessElementImpl implements Resource { + /** + * The default value of the '{@link #getQuantity() Quantity}' attribute. + * + * + * @see #getQuantity() + * @generated + * @ordered + */ + protected static final int QUANTITY_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getQuantity() Quantity}' attribute. + * + * + * @see #getQuantity() + * @generated + * @ordered + */ + protected int quantity = QUANTITY_EDEFAULT; + + /** + * The default value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected String name = NAME_EDEFAULT; + + /** + * + * + * @generated + */ + protected ResourceImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return SimplepdlPackage.Literals.RESOURCE; + } + + /** + * + * + * @generated + */ + public int getQuantity() { + return quantity; + } + + /** + * + * + * @generated + */ + public void setQuantity(int newQuantity) { + int oldQuantity = quantity; + quantity = newQuantity; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SimplepdlPackage.RESOURCE__QUANTITY, oldQuantity, quantity)); + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public void setName(String newName) { + String oldName = name; + name = newName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SimplepdlPackage.RESOURCE__NAME, oldName, name)); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case SimplepdlPackage.RESOURCE__QUANTITY: + return getQuantity(); + case SimplepdlPackage.RESOURCE__NAME: + return getName(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case SimplepdlPackage.RESOURCE__QUANTITY: + setQuantity((Integer)newValue); + return; + case SimplepdlPackage.RESOURCE__NAME: + setName((String)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case SimplepdlPackage.RESOURCE__QUANTITY: + setQuantity(QUANTITY_EDEFAULT); + return; + case SimplepdlPackage.RESOURCE__NAME: + setName(NAME_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case SimplepdlPackage.RESOURCE__QUANTITY: + return quantity != QUANTITY_EDEFAULT; + case SimplepdlPackage.RESOURCE__NAME: + return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuilder result = new StringBuilder(super.toString()); + result.append(" (quantity: "); + result.append(quantity); + result.append(", name: "); + result.append(name); + result.append(')'); + return result.toString(); + } + +} //ResourceImpl diff --git a/fr.n7.simplePDL/src/simplepdl/impl/SimplepdlFactoryImpl.java b/fr.n7.simplePDL/src/simplepdl/impl/SimplepdlFactoryImpl.java new file mode 100644 index 0000000..90e5734 --- /dev/null +++ b/fr.n7.simplePDL/src/simplepdl/impl/SimplepdlFactoryImpl.java @@ -0,0 +1,208 @@ +/** + */ +package simplepdl.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; + +import simplepdl.Guidance; +import simplepdl.Request; +import simplepdl.Resource; +import simplepdl.SimplepdlFactory; +import simplepdl.SimplepdlPackage; +import simplepdl.WorkDefinition; +import simplepdl.WorkSequence; +import simplepdl.WorkSequenceType; + +/** + * + * An implementation of the model Factory. + * + * @generated + */ +public class SimplepdlFactoryImpl extends EFactoryImpl implements SimplepdlFactory { + /** + * Creates the default factory implementation. + * + * + * @generated + */ + public static SimplepdlFactory init() { + try { + SimplepdlFactory theSimplepdlFactory = (SimplepdlFactory)EPackage.Registry.INSTANCE.getEFactory(SimplepdlPackage.eNS_URI); + if (theSimplepdlFactory != null) { + return theSimplepdlFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new SimplepdlFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public SimplepdlFactoryImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case SimplepdlPackage.WORK_DEFINITION: return createWorkDefinition(); + case SimplepdlPackage.WORK_SEQUENCE: return createWorkSequence(); + case SimplepdlPackage.GUIDANCE: return createGuidance(); + case SimplepdlPackage.PROCESS: return createProcess(); + case SimplepdlPackage.REQUEST: return createRequest(); + case SimplepdlPackage.RESOURCE: return createResource(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + @Override + public Object createFromString(EDataType eDataType, String initialValue) { + switch (eDataType.getClassifierID()) { + case SimplepdlPackage.WORK_SEQUENCE_TYPE: + return createWorkSequenceTypeFromString(eDataType, initialValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + @Override + public String convertToString(EDataType eDataType, Object instanceValue) { + switch (eDataType.getClassifierID()) { + case SimplepdlPackage.WORK_SEQUENCE_TYPE: + return convertWorkSequenceTypeToString(eDataType, instanceValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public WorkDefinition createWorkDefinition() { + WorkDefinitionImpl workDefinition = new WorkDefinitionImpl(); + return workDefinition; + } + + /** + * + * + * @generated + */ + public WorkSequence createWorkSequence() { + WorkSequenceImpl workSequence = new WorkSequenceImpl(); + return workSequence; + } + + /** + * + * + * @generated + */ + public Guidance createGuidance() { + GuidanceImpl guidance = new GuidanceImpl(); + return guidance; + } + + /** + * + * + * @generated + */ + public simplepdl.Process createProcess() { + ProcessImpl process = new ProcessImpl(); + return process; + } + + /** + * + * + * @generated + */ + public Request createRequest() { + RequestImpl request = new RequestImpl(); + return request; + } + + /** + * + * + * @generated + */ + public Resource createResource() { + ResourceImpl resource = new ResourceImpl(); + return resource; + } + + /** + * + * + * @generated + */ + public WorkSequenceType createWorkSequenceTypeFromString(EDataType eDataType, String initialValue) { + WorkSequenceType result = WorkSequenceType.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertWorkSequenceTypeToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public SimplepdlPackage getSimplepdlPackage() { + return (SimplepdlPackage)getEPackage(); + } + + /** + * + * + * @deprecated + * @generated + */ + @Deprecated + public static SimplepdlPackage getPackage() { + return SimplepdlPackage.eINSTANCE; + } + +} //SimplepdlFactoryImpl diff --git a/fr.n7.simplePDL/src/simplepdl/impl/SimplepdlPackageImpl.java b/fr.n7.simplePDL/src/simplepdl/impl/SimplepdlPackageImpl.java new file mode 100644 index 0000000..67d8f2d --- /dev/null +++ b/fr.n7.simplePDL/src/simplepdl/impl/SimplepdlPackageImpl.java @@ -0,0 +1,489 @@ +/** + */ +package simplepdl.impl; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EEnum; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +import org.eclipse.emf.ecore.impl.EPackageImpl; + +import simplepdl.Guidance; +import simplepdl.ProcessElement; +import simplepdl.Request; +import simplepdl.Resource; +import simplepdl.SimplepdlFactory; +import simplepdl.SimplepdlPackage; +import simplepdl.WorkDefinition; +import simplepdl.WorkSequence; +import simplepdl.WorkSequenceType; + +/** + * + * An implementation of the model Package. + * + * @generated + */ +public class SimplepdlPackageImpl extends EPackageImpl implements SimplepdlPackage { + /** + * + * + * @generated + */ + private EClass processElementEClass = null; + + /** + * + * + * @generated + */ + private EClass workDefinitionEClass = null; + + /** + * + * + * @generated + */ + private EClass workSequenceEClass = null; + + /** + * + * + * @generated + */ + private EClass guidanceEClass = null; + + /** + * + * + * @generated + */ + private EClass processEClass = null; + + /** + * + * + * @generated + */ + private EClass requestEClass = null; + + /** + * + * + * @generated + */ + private EClass resourceEClass = null; + + /** + * + * + * @generated + */ + private EEnum workSequenceTypeEEnum = null; + + /** + * Creates an instance of the model Package, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + *

Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see simplepdl.SimplepdlPackage#eNS_URI + * @see #init() + * @generated + */ + private SimplepdlPackageImpl() { + super(eNS_URI, SimplepdlFactory.eINSTANCE); + } + + /** + * + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the Package for this model, and for any others upon which it depends. + * + *

This method is used to initialize {@link SimplepdlPackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static SimplepdlPackage init() { + if (isInited) return (SimplepdlPackage)EPackage.Registry.INSTANCE.getEPackage(SimplepdlPackage.eNS_URI); + + // Obtain or create and register package + Object registeredSimplepdlPackage = EPackage.Registry.INSTANCE.get(eNS_URI); + SimplepdlPackageImpl theSimplepdlPackage = registeredSimplepdlPackage instanceof SimplepdlPackageImpl ? (SimplepdlPackageImpl)registeredSimplepdlPackage : new SimplepdlPackageImpl(); + + isInited = true; + + // Create package meta-data objects + theSimplepdlPackage.createPackageContents(); + + // Initialize created meta-data + theSimplepdlPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theSimplepdlPackage.freeze(); + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(SimplepdlPackage.eNS_URI, theSimplepdlPackage); + return theSimplepdlPackage; + } + + /** + * + * + * @generated + */ + public EClass getProcessElement() { + return processElementEClass; + } + + /** + * + * + * @generated + */ + public EClass getWorkDefinition() { + return workDefinitionEClass; + } + + /** + * + * + * @generated + */ + public EReference getWorkDefinition_LinksToPredecessors() { + return (EReference)workDefinitionEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getWorkDefinition_LinksToSuccessors() { + return (EReference)workDefinitionEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EAttribute getWorkDefinition_Name() { + return (EAttribute)workDefinitionEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EReference getWorkDefinition_Requests() { + return (EReference)workDefinitionEClass.getEStructuralFeatures().get(3); + } + + /** + * + * + * @generated + */ + public EClass getWorkSequence() { + return workSequenceEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getWorkSequence_LinkType() { + return (EAttribute)workSequenceEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getWorkSequence_Predecessor() { + return (EReference)workSequenceEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EReference getWorkSequence_Successor() { + return (EReference)workSequenceEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EClass getGuidance() { + return guidanceEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getGuidance_Text() { + return (EAttribute)guidanceEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getGuidance_Elements() { + return (EReference)guidanceEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EClass getProcess() { + return processEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getProcess_Name() { + return (EAttribute)processEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getProcess_ProcessElements() { + return (EReference)processEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EClass getRequest() { + return requestEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getRequest_Quantity() { + return (EAttribute)requestEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getRequest_Target() { + return (EReference)requestEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EClass getResource() { + return resourceEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getResource_Quantity() { + return (EAttribute)resourceEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getResource_Name() { + return (EAttribute)resourceEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EEnum getWorkSequenceType() { + return workSequenceTypeEEnum; + } + + /** + * + * + * @generated + */ + public SimplepdlFactory getSimplepdlFactory() { + return (SimplepdlFactory)getEFactoryInstance(); + } + + /** + * + * + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + processElementEClass = createEClass(PROCESS_ELEMENT); + + workDefinitionEClass = createEClass(WORK_DEFINITION); + createEReference(workDefinitionEClass, WORK_DEFINITION__LINKS_TO_PREDECESSORS); + createEReference(workDefinitionEClass, WORK_DEFINITION__LINKS_TO_SUCCESSORS); + createEAttribute(workDefinitionEClass, WORK_DEFINITION__NAME); + createEReference(workDefinitionEClass, WORK_DEFINITION__REQUESTS); + + workSequenceEClass = createEClass(WORK_SEQUENCE); + createEAttribute(workSequenceEClass, WORK_SEQUENCE__LINK_TYPE); + createEReference(workSequenceEClass, WORK_SEQUENCE__PREDECESSOR); + createEReference(workSequenceEClass, WORK_SEQUENCE__SUCCESSOR); + + guidanceEClass = createEClass(GUIDANCE); + createEAttribute(guidanceEClass, GUIDANCE__TEXT); + createEReference(guidanceEClass, GUIDANCE__ELEMENTS); + + processEClass = createEClass(PROCESS); + createEAttribute(processEClass, PROCESS__NAME); + createEReference(processEClass, PROCESS__PROCESS_ELEMENTS); + + requestEClass = createEClass(REQUEST); + createEAttribute(requestEClass, REQUEST__QUANTITY); + createEReference(requestEClass, REQUEST__TARGET); + + resourceEClass = createEClass(RESOURCE); + createEAttribute(resourceEClass, RESOURCE__QUANTITY); + createEAttribute(resourceEClass, RESOURCE__NAME); + + // Create enums + workSequenceTypeEEnum = createEEnum(WORK_SEQUENCE_TYPE); + } + + /** + * + * + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void initializePackageContents() { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + workDefinitionEClass.getESuperTypes().add(this.getProcessElement()); + workSequenceEClass.getESuperTypes().add(this.getProcessElement()); + guidanceEClass.getESuperTypes().add(this.getProcessElement()); + resourceEClass.getESuperTypes().add(this.getProcessElement()); + + // Initialize classes, features, and operations; add parameters + initEClass(processElementEClass, ProcessElement.class, "ProcessElement", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + + initEClass(workDefinitionEClass, WorkDefinition.class, "WorkDefinition", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getWorkDefinition_LinksToPredecessors(), this.getWorkSequence(), this.getWorkSequence_Successor(), "linksToPredecessors", null, 0, -1, WorkDefinition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getWorkDefinition_LinksToSuccessors(), this.getWorkSequence(), this.getWorkSequence_Predecessor(), "linksToSuccessors", null, 0, -1, WorkDefinition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getWorkDefinition_Name(), ecorePackage.getEString(), "name", null, 1, 1, WorkDefinition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getWorkDefinition_Requests(), this.getRequest(), null, "requests", null, 0, -1, WorkDefinition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(workSequenceEClass, WorkSequence.class, "WorkSequence", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getWorkSequence_LinkType(), this.getWorkSequenceType(), "linkType", null, 1, 1, WorkSequence.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getWorkSequence_Predecessor(), this.getWorkDefinition(), this.getWorkDefinition_LinksToSuccessors(), "predecessor", null, 1, 1, WorkSequence.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getWorkSequence_Successor(), this.getWorkDefinition(), this.getWorkDefinition_LinksToPredecessors(), "successor", null, 1, 1, WorkSequence.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(guidanceEClass, Guidance.class, "Guidance", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getGuidance_Text(), ecorePackage.getEString(), "text", null, 1, 1, Guidance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getGuidance_Elements(), this.getProcessElement(), null, "elements", null, 0, -1, Guidance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(processEClass, simplepdl.Process.class, "Process", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getProcess_Name(), ecorePackage.getEString(), "name", null, 1, 1, simplepdl.Process.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getProcess_ProcessElements(), this.getProcessElement(), null, "processElements", null, 0, -1, simplepdl.Process.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(requestEClass, Request.class, "Request", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getRequest_Quantity(), ecorePackage.getEInt(), "quantity", null, 1, 1, Request.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getRequest_Target(), this.getResource(), null, "target", null, 1, 1, Request.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(resourceEClass, Resource.class, "Resource", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getResource_Quantity(), ecorePackage.getEInt(), "quantity", null, 1, 1, Resource.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getResource_Name(), ecorePackage.getEString(), "name", null, 1, 1, Resource.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + // Initialize enums and add enum literals + initEEnum(workSequenceTypeEEnum, WorkSequenceType.class, "WorkSequenceType"); + addEEnumLiteral(workSequenceTypeEEnum, WorkSequenceType.START_TO_START); + addEEnumLiteral(workSequenceTypeEEnum, WorkSequenceType.FINISH_TO_START); + addEEnumLiteral(workSequenceTypeEEnum, WorkSequenceType.START_TO_FINISH); + addEEnumLiteral(workSequenceTypeEEnum, WorkSequenceType.FINISH_TO_FINISH); + + // Create resource + createResource(eNS_URI); + } + +} //SimplepdlPackageImpl diff --git a/fr.n7.simplePDL/src/simplepdl/impl/WorkDefinitionImpl.java b/fr.n7.simplePDL/src/simplepdl/impl/WorkDefinitionImpl.java new file mode 100644 index 0000000..3e69f5f --- /dev/null +++ b/fr.n7.simplePDL/src/simplepdl/impl/WorkDefinitionImpl.java @@ -0,0 +1,312 @@ +/** + */ +package simplepdl.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList; +import org.eclipse.emf.ecore.util.InternalEList; + +import simplepdl.Request; +import simplepdl.SimplepdlPackage; +import simplepdl.WorkDefinition; +import simplepdl.WorkSequence; + +/** + * + * An implementation of the model object 'Work Definition'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link simplepdl.impl.WorkDefinitionImpl#getLinksToPredecessors Links To Predecessors}
  • + *
  • {@link simplepdl.impl.WorkDefinitionImpl#getLinksToSuccessors Links To Successors}
  • + *
  • {@link simplepdl.impl.WorkDefinitionImpl#getName Name}
  • + *
  • {@link simplepdl.impl.WorkDefinitionImpl#getRequests Requests}
  • + *
+ * + * @generated + */ +public class WorkDefinitionImpl extends ProcessElementImpl implements WorkDefinition { + /** + * The cached value of the '{@link #getLinksToPredecessors() Links To Predecessors}' reference list. + * + * + * @see #getLinksToPredecessors() + * @generated + * @ordered + */ + protected EList linksToPredecessors; + + /** + * The cached value of the '{@link #getLinksToSuccessors() Links To Successors}' reference list. + * + * + * @see #getLinksToSuccessors() + * @generated + * @ordered + */ + protected EList linksToSuccessors; + + /** + * The default value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected String name = NAME_EDEFAULT; + + /** + * The cached value of the '{@link #getRequests() Requests}' containment reference list. + * + * + * @see #getRequests() + * @generated + * @ordered + */ + protected EList requests; + + /** + * + * + * @generated + */ + protected WorkDefinitionImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return SimplepdlPackage.Literals.WORK_DEFINITION; + } + + /** + * + * + * @generated + */ + public EList getLinksToPredecessors() { + if (linksToPredecessors == null) { + linksToPredecessors = new EObjectWithInverseResolvingEList(WorkSequence.class, this, SimplepdlPackage.WORK_DEFINITION__LINKS_TO_PREDECESSORS, SimplepdlPackage.WORK_SEQUENCE__SUCCESSOR); + } + return linksToPredecessors; + } + + /** + * + * + * @generated + */ + public EList getLinksToSuccessors() { + if (linksToSuccessors == null) { + linksToSuccessors = new EObjectWithInverseResolvingEList(WorkSequence.class, this, SimplepdlPackage.WORK_DEFINITION__LINKS_TO_SUCCESSORS, SimplepdlPackage.WORK_SEQUENCE__PREDECESSOR); + } + return linksToSuccessors; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public void setName(String newName) { + String oldName = name; + name = newName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SimplepdlPackage.WORK_DEFINITION__NAME, oldName, name)); + } + + /** + * + * + * @generated + */ + public EList getRequests() { + if (requests == null) { + requests = new EObjectContainmentEList(Request.class, this, SimplepdlPackage.WORK_DEFINITION__REQUESTS); + } + return requests; + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case SimplepdlPackage.WORK_DEFINITION__LINKS_TO_PREDECESSORS: + return ((InternalEList)(InternalEList)getLinksToPredecessors()).basicAdd(otherEnd, msgs); + case SimplepdlPackage.WORK_DEFINITION__LINKS_TO_SUCCESSORS: + return ((InternalEList)(InternalEList)getLinksToSuccessors()).basicAdd(otherEnd, msgs); + } + return super.eInverseAdd(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case SimplepdlPackage.WORK_DEFINITION__LINKS_TO_PREDECESSORS: + return ((InternalEList)getLinksToPredecessors()).basicRemove(otherEnd, msgs); + case SimplepdlPackage.WORK_DEFINITION__LINKS_TO_SUCCESSORS: + return ((InternalEList)getLinksToSuccessors()).basicRemove(otherEnd, msgs); + case SimplepdlPackage.WORK_DEFINITION__REQUESTS: + return ((InternalEList)getRequests()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case SimplepdlPackage.WORK_DEFINITION__LINKS_TO_PREDECESSORS: + return getLinksToPredecessors(); + case SimplepdlPackage.WORK_DEFINITION__LINKS_TO_SUCCESSORS: + return getLinksToSuccessors(); + case SimplepdlPackage.WORK_DEFINITION__NAME: + return getName(); + case SimplepdlPackage.WORK_DEFINITION__REQUESTS: + return getRequests(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case SimplepdlPackage.WORK_DEFINITION__LINKS_TO_PREDECESSORS: + getLinksToPredecessors().clear(); + getLinksToPredecessors().addAll((Collection)newValue); + return; + case SimplepdlPackage.WORK_DEFINITION__LINKS_TO_SUCCESSORS: + getLinksToSuccessors().clear(); + getLinksToSuccessors().addAll((Collection)newValue); + return; + case SimplepdlPackage.WORK_DEFINITION__NAME: + setName((String)newValue); + return; + case SimplepdlPackage.WORK_DEFINITION__REQUESTS: + getRequests().clear(); + getRequests().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case SimplepdlPackage.WORK_DEFINITION__LINKS_TO_PREDECESSORS: + getLinksToPredecessors().clear(); + return; + case SimplepdlPackage.WORK_DEFINITION__LINKS_TO_SUCCESSORS: + getLinksToSuccessors().clear(); + return; + case SimplepdlPackage.WORK_DEFINITION__NAME: + setName(NAME_EDEFAULT); + return; + case SimplepdlPackage.WORK_DEFINITION__REQUESTS: + getRequests().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case SimplepdlPackage.WORK_DEFINITION__LINKS_TO_PREDECESSORS: + return linksToPredecessors != null && !linksToPredecessors.isEmpty(); + case SimplepdlPackage.WORK_DEFINITION__LINKS_TO_SUCCESSORS: + return linksToSuccessors != null && !linksToSuccessors.isEmpty(); + case SimplepdlPackage.WORK_DEFINITION__NAME: + return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + case SimplepdlPackage.WORK_DEFINITION__REQUESTS: + return requests != null && !requests.isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuilder result = new StringBuilder(super.toString()); + result.append(" (name: "); + result.append(name); + result.append(')'); + return result.toString(); + } + +} //WorkDefinitionImpl diff --git a/fr.n7.simplePDL/src/simplepdl/impl/WorkSequenceImpl.java b/fr.n7.simplePDL/src/simplepdl/impl/WorkSequenceImpl.java new file mode 100644 index 0000000..9e6ab81 --- /dev/null +++ b/fr.n7.simplePDL/src/simplepdl/impl/WorkSequenceImpl.java @@ -0,0 +1,366 @@ +/** + */ +package simplepdl.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +import simplepdl.SimplepdlPackage; +import simplepdl.WorkDefinition; +import simplepdl.WorkSequence; +import simplepdl.WorkSequenceType; + +/** + * + * An implementation of the model object 'Work Sequence'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link simplepdl.impl.WorkSequenceImpl#getLinkType Link Type}
  • + *
  • {@link simplepdl.impl.WorkSequenceImpl#getPredecessor Predecessor}
  • + *
  • {@link simplepdl.impl.WorkSequenceImpl#getSuccessor Successor}
  • + *
+ * + * @generated + */ +public class WorkSequenceImpl extends ProcessElementImpl implements WorkSequence { + /** + * The default value of the '{@link #getLinkType() Link Type}' attribute. + * + * + * @see #getLinkType() + * @generated + * @ordered + */ + protected static final WorkSequenceType LINK_TYPE_EDEFAULT = WorkSequenceType.START_TO_START; + + /** + * The cached value of the '{@link #getLinkType() Link Type}' attribute. + * + * + * @see #getLinkType() + * @generated + * @ordered + */ + protected WorkSequenceType linkType = LINK_TYPE_EDEFAULT; + + /** + * The cached value of the '{@link #getPredecessor() Predecessor}' reference. + * + * + * @see #getPredecessor() + * @generated + * @ordered + */ + protected WorkDefinition predecessor; + + /** + * The cached value of the '{@link #getSuccessor() Successor}' reference. + * + * + * @see #getSuccessor() + * @generated + * @ordered + */ + protected WorkDefinition successor; + + /** + * + * + * @generated + */ + protected WorkSequenceImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return SimplepdlPackage.Literals.WORK_SEQUENCE; + } + + /** + * + * + * @generated + */ + public WorkSequenceType getLinkType() { + return linkType; + } + + /** + * + * + * @generated + */ + public void setLinkType(WorkSequenceType newLinkType) { + WorkSequenceType oldLinkType = linkType; + linkType = newLinkType == null ? LINK_TYPE_EDEFAULT : newLinkType; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SimplepdlPackage.WORK_SEQUENCE__LINK_TYPE, oldLinkType, linkType)); + } + + /** + * + * + * @generated + */ + public WorkDefinition getPredecessor() { + if (predecessor != null && predecessor.eIsProxy()) { + InternalEObject oldPredecessor = (InternalEObject)predecessor; + predecessor = (WorkDefinition)eResolveProxy(oldPredecessor); + if (predecessor != oldPredecessor) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, SimplepdlPackage.WORK_SEQUENCE__PREDECESSOR, oldPredecessor, predecessor)); + } + } + return predecessor; + } + + /** + * + * + * @generated + */ + public WorkDefinition basicGetPredecessor() { + return predecessor; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetPredecessor(WorkDefinition newPredecessor, NotificationChain msgs) { + WorkDefinition oldPredecessor = predecessor; + predecessor = newPredecessor; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SimplepdlPackage.WORK_SEQUENCE__PREDECESSOR, oldPredecessor, newPredecessor); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setPredecessor(WorkDefinition newPredecessor) { + if (newPredecessor != predecessor) { + NotificationChain msgs = null; + if (predecessor != null) + msgs = ((InternalEObject)predecessor).eInverseRemove(this, SimplepdlPackage.WORK_DEFINITION__LINKS_TO_SUCCESSORS, WorkDefinition.class, msgs); + if (newPredecessor != null) + msgs = ((InternalEObject)newPredecessor).eInverseAdd(this, SimplepdlPackage.WORK_DEFINITION__LINKS_TO_SUCCESSORS, WorkDefinition.class, msgs); + msgs = basicSetPredecessor(newPredecessor, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SimplepdlPackage.WORK_SEQUENCE__PREDECESSOR, newPredecessor, newPredecessor)); + } + + /** + * + * + * @generated + */ + public WorkDefinition getSuccessor() { + if (successor != null && successor.eIsProxy()) { + InternalEObject oldSuccessor = (InternalEObject)successor; + successor = (WorkDefinition)eResolveProxy(oldSuccessor); + if (successor != oldSuccessor) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, SimplepdlPackage.WORK_SEQUENCE__SUCCESSOR, oldSuccessor, successor)); + } + } + return successor; + } + + /** + * + * + * @generated + */ + public WorkDefinition basicGetSuccessor() { + return successor; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetSuccessor(WorkDefinition newSuccessor, NotificationChain msgs) { + WorkDefinition oldSuccessor = successor; + successor = newSuccessor; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SimplepdlPackage.WORK_SEQUENCE__SUCCESSOR, oldSuccessor, newSuccessor); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setSuccessor(WorkDefinition newSuccessor) { + if (newSuccessor != successor) { + NotificationChain msgs = null; + if (successor != null) + msgs = ((InternalEObject)successor).eInverseRemove(this, SimplepdlPackage.WORK_DEFINITION__LINKS_TO_PREDECESSORS, WorkDefinition.class, msgs); + if (newSuccessor != null) + msgs = ((InternalEObject)newSuccessor).eInverseAdd(this, SimplepdlPackage.WORK_DEFINITION__LINKS_TO_PREDECESSORS, WorkDefinition.class, msgs); + msgs = basicSetSuccessor(newSuccessor, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SimplepdlPackage.WORK_SEQUENCE__SUCCESSOR, newSuccessor, newSuccessor)); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case SimplepdlPackage.WORK_SEQUENCE__PREDECESSOR: + if (predecessor != null) + msgs = ((InternalEObject)predecessor).eInverseRemove(this, SimplepdlPackage.WORK_DEFINITION__LINKS_TO_SUCCESSORS, WorkDefinition.class, msgs); + return basicSetPredecessor((WorkDefinition)otherEnd, msgs); + case SimplepdlPackage.WORK_SEQUENCE__SUCCESSOR: + if (successor != null) + msgs = ((InternalEObject)successor).eInverseRemove(this, SimplepdlPackage.WORK_DEFINITION__LINKS_TO_PREDECESSORS, WorkDefinition.class, msgs); + return basicSetSuccessor((WorkDefinition)otherEnd, msgs); + } + return super.eInverseAdd(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case SimplepdlPackage.WORK_SEQUENCE__PREDECESSOR: + return basicSetPredecessor(null, msgs); + case SimplepdlPackage.WORK_SEQUENCE__SUCCESSOR: + return basicSetSuccessor(null, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case SimplepdlPackage.WORK_SEQUENCE__LINK_TYPE: + return getLinkType(); + case SimplepdlPackage.WORK_SEQUENCE__PREDECESSOR: + if (resolve) return getPredecessor(); + return basicGetPredecessor(); + case SimplepdlPackage.WORK_SEQUENCE__SUCCESSOR: + if (resolve) return getSuccessor(); + return basicGetSuccessor(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case SimplepdlPackage.WORK_SEQUENCE__LINK_TYPE: + setLinkType((WorkSequenceType)newValue); + return; + case SimplepdlPackage.WORK_SEQUENCE__PREDECESSOR: + setPredecessor((WorkDefinition)newValue); + return; + case SimplepdlPackage.WORK_SEQUENCE__SUCCESSOR: + setSuccessor((WorkDefinition)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case SimplepdlPackage.WORK_SEQUENCE__LINK_TYPE: + setLinkType(LINK_TYPE_EDEFAULT); + return; + case SimplepdlPackage.WORK_SEQUENCE__PREDECESSOR: + setPredecessor((WorkDefinition)null); + return; + case SimplepdlPackage.WORK_SEQUENCE__SUCCESSOR: + setSuccessor((WorkDefinition)null); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case SimplepdlPackage.WORK_SEQUENCE__LINK_TYPE: + return linkType != LINK_TYPE_EDEFAULT; + case SimplepdlPackage.WORK_SEQUENCE__PREDECESSOR: + return predecessor != null; + case SimplepdlPackage.WORK_SEQUENCE__SUCCESSOR: + return successor != null; + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuilder result = new StringBuilder(super.toString()); + result.append(" (linkType: "); + result.append(linkType); + result.append(')'); + return result.toString(); + } + +} //WorkSequenceImpl diff --git a/fr.n7.simplePDL/src/simplepdl/util/SimplepdlAdapterFactory.java b/fr.n7.simplePDL/src/simplepdl/util/SimplepdlAdapterFactory.java new file mode 100644 index 0000000..cba0f24 --- /dev/null +++ b/fr.n7.simplePDL/src/simplepdl/util/SimplepdlAdapterFactory.java @@ -0,0 +1,234 @@ +/** + */ +package simplepdl.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; + +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; + +import org.eclipse.emf.ecore.EObject; + +import simplepdl.Guidance; +import simplepdl.ProcessElement; +import simplepdl.Request; +import simplepdl.Resource; +import simplepdl.SimplepdlPackage; +import simplepdl.WorkDefinition; +import simplepdl.WorkSequence; + +/** + * + * The Adapter Factory for the model. + * It provides an adapter createXXX method for each class of the model. + * + * @see simplepdl.SimplepdlPackage + * @generated + */ +public class SimplepdlAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * + * + * @generated + */ + protected static SimplepdlPackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * + * + * @generated + */ + public SimplepdlAdapterFactory() { + if (modelPackage == null) { + modelPackage = SimplepdlPackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * + * This implementation returns true if the object is either the model's package or is an instance object of the model. + * + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject)object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the createXXX methods. + * + * + * @generated + */ + protected SimplepdlSwitch modelSwitch = + new SimplepdlSwitch() { + @Override + public Adapter caseProcessElement(ProcessElement object) { + return createProcessElementAdapter(); + } + @Override + public Adapter caseWorkDefinition(WorkDefinition object) { + return createWorkDefinitionAdapter(); + } + @Override + public Adapter caseWorkSequence(WorkSequence object) { + return createWorkSequenceAdapter(); + } + @Override + public Adapter caseGuidance(Guidance object) { + return createGuidanceAdapter(); + } + @Override + public Adapter caseProcess(simplepdl.Process object) { + return createProcessAdapter(); + } + @Override + public Adapter caseRequest(Request object) { + return createRequestAdapter(); + } + @Override + public Adapter caseResource(Resource object) { + return createResourceAdapter(); + } + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the target. + * + * + * @param target the object to adapt. + * @return the adapter for the target. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject)target); + } + + + /** + * Creates a new adapter for an object of class '{@link simplepdl.ProcessElement Process Element}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see simplepdl.ProcessElement + * @generated + */ + public Adapter createProcessElementAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link simplepdl.WorkDefinition Work Definition}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see simplepdl.WorkDefinition + * @generated + */ + public Adapter createWorkDefinitionAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link simplepdl.WorkSequence Work Sequence}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see simplepdl.WorkSequence + * @generated + */ + public Adapter createWorkSequenceAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link simplepdl.Guidance Guidance}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see simplepdl.Guidance + * @generated + */ + public Adapter createGuidanceAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link simplepdl.Process Process}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see simplepdl.Process + * @generated + */ + public Adapter createProcessAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link simplepdl.Request Request}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see simplepdl.Request + * @generated + */ + public Adapter createRequestAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link simplepdl.Resource Resource}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see simplepdl.Resource + * @generated + */ + public Adapter createResourceAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * + * This default implementation returns null. + * + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} //SimplepdlAdapterFactory diff --git a/fr.n7.simplePDL/src/simplepdl/util/SimplepdlSwitch.java b/fr.n7.simplePDL/src/simplepdl/util/SimplepdlSwitch.java new file mode 100644 index 0000000..f780663 --- /dev/null +++ b/fr.n7.simplePDL/src/simplepdl/util/SimplepdlSwitch.java @@ -0,0 +1,246 @@ +/** + */ +package simplepdl.util; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.util.Switch; + +import simplepdl.Guidance; +import simplepdl.ProcessElement; +import simplepdl.Request; +import simplepdl.Resource; +import simplepdl.SimplepdlPackage; +import simplepdl.WorkDefinition; +import simplepdl.WorkSequence; + +/** + * + * The Switch for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the caseXXX method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * + * @see simplepdl.SimplepdlPackage + * @generated + */ +public class SimplepdlSwitch extends Switch { + /** + * The cached model package + * + * + * @generated + */ + protected static SimplepdlPackage modelPackage; + + /** + * Creates an instance of the switch. + * + * + * @generated + */ + public SimplepdlSwitch() { + if (modelPackage == null) { + modelPackage = SimplepdlPackage.eINSTANCE; + } + } + + /** + * Checks whether this is a switch for the given package. + * + * + * @param ePackage the package in question. + * @return whether this is a switch for the given package. + * @generated + */ + @Override + protected boolean isSwitchFor(EPackage ePackage) { + return ePackage == modelPackage; + } + + /** + * Calls caseXXX for each class of the model until one returns a non null result; it yields that result. + * + * + * @return the first non-null result returned by a caseXXX call. + * @generated + */ + @Override + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case SimplepdlPackage.PROCESS_ELEMENT: { + ProcessElement processElement = (ProcessElement)theEObject; + T result = caseProcessElement(processElement); + if (result == null) result = defaultCase(theEObject); + return result; + } + case SimplepdlPackage.WORK_DEFINITION: { + WorkDefinition workDefinition = (WorkDefinition)theEObject; + T result = caseWorkDefinition(workDefinition); + if (result == null) result = caseProcessElement(workDefinition); + if (result == null) result = defaultCase(theEObject); + return result; + } + case SimplepdlPackage.WORK_SEQUENCE: { + WorkSequence workSequence = (WorkSequence)theEObject; + T result = caseWorkSequence(workSequence); + if (result == null) result = caseProcessElement(workSequence); + if (result == null) result = defaultCase(theEObject); + return result; + } + case SimplepdlPackage.GUIDANCE: { + Guidance guidance = (Guidance)theEObject; + T result = caseGuidance(guidance); + if (result == null) result = caseProcessElement(guidance); + if (result == null) result = defaultCase(theEObject); + return result; + } + case SimplepdlPackage.PROCESS: { + simplepdl.Process process = (simplepdl.Process)theEObject; + T result = caseProcess(process); + if (result == null) result = defaultCase(theEObject); + return result; + } + case SimplepdlPackage.REQUEST: { + Request request = (Request)theEObject; + T result = caseRequest(request); + if (result == null) result = defaultCase(theEObject); + return result; + } + case SimplepdlPackage.RESOURCE: { + Resource resource = (Resource)theEObject; + T result = caseResource(resource); + if (result == null) result = caseProcessElement(resource); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of 'Process Element'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Process Element'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseProcessElement(ProcessElement object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Work Definition'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Work Definition'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseWorkDefinition(WorkDefinition object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Work Sequence'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Work Sequence'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseWorkSequence(WorkSequence object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Guidance'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Guidance'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseGuidance(Guidance object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Process'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Process'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseProcess(simplepdl.Process object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Request'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Request'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseRequest(Request object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Resource'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Resource'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseResource(Resource object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'EObject'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'EObject'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + @Override + public T defaultCase(EObject object) { + return null; + } + +} //SimplepdlSwitch