diff --git a/test.game b/test.game new file mode 100644 index 0000000..678a150 --- /dev/null +++ b/test.game @@ -0,0 +1,147 @@ +{ + "Explorateur": { + "taille": 3, + "connaissances": [], + "objets": [ + { + "nom": "tentative", + "qty": 3 + } + ] + }, + "Territoires": { + "Lieux": [ + { + "nom": "Énigme", + "description": "lieu de départ", + "deposable": "(false)", + "depart": "(true)", + "fin": "(false)", + "connaissances": [], + "personnes": [ + "Sphinx" + ], + "objets": [] + }, + { + "nom": "Succès", + "description": "lieu succès", + "deposable": "(false)", + "depart": "(false)", + "fin": "(true)", + "connaissances": [], + "personnes": [], + "objets": [] + }, + { + "nom": "Échec", + "description": "lieu échec", + "deposable": "(false)", + "depart": "(false)", + "fin": "(true)", + "connaissances": [], + "personnes": [], + "objets": [] + } + ], + "Chemins": [ + { + "lieu_in": "Énigme", + "lieu_out": "Succès", + "ouvert": "(true)", + "visible": "(connaissance_Réussite==1)", + "obligatoire": "(false)", + "connaissances_gift": [], + "objets_gift": [], + "objets_conso": [], + "descriptions": [ + { + "texte": "Le chemin de la victoire !", + "condition": "(true)" + } + ] + }, + { + "lieu_in": "Énigme", + "lieu_out": "Échec", + "ouvert": "(true)", + "visible": "(objet_tentatives==0)", + "obligatoire": "(false)", + "connaissances": [], + "objets": [], + "objets_conso": [], + "descriptions": [ + { + "texte": "Le chemin de la loose !", + "condition": "(true)" + } + ] + } + ] + }, + "Objets": [ + { + "nom": "tentative", + "taille": 1, + "visible": "(true)", + "descriptions": [ + { + "texte": "permet répondre une question du sphinx", + "condition": "(true)" + } + ] + } + ], + "Connaissances": [ + { + "nom": "Réussite", + "descriptions": [ + { + "nom": "Permet de se casser de là", + "condition": "(true)" + } + ] + } + ], + "Personnes": [ + { + "nom": "Sphinx", + "visible": "(true)", + "obligatoire": "(true)", + "interactions": [ + { + "connaissances_gift": [], + "objets_gift": [], + "visible": "(true)", + "actions": [ + { + "connaissances_gift": [ + "Réussite" + ], + "objets_gift": [], + "objets_conso": [ + { + "nom": "tentative", + "qty": 1 + } + ], + "visible": "(true)" + }, + { + "connaissances_gift": [], + "objets_gift": [], + "objets_conso": [ + { + "nom": "tentative", + "qty": 1 + } + ], + "visible": "(true)" + } + ] + } + ] + } + ], + "Transformations": [] +} \ No newline at end of file diff --git a/workspace/fr.n7.petrinet.edit/.classpath b/workspace/fr.n7.petrinet.edit/.classpath new file mode 100755 index 0000000..c3ba59e --- /dev/null +++ b/workspace/fr.n7.petrinet.edit/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/workspace/fr.n7.petrinet.edit/.project b/workspace/fr.n7.petrinet.edit/.project new file mode 100755 index 0000000..1b5afe6 --- /dev/null +++ b/workspace/fr.n7.petrinet.edit/.project @@ -0,0 +1,28 @@ + + + fr.n7.petrinet.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/workspace/fr.n7.petrinet.edit/META-INF/MANIFEST.MF b/workspace/fr.n7.petrinet.edit/META-INF/MANIFEST.MF new file mode 100755 index 0000000..b26fd94 --- /dev/null +++ b/workspace/fr.n7.petrinet.edit/META-INF/MANIFEST.MF @@ -0,0 +1,16 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: fr.n7.petrinet.edit;singleton:=true +Automatic-Module-Name: fr.n7.petrinet.edit +Bundle-Version: 1.0.0.qualifier +Bundle-ClassPath: . +Bundle-Activator: petrinet.provider.PetrinetEditPlugin$Implementation +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Export-Package: petrinet.provider +Require-Bundle: org.eclipse.core.runtime, + fr.n7.petrinet;visibility:=reexport, + org.eclipse.emf.edit;visibility:=reexport +Bundle-ActivationPolicy: lazy diff --git a/workspace/fr.n7.petrinet.edit/bin/.gitignore b/workspace/fr.n7.petrinet.edit/bin/.gitignore new file mode 100644 index 0000000..79b56a6 --- /dev/null +++ b/workspace/fr.n7.petrinet.edit/bin/.gitignore @@ -0,0 +1 @@ +/petrinet/ diff --git a/workspace/fr.n7.petrinet.edit/build.properties b/workspace/fr.n7.petrinet.edit/build.properties new file mode 100755 index 0000000..6e3e902 --- /dev/null +++ b/workspace/fr.n7.petrinet.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/workspace/fr.n7.petrinet.edit/icons/full/ctool16/CreateNetwork_nodes_Place.gif b/workspace/fr.n7.petrinet.edit/icons/full/ctool16/CreateNetwork_nodes_Place.gif new file mode 100755 index 0000000..03366e3 Binary files /dev/null and b/workspace/fr.n7.petrinet.edit/icons/full/ctool16/CreateNetwork_nodes_Place.gif differ diff --git a/workspace/fr.n7.petrinet.edit/icons/full/ctool16/CreateNetwork_nodes_Transition.gif b/workspace/fr.n7.petrinet.edit/icons/full/ctool16/CreateNetwork_nodes_Transition.gif new file mode 100755 index 0000000..0d4f530 Binary files /dev/null and b/workspace/fr.n7.petrinet.edit/icons/full/ctool16/CreateNetwork_nodes_Transition.gif differ diff --git a/workspace/fr.n7.petrinet.edit/icons/full/ctool16/CreateTransition_arcs_Arc.gif b/workspace/fr.n7.petrinet.edit/icons/full/ctool16/CreateTransition_arcs_Arc.gif new file mode 100755 index 0000000..b3c6924 Binary files /dev/null and b/workspace/fr.n7.petrinet.edit/icons/full/ctool16/CreateTransition_arcs_Arc.gif differ diff --git a/workspace/fr.n7.petrinet.edit/icons/full/obj16/Arc.gif b/workspace/fr.n7.petrinet.edit/icons/full/obj16/Arc.gif new file mode 100755 index 0000000..90d10f9 Binary files /dev/null and b/workspace/fr.n7.petrinet.edit/icons/full/obj16/Arc.gif differ diff --git a/workspace/fr.n7.petrinet.edit/icons/full/obj16/Network.gif b/workspace/fr.n7.petrinet.edit/icons/full/obj16/Network.gif new file mode 100755 index 0000000..5a9bc75 Binary files /dev/null and b/workspace/fr.n7.petrinet.edit/icons/full/obj16/Network.gif differ diff --git a/workspace/fr.n7.petrinet.edit/icons/full/obj16/Place.gif b/workspace/fr.n7.petrinet.edit/icons/full/obj16/Place.gif new file mode 100755 index 0000000..e4bc22d Binary files /dev/null and b/workspace/fr.n7.petrinet.edit/icons/full/obj16/Place.gif differ diff --git a/workspace/fr.n7.petrinet.edit/icons/full/obj16/Transition.gif b/workspace/fr.n7.petrinet.edit/icons/full/obj16/Transition.gif new file mode 100755 index 0000000..7bac4fd Binary files /dev/null and b/workspace/fr.n7.petrinet.edit/icons/full/obj16/Transition.gif differ diff --git a/workspace/fr.n7.petrinet.edit/plugin.properties b/workspace/fr.n7.petrinet.edit/plugin.properties new file mode 100755 index 0000000..5c86d9d --- /dev/null +++ b/workspace/fr.n7.petrinet.edit/plugin.properties @@ -0,0 +1,37 @@ +# + +pluginName = Petrinet 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_Network_type = Network +_UI_Node_type = Node +_UI_Place_type = Place +_UI_Arc_type = Arc +_UI_Transition_type = Transition +_UI_Unknown_type = Object + +_UI_Unknown_datatype= Value + +_UI_Network_name_feature = Name +_UI_Network_nodes_feature = Nodes +_UI_Node_name_feature = Name +_UI_Place_tokens_feature = Tokens +_UI_Arc_weight_feature = Weight +_UI_Arc_outgoing_feature = Outgoing +_UI_Arc_target_feature = Target +_UI_Transition_arcs_feature = Arcs +_UI_Unknown_feature = Unspecified + +_UI_Node_network_feature = Network +_UI_Place_arcs_feature = Arcs +_UI_Arc_place_feature = Place +_UI_Arc_transition_feature = Transition diff --git a/workspace/fr.n7.petrinet.edit/plugin.xml b/workspace/fr.n7.petrinet.edit/plugin.xml new file mode 100755 index 0000000..bf46da9 --- /dev/null +++ b/workspace/fr.n7.petrinet.edit/plugin.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + diff --git a/workspace/fr.n7.petrinet.edit/src/petrinet/provider/ArcItemProvider.java b/workspace/fr.n7.petrinet.edit/src/petrinet/provider/ArcItemProvider.java new file mode 100755 index 0000000..4aa20a5 --- /dev/null +++ b/workspace/fr.n7.petrinet.edit/src/petrinet/provider/ArcItemProvider.java @@ -0,0 +1,213 @@ +/** + */ +package petrinet.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 petrinet.Arc; +import petrinet.PetrinetPackage; +import petrinet.Place; +import petrinet.Transition; + +/** + * This is the item provider adapter for a {@link petrinet.Arc} object. + * + * + * @generated + */ +public class ArcItemProvider + extends ItemProviderAdapter + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * + * + * @generated + */ + public ArcItemProvider(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); + + addWeightPropertyDescriptor(object); + addOutgoingPropertyDescriptor(object); + addPlacePropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Weight feature. + * + * + * @generated + */ + protected void addWeightPropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Arc_weight_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_Arc_weight_feature", "_UI_Arc_type"), + PetrinetPackage.Literals.ARC__WEIGHT, + true, + false, + false, + ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, + null, + null)); + } + + /** + * This adds a property descriptor for the Outgoing feature. + * + * + * @generated + */ + protected void addOutgoingPropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Arc_outgoing_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_Arc_outgoing_feature", "_UI_Arc_type"), + PetrinetPackage.Literals.ARC__OUTGOING, + true, + false, + false, + ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, + null, + null)); + } + + /** + * This adds a property descriptor for the Place feature. + * + * + * @generated + */ + protected void addPlacePropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Arc_place_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_Arc_place_feature", "_UI_Arc_type"), + PetrinetPackage.Literals.ARC__PLACE, + true, + false, + true, + null, + null, + null)); + } + + /** + * This returns Arc.gif. + * + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/Arc")); + } + + /** + * This returns the label text for the adapted class. + * + * + * @generated NOT + */ + @Override + public String getText(Object object) { + Arc arc = (Arc)object; + Transition transition = arc.getTransition(); + Place place = arc.getPlace(); + int weight = arc.getWeight(); + boolean outgoing = arc.isOutgoing(); + return (outgoing) ? + transition.getName() + " --" + weight + "--> " + place.getName(): + place.getName() + " --" + weight + "--> " + transition.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 NOT + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(Arc.class)) { + case PetrinetPackage.ARC__PLACE: + case PetrinetPackage.ARC__TRANSITION: + case PetrinetPackage.ARC__WEIGHT: + case PetrinetPackage.ARC__OUTGOING: + 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 PetrinetEditPlugin.INSTANCE; + } + +} diff --git a/workspace/fr.n7.petrinet.edit/src/petrinet/provider/NetworkItemProvider.java b/workspace/fr.n7.petrinet.edit/src/petrinet/provider/NetworkItemProvider.java new file mode 100755 index 0000000..2894dbc --- /dev/null +++ b/workspace/fr.n7.petrinet.edit/src/petrinet/provider/NetworkItemProvider.java @@ -0,0 +1,204 @@ +/** + */ +package petrinet.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 petrinet.Network; +import petrinet.PetrinetFactory; +import petrinet.PetrinetPackage; + +/** + * This is the item provider adapter for a {@link petrinet.Network} object. + * + * + * @generated + */ +public class NetworkItemProvider + extends ItemProviderAdapter + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * + * + * @generated + */ + public NetworkItemProvider(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_Network_name_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_Network_name_feature", "_UI_Network_type"), + PetrinetPackage.Literals.NETWORK__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(PetrinetPackage.Literals.NETWORK__NODES); + } + 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 Network.gif. + * + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/Network")); + } + + /** + * This returns the label text for the adapted class. + * + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((Network)object).getName(); + return label == null || label.length() == 0 ? + getString("_UI_Network_type") : + getString("_UI_Network_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(Network.class)) { + case PetrinetPackage.NETWORK__NAME: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + case PetrinetPackage.NETWORK__NODES: + 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 + (PetrinetPackage.Literals.NETWORK__NODES, + PetrinetFactory.eINSTANCE.createPlace())); + + newChildDescriptors.add + (createChildParameter + (PetrinetPackage.Literals.NETWORK__NODES, + PetrinetFactory.eINSTANCE.createTransition())); + } + + /** + * Return the resource locator for this item provider's resources. + * + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + return PetrinetEditPlugin.INSTANCE; + } + +} diff --git a/workspace/fr.n7.petrinet.edit/src/petrinet/provider/NodeItemProvider.java b/workspace/fr.n7.petrinet.edit/src/petrinet/provider/NodeItemProvider.java new file mode 100755 index 0000000..b8f95ba --- /dev/null +++ b/workspace/fr.n7.petrinet.edit/src/petrinet/provider/NodeItemProvider.java @@ -0,0 +1,147 @@ +/** + */ +package petrinet.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 petrinet.Node; +import petrinet.PetrinetPackage; + +/** + * This is the item provider adapter for a {@link petrinet.Node} object. + * + * + * @generated + */ +public class NodeItemProvider + extends ItemProviderAdapter + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * + * + * @generated + */ + public NodeItemProvider(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_Node_name_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_Node_name_feature", "_UI_Node_type"), + PetrinetPackage.Literals.NODE__NAME, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This returns the label text for the adapted class. + * + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((Node)object).getName(); + return label == null || label.length() == 0 ? + getString("_UI_Node_type") : + getString("_UI_Node_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(Node.class)) { + case PetrinetPackage.NODE__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); + } + + /** + * Return the resource locator for this item provider's resources. + * + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + return PetrinetEditPlugin.INSTANCE; + } + +} diff --git a/workspace/fr.n7.petrinet.edit/src/petrinet/provider/PetrinetEditPlugin.java b/workspace/fr.n7.petrinet.edit/src/petrinet/provider/PetrinetEditPlugin.java new file mode 100755 index 0000000..e093afa --- /dev/null +++ b/workspace/fr.n7.petrinet.edit/src/petrinet/provider/PetrinetEditPlugin.java @@ -0,0 +1,89 @@ +/** + */ +package petrinet.provider; + +import org.eclipse.emf.common.EMFPlugin; + +import org.eclipse.emf.common.util.ResourceLocator; + +/** + * This is the central singleton for the Petrinet edit plugin. + * + * + * @generated + */ +public final class PetrinetEditPlugin extends EMFPlugin { + /** + * Keep track of the singleton. + * + * + * @generated + */ + public static final PetrinetEditPlugin INSTANCE = new PetrinetEditPlugin(); + + /** + * Keep track of the singleton. + * + * + * @generated + */ + private static Implementation plugin; + + /** + * Create the instance. + * + * + * @generated + */ + public PetrinetEditPlugin() { + 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/workspace/fr.n7.petrinet.edit/src/petrinet/provider/PetrinetItemProviderAdapterFactory.java b/workspace/fr.n7.petrinet.edit/src/petrinet/provider/PetrinetItemProviderAdapterFactory.java new file mode 100755 index 0000000..349dbe1 --- /dev/null +++ b/workspace/fr.n7.petrinet.edit/src/petrinet/provider/PetrinetItemProviderAdapterFactory.java @@ -0,0 +1,271 @@ +/** + */ +package petrinet.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 petrinet.util.PetrinetAdapterFactory; + +/** + * 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 PetrinetItemProviderAdapterFactory extends PetrinetAdapterFactory 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 PetrinetItemProviderAdapterFactory() { + 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 petrinet.Network} instances. + * + * + * @generated + */ + protected NetworkItemProvider networkItemProvider; + + /** + * This creates an adapter for a {@link petrinet.Network}. + * + * + * @generated + */ + @Override + public Adapter createNetworkAdapter() { + if (networkItemProvider == null) { + networkItemProvider = new NetworkItemProvider(this); + } + + return networkItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link petrinet.Place} instances. + * + * + * @generated + */ + protected PlaceItemProvider placeItemProvider; + + /** + * This creates an adapter for a {@link petrinet.Place}. + * + * + * @generated + */ + @Override + public Adapter createPlaceAdapter() { + if (placeItemProvider == null) { + placeItemProvider = new PlaceItemProvider(this); + } + + return placeItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link petrinet.Arc} instances. + * + * + * @generated + */ + protected ArcItemProvider arcItemProvider; + + /** + * This creates an adapter for a {@link petrinet.Arc}. + * + * + * @generated + */ + @Override + public Adapter createArcAdapter() { + if (arcItemProvider == null) { + arcItemProvider = new ArcItemProvider(this); + } + + return arcItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link petrinet.Transition} instances. + * + * + * @generated + */ + protected TransitionItemProvider transitionItemProvider; + + /** + * This creates an adapter for a {@link petrinet.Transition}. + * + * + * @generated + */ + @Override + public Adapter createTransitionAdapter() { + if (transitionItemProvider == null) { + transitionItemProvider = new TransitionItemProvider(this); + } + + return transitionItemProvider; + } + + /** + * 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 (networkItemProvider != null) networkItemProvider.dispose(); + if (placeItemProvider != null) placeItemProvider.dispose(); + if (arcItemProvider != null) arcItemProvider.dispose(); + if (transitionItemProvider != null) transitionItemProvider.dispose(); + } + +} diff --git a/workspace/fr.n7.petrinet.edit/src/petrinet/provider/PlaceItemProvider.java b/workspace/fr.n7.petrinet.edit/src/petrinet/provider/PlaceItemProvider.java new file mode 100755 index 0000000..fe7c895 --- /dev/null +++ b/workspace/fr.n7.petrinet.edit/src/petrinet/provider/PlaceItemProvider.java @@ -0,0 +1,155 @@ +/** + */ +package petrinet.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 petrinet.PetrinetPackage; +import petrinet.Place; + +/** + * This is the item provider adapter for a {@link petrinet.Place} object. + * + * + * @generated + */ +public class PlaceItemProvider extends NodeItemProvider { + /** + * This constructs an instance from a factory and a notifier. + * + * + * @generated + */ + public PlaceItemProvider(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); + + addTokensPropertyDescriptor(object); + addArcsPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Tokens feature. + * + * + * @generated + */ + protected void addTokensPropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Place_tokens_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_Place_tokens_feature", "_UI_Place_type"), + PetrinetPackage.Literals.PLACE__TOKENS, + true, + false, + false, + ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, + null, + null)); + } + + /** + * This adds a property descriptor for the Arcs feature. + * + * + * @generated + */ + protected void addArcsPropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Place_arcs_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_Place_arcs_feature", "_UI_Place_type"), + PetrinetPackage.Literals.PLACE__ARCS, + true, + false, + true, + null, + null, + null)); + } + + /** + * This returns Place.gif. + * + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/Place")); + } + + /** + * This returns the label text for the adapted class. + * + * + * @generated NOT + */ + @Override + public String getText(Object object) { + String label = ((Place)object).getName(); + return label == null || label.length() == 0 ? + getString("_UI_Place_type") : + getString("_UI_Place_type") + " " + label + " (" + ((Place)object).getTokens() +")"; + } + + + /** + * 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(Place.class)) { + case PetrinetPackage.PLACE__TOKENS: + 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/workspace/fr.n7.petrinet.edit/src/petrinet/provider/TransitionItemProvider.java b/workspace/fr.n7.petrinet.edit/src/petrinet/provider/TransitionItemProvider.java new file mode 100755 index 0000000..e3d92ab --- /dev/null +++ b/workspace/fr.n7.petrinet.edit/src/petrinet/provider/TransitionItemProvider.java @@ -0,0 +1,145 @@ +/** + */ +package petrinet.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.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ViewerNotification; + +import petrinet.PetrinetFactory; +import petrinet.PetrinetPackage; +import petrinet.Transition; + +/** + * This is the item provider adapter for a {@link petrinet.Transition} object. + * + * + * @generated + */ +public class TransitionItemProvider extends NodeItemProvider { + /** + * This constructs an instance from a factory and a notifier. + * + * + * @generated + */ + public TransitionItemProvider(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 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(PetrinetPackage.Literals.TRANSITION__ARCS); + } + 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 Transition.gif. + * + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/Transition")); + } + + /** + * This returns the label text for the adapted class. + * + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((Transition)object).getName(); + return label == null || label.length() == 0 ? + getString("_UI_Transition_type") : + getString("_UI_Transition_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(Transition.class)) { + case PetrinetPackage.TRANSITION__ARCS: + 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 + (PetrinetPackage.Literals.TRANSITION__ARCS, + PetrinetFactory.eINSTANCE.createArc())); + } + +} diff --git a/workspace/fr.n7.petrinet.editor/.classpath b/workspace/fr.n7.petrinet.editor/.classpath new file mode 100755 index 0000000..c3ba59e --- /dev/null +++ b/workspace/fr.n7.petrinet.editor/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/workspace/fr.n7.petrinet.editor/.project b/workspace/fr.n7.petrinet.editor/.project new file mode 100755 index 0000000..e7fc4ca --- /dev/null +++ b/workspace/fr.n7.petrinet.editor/.project @@ -0,0 +1,28 @@ + + + fr.n7.petrinet.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/workspace/fr.n7.petrinet.editor/META-INF/MANIFEST.MF b/workspace/fr.n7.petrinet.editor/META-INF/MANIFEST.MF new file mode 100755 index 0000000..699b7e3 --- /dev/null +++ b/workspace/fr.n7.petrinet.editor/META-INF/MANIFEST.MF @@ -0,0 +1,19 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: fr.n7.petrinet.editor;singleton:=true +Automatic-Module-Name: fr.n7.petrinet.editor +Bundle-Version: 1.0.0.qualifier +Bundle-ClassPath: . +Bundle-Activator: petrinet.presentation.PetrinetEditorPlugin$Implementation +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Export-Package: petrinet.presentation +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.core.resources;visibility:=reexport, + fr.n7.petrinet.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/workspace/fr.n7.petrinet.editor/bin/.gitignore b/workspace/fr.n7.petrinet.editor/bin/.gitignore new file mode 100644 index 0000000..79b56a6 --- /dev/null +++ b/workspace/fr.n7.petrinet.editor/bin/.gitignore @@ -0,0 +1 @@ +/petrinet/ diff --git a/workspace/fr.n7.petrinet.editor/build.properties b/workspace/fr.n7.petrinet.editor/build.properties new file mode 100755 index 0000000..5fb0771 --- /dev/null +++ b/workspace/fr.n7.petrinet.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/workspace/fr.n7.petrinet.editor/icons/full/obj16/PetrinetModelFile.gif b/workspace/fr.n7.petrinet.editor/icons/full/obj16/PetrinetModelFile.gif new file mode 100755 index 0000000..689b728 Binary files /dev/null and b/workspace/fr.n7.petrinet.editor/icons/full/obj16/PetrinetModelFile.gif differ diff --git a/workspace/fr.n7.petrinet.editor/icons/full/wizban/NewPetrinet.gif b/workspace/fr.n7.petrinet.editor/icons/full/wizban/NewPetrinet.gif new file mode 100755 index 0000000..e976e07 Binary files /dev/null and b/workspace/fr.n7.petrinet.editor/icons/full/wizban/NewPetrinet.gif differ diff --git a/workspace/fr.n7.petrinet.editor/plugin.properties b/workspace/fr.n7.petrinet.editor/plugin.properties new file mode 100755 index 0000000..ae2efaa --- /dev/null +++ b/workspace/fr.n7.petrinet.editor/plugin.properties @@ -0,0 +1,53 @@ +# + +pluginName = Petrinet Editor +providerName = www.example.org + +_UI_PetrinetEditor_menu = &Petrinet 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_PetrinetModelWizard_label = Petrinet Model +_UI_PetrinetModelWizard_description = Create a new Petrinet model + +_UI_PetrinetEditor_label = Petrinet Model Editor + +_UI_PetrinetEditorFilenameDefaultBase = My +_UI_PetrinetEditorFilenameExtensions = petrinet + +_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/workspace/fr.n7.petrinet.editor/plugin.xml b/workspace/fr.n7.petrinet.editor/plugin.xml new file mode 100755 index 0000000..c35f948 --- /dev/null +++ b/workspace/fr.n7.petrinet.editor/plugin.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + %_UI_PetrinetModelWizard_description + + + + + + + + + + + diff --git a/workspace/fr.n7.petrinet.editor/src/petrinet/presentation/PetrinetActionBarContributor.java b/workspace/fr.n7.petrinet.editor/src/petrinet/presentation/PetrinetActionBarContributor.java new file mode 100755 index 0000000..90027e3 --- /dev/null +++ b/workspace/fr.n7.petrinet.editor/src/petrinet/presentation/PetrinetActionBarContributor.java @@ -0,0 +1,424 @@ +/** + */ +package petrinet.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 Petrinet model editor. + * + * + * @generated + */ +public class PetrinetActionBarContributor + 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(PetrinetEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) { + @Override + public void run() { + try { + getPage().showView("org.eclipse.ui.views.PropertySheet"); + } + catch (PartInitException exception) { + PetrinetEditorPlugin.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(PetrinetEditorPlugin.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 PetrinetActionBarContributor() { + 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("petrinet-settings")); + toolBarManager.add(new Separator("petrinet-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(PetrinetEditorPlugin.INSTANCE.getString("_UI_PetrinetEditor_menu"), "petrinetMenuID"); + 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(PetrinetEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item")); + submenuManager.insertBefore("additions", createChildMenuManager); + + // Prepare for CreateSibling item addition or removal. + // + createSiblingMenuManager = new MenuManager(PetrinetEditorPlugin.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(PetrinetEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item")); + populateManager(submenuManager, createChildActions, null); + menuManager.insertBefore("edit", submenuManager); + + submenuManager = new MenuManager(PetrinetEditorPlugin.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/workspace/fr.n7.petrinet.editor/src/petrinet/presentation/PetrinetEditor.java b/workspace/fr.n7.petrinet.editor/src/petrinet/presentation/PetrinetEditor.java new file mode 100755 index 0000000..c209d42 --- /dev/null +++ b/workspace/fr.n7.petrinet.editor/src/petrinet/presentation/PetrinetEditor.java @@ -0,0 +1,1823 @@ +/** + */ +package petrinet.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 petrinet.provider.PetrinetItemProviderAdapterFactory; + +import org.eclipse.ui.actions.WorkspaceModifyOperation; + + +/** + * This is an example of a Petrinet model editor. + * + * + * @generated + */ +public class PetrinetEditor + 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(PetrinetEditor.this); + + setCurrentViewer(contentOutlineViewer); + } + } + else if (p instanceof PropertySheet) { + if (propertySheetPages.contains(((PropertySheet)p).getCurrentPage())) { + getActionBarContributor().setActiveEditor(PetrinetEditor.this); + handleActivate(); + } + } + else if (p == PetrinetEditor.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(PetrinetEditor.this, false); + } + } + }); + } + + if (!visitor.getChangedResources().isEmpty()) { + getSite().getShell().getDisplay().asyncExec + (new Runnable() { + public void run() { + changedResources.addAll(visitor.getChangedResources()); + if (getSite().getPage().getActiveEditor() == PetrinetEditor.this) { + handleActivate(); + } + } + }); + } + } + catch (CoreException exception) { + PetrinetEditorPlugin.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(PetrinetEditor.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.petrinet.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) { + PetrinetEditorPlugin.INSTANCE.log(exception); + } + } + + if (markerHelper.hasMarkers(editingDomain.getResourceSet())) { + try { + markerHelper.updateMarkers(diagnostic); + } + catch (CoreException exception) { + PetrinetEditorPlugin.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 PetrinetEditor() { + 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 PetrinetItemProviderAdapterFactory()); + 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.petrinet.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.petrinet.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(), PetrinetEditor.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(), PetrinetEditor.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(), PetrinetEditor.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(), PetrinetEditor.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(), PetrinetEditor.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(), PetrinetEditor.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) { + PetrinetEditor.this.setSelectionToViewer(selection); + PetrinetEditor.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. + // + PetrinetEditorPlugin.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 PetrinetEditorPlugin.INSTANCE.getString(key); + } + + /** + * This looks up a string in plugin.properties, making a substitution. + * + * + * @generated + */ + private static String getString(String key, Object s1) { + return PetrinetEditorPlugin.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/workspace/fr.n7.petrinet.editor/src/petrinet/presentation/PetrinetEditorPlugin.java b/workspace/fr.n7.petrinet.editor/src/petrinet/presentation/PetrinetEditorPlugin.java new file mode 100755 index 0000000..c36f292 --- /dev/null +++ b/workspace/fr.n7.petrinet.editor/src/petrinet/presentation/PetrinetEditorPlugin.java @@ -0,0 +1,91 @@ +/** + */ +package petrinet.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 Petrinet editor plugin. + * + * + * @generated + */ +public final class PetrinetEditorPlugin extends EMFPlugin { + /** + * Keep track of the singleton. + * + * + * @generated + */ + public static final PetrinetEditorPlugin INSTANCE = new PetrinetEditorPlugin(); + + /** + * Keep track of the singleton. + * + * + * @generated + */ + private static Implementation plugin; + + /** + * Create the instance. + * + * + * @generated + */ + public PetrinetEditorPlugin() { + 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/workspace/fr.n7.petrinet.editor/src/petrinet/presentation/PetrinetModelWizard.java b/workspace/fr.n7.petrinet.editor/src/petrinet/presentation/PetrinetModelWizard.java new file mode 100755 index 0000000..b49577d --- /dev/null +++ b/workspace/fr.n7.petrinet.editor/src/petrinet/presentation/PetrinetModelWizard.java @@ -0,0 +1,627 @@ +/** + */ +package petrinet.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 petrinet.PetrinetFactory; +import petrinet.PetrinetPackage; +import petrinet.provider.PetrinetEditPlugin; + + +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 PetrinetModelWizard extends Wizard implements INewWizard { + /** + * The supported extensions for created files. + * + * + * @generated + */ + public static final List FILE_EXTENSIONS = + Collections.unmodifiableList(Arrays.asList(PetrinetEditorPlugin.INSTANCE.getString("_UI_PetrinetEditorFilenameExtensions").split("\\s*,\\s*"))); + + /** + * A formatted list of supported file extensions, suitable for display. + * + * + * @generated + */ + public static final String FORMATTED_FILE_EXTENSIONS = + PetrinetEditorPlugin.INSTANCE.getString("_UI_PetrinetEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", "); + + /** + * This caches an instance of the model package. + * + * + * @generated + */ + protected PetrinetPackage petrinetPackage = PetrinetPackage.eINSTANCE; + + /** + * This caches an instance of the model factory. + * + * + * @generated + */ + protected PetrinetFactory petrinetFactory = petrinetPackage.getPetrinetFactory(); + + /** + * This is the file creation page. + * + * + * @generated + */ + protected PetrinetModelWizardNewFileCreationPage newFileCreationPage; + + /** + * This is the initial object creation page. + * + * + * @generated + */ + protected PetrinetModelWizardInitialObjectCreationPage 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(PetrinetEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); + setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(PetrinetEditorPlugin.INSTANCE.getImage("full/wizban/NewPetrinet"))); + } + + /** + * 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 : petrinetPackage.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)petrinetPackage.getEClassifier(initialObjectCreationPage.getInitialObjectName()); + EObject rootObject = petrinetFactory.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) { + PetrinetEditorPlugin.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(), PetrinetEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage()); + return false; + } + + return true; + } + catch (Exception exception) { + PetrinetEditorPlugin.INSTANCE.log(exception); + return false; + } + } + + /** + * This is the one page of the wizard. + * + * + * @generated + */ + public class PetrinetModelWizardNewFileCreationPage extends WizardNewFileCreationPage { + /** + * Pass in the selection. + * + * + * @generated + */ + public PetrinetModelWizardNewFileCreationPage(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(PetrinetEditorPlugin.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 PetrinetModelWizardInitialObjectCreationPage extends WizardPage { + /** + * + * + * @generated + */ + protected Combo initialObjectField; + + /** + * @generated + * + * + */ + protected List encodings; + + /** + * + * + * @generated + */ + protected Combo encodingField; + + /** + * Pass in the selection. + * + * + * @generated + */ + public PetrinetModelWizardInitialObjectCreationPage(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(PetrinetEditorPlugin.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(PetrinetEditorPlugin.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 PetrinetEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type"); + } + catch(MissingResourceException mre) { + PetrinetEditorPlugin.INSTANCE.log(mre); + } + return typeName; + } + + /** + * + * + * @generated + */ + protected Collection getEncodings() { + if (encodings == null) { + encodings = new ArrayList(); + for (StringTokenizer stringTokenizer = new StringTokenizer(PetrinetEditorPlugin.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 PetrinetModelWizardNewFileCreationPage("Whatever", selection); + newFileCreationPage.setTitle(PetrinetEditorPlugin.INSTANCE.getString("_UI_PetrinetModelWizard_label")); + newFileCreationPage.setDescription(PetrinetEditorPlugin.INSTANCE.getString("_UI_PetrinetModelWizard_description")); + newFileCreationPage.setFileName(PetrinetEditorPlugin.INSTANCE.getString("_UI_PetrinetEditorFilenameDefaultBase") + "." + 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 = PetrinetEditorPlugin.INSTANCE.getString("_UI_PetrinetEditorFilenameDefaultBase"); + 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 PetrinetModelWizardInitialObjectCreationPage("Whatever2"); + initialObjectCreationPage.setTitle(PetrinetEditorPlugin.INSTANCE.getString("_UI_PetrinetModelWizard_label")); + initialObjectCreationPage.setDescription(PetrinetEditorPlugin.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/workspace/fr.n7.petrinet.tests/.classpath b/workspace/fr.n7.petrinet.tests/.classpath new file mode 100755 index 0000000..c3ba59e --- /dev/null +++ b/workspace/fr.n7.petrinet.tests/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/workspace/fr.n7.petrinet.tests/.project b/workspace/fr.n7.petrinet.tests/.project new file mode 100755 index 0000000..a8cd606 --- /dev/null +++ b/workspace/fr.n7.petrinet.tests/.project @@ -0,0 +1,28 @@ + + + fr.n7.petrinet.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/workspace/fr.n7.petrinet.tests/META-INF/MANIFEST.MF b/workspace/fr.n7.petrinet.tests/META-INF/MANIFEST.MF new file mode 100755 index 0000000..a00fb6b --- /dev/null +++ b/workspace/fr.n7.petrinet.tests/META-INF/MANIFEST.MF @@ -0,0 +1,16 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: fr.n7.petrinet.tests;singleton:=true +Automatic-Module-Name: fr.n7.petrinet.tests +Bundle-Version: 1.0.0.qualifier +Bundle-ClassPath: . +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Export-Package: petrinet.tests +Require-Bundle: org.eclipse.core.runtime, + fr.n7.petrinet;visibility:=reexport, + org.eclipse.emf.ecore.xmi;visibility:=reexport, + org.junit;visibility:=reexport +Bundle-ActivationPolicy: lazy diff --git a/workspace/fr.n7.petrinet.tests/bin/.gitignore b/workspace/fr.n7.petrinet.tests/bin/.gitignore new file mode 100644 index 0000000..79b56a6 --- /dev/null +++ b/workspace/fr.n7.petrinet.tests/bin/.gitignore @@ -0,0 +1 @@ +/petrinet/ diff --git a/workspace/fr.n7.petrinet.tests/build.properties b/workspace/fr.n7.petrinet.tests/build.properties new file mode 100755 index 0000000..08af068 --- /dev/null +++ b/workspace/fr.n7.petrinet.tests/build.properties @@ -0,0 +1,8 @@ +# + +bin.includes = .,\ + META-INF/,\ + plugin.properties +jars.compile.order = . +source.. = src/ +output.. = bin/ diff --git a/workspace/fr.n7.petrinet.tests/plugin.properties b/workspace/fr.n7.petrinet.tests/plugin.properties new file mode 100755 index 0000000..d8d0263 --- /dev/null +++ b/workspace/fr.n7.petrinet.tests/plugin.properties @@ -0,0 +1,4 @@ +# + +pluginName = Petrinet Tests +providerName = www.example.org diff --git a/workspace/fr.n7.petrinet.tests/src/petrinet/tests/ArcTest.java b/workspace/fr.n7.petrinet.tests/src/petrinet/tests/ArcTest.java new file mode 100755 index 0000000..35e7c5a --- /dev/null +++ b/workspace/fr.n7.petrinet.tests/src/petrinet/tests/ArcTest.java @@ -0,0 +1,89 @@ +/** + */ +package petrinet.tests; + +import junit.framework.TestCase; + +import junit.textui.TestRunner; + +import petrinet.Arc; +import petrinet.PetrinetFactory; + +/** + * + * A test case for the model object 'Arc'. + * + * @generated + */ +public class ArcTest extends TestCase { + + /** + * The fixture for this Arc test case. + * + * + * @generated + */ + protected Arc fixture = null; + + /** + * + * + * @generated + */ + public static void main(String[] args) { + TestRunner.run(ArcTest.class); + } + + /** + * Constructs a new Arc test case with the given name. + * + * + * @generated + */ + public ArcTest(String name) { + super(name); + } + + /** + * Sets the fixture for this Arc test case. + * + * + * @generated + */ + protected void setFixture(Arc fixture) { + this.fixture = fixture; + } + + /** + * Returns the fixture for this Arc test case. + * + * + * @generated + */ + protected Arc getFixture() { + return fixture; + } + + /** + * + * + * @see junit.framework.TestCase#setUp() + * @generated + */ + @Override + protected void setUp() throws Exception { + setFixture(PetrinetFactory.eINSTANCE.createArc()); + } + + /** + * + * + * @see junit.framework.TestCase#tearDown() + * @generated + */ + @Override + protected void tearDown() throws Exception { + setFixture(null); + } + +} //ArcTest diff --git a/workspace/fr.n7.petrinet.tests/src/petrinet/tests/NetworkTest.java b/workspace/fr.n7.petrinet.tests/src/petrinet/tests/NetworkTest.java new file mode 100755 index 0000000..1db5cfb --- /dev/null +++ b/workspace/fr.n7.petrinet.tests/src/petrinet/tests/NetworkTest.java @@ -0,0 +1,89 @@ +/** + */ +package petrinet.tests; + +import junit.framework.TestCase; + +import junit.textui.TestRunner; + +import petrinet.Network; +import petrinet.PetrinetFactory; + +/** + * + * A test case for the model object 'Network'. + * + * @generated + */ +public class NetworkTest extends TestCase { + + /** + * The fixture for this Network test case. + * + * + * @generated + */ + protected Network fixture = null; + + /** + * + * + * @generated + */ + public static void main(String[] args) { + TestRunner.run(NetworkTest.class); + } + + /** + * Constructs a new Network test case with the given name. + * + * + * @generated + */ + public NetworkTest(String name) { + super(name); + } + + /** + * Sets the fixture for this Network test case. + * + * + * @generated + */ + protected void setFixture(Network fixture) { + this.fixture = fixture; + } + + /** + * Returns the fixture for this Network test case. + * + * + * @generated + */ + protected Network getFixture() { + return fixture; + } + + /** + * + * + * @see junit.framework.TestCase#setUp() + * @generated + */ + @Override + protected void setUp() throws Exception { + setFixture(PetrinetFactory.eINSTANCE.createNetwork()); + } + + /** + * + * + * @see junit.framework.TestCase#tearDown() + * @generated + */ + @Override + protected void tearDown() throws Exception { + setFixture(null); + } + +} //NetworkTest diff --git a/workspace/fr.n7.petrinet.tests/src/petrinet/tests/NodeTest.java b/workspace/fr.n7.petrinet.tests/src/petrinet/tests/NodeTest.java new file mode 100755 index 0000000..0f8f143 --- /dev/null +++ b/workspace/fr.n7.petrinet.tests/src/petrinet/tests/NodeTest.java @@ -0,0 +1,55 @@ +/** + */ +package petrinet.tests; + +import junit.framework.TestCase; + +import petrinet.Node; + +/** + * + * A test case for the model object 'Node'. + * + * @generated + */ +public abstract class NodeTest extends TestCase { + + /** + * The fixture for this Node test case. + * + * + * @generated + */ + protected Node fixture = null; + + /** + * Constructs a new Node test case with the given name. + * + * + * @generated + */ + public NodeTest(String name) { + super(name); + } + + /** + * Sets the fixture for this Node test case. + * + * + * @generated + */ + protected void setFixture(Node fixture) { + this.fixture = fixture; + } + + /** + * Returns the fixture for this Node test case. + * + * + * @generated + */ + protected Node getFixture() { + return fixture; + } + +} //NodeTest diff --git a/workspace/fr.n7.petrinet.tests/src/petrinet/tests/PetrinetAllTests.java b/workspace/fr.n7.petrinet.tests/src/petrinet/tests/PetrinetAllTests.java new file mode 100755 index 0000000..68778b7 --- /dev/null +++ b/workspace/fr.n7.petrinet.tests/src/petrinet/tests/PetrinetAllTests.java @@ -0,0 +1,46 @@ +/** + */ +package petrinet.tests; + +import junit.framework.Test; +import junit.framework.TestSuite; + +import junit.textui.TestRunner; + +/** + * + * A test suite for the 'Petrinet' model. + * + * @generated + */ +public class PetrinetAllTests extends TestSuite { + + /** + * + * + * @generated + */ + public static void main(String[] args) { + TestRunner.run(suite()); + } + + /** + * + * + * @generated + */ + public static Test suite() { + TestSuite suite = new PetrinetAllTests("Petrinet Tests"); + return suite; + } + + /** + * + * + * @generated + */ + public PetrinetAllTests(String name) { + super(name); + } + +} //PetrinetAllTests diff --git a/workspace/fr.n7.petrinet.tests/src/petrinet/tests/PetrinetExample.java b/workspace/fr.n7.petrinet.tests/src/petrinet/tests/PetrinetExample.java new file mode 100755 index 0000000..a0417c6 --- /dev/null +++ b/workspace/fr.n7.petrinet.tests/src/petrinet/tests/PetrinetExample.java @@ -0,0 +1,121 @@ +/** + */ +package petrinet.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 petrinet.Network; +import petrinet.PetrinetFactory; +import petrinet.PetrinetPackage; + +/** + * + * A sample utility for the 'petrinet' package. + * + * @generated + */ +public class PetrinetExample { + /** + * + * 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 + (PetrinetPackage.eNS_URI, + PetrinetPackage.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.petrinet")); + Network root = PetrinetFactory.eINSTANCE.createNetwork(); + 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 + " "); + } + } + +} //PetrinetExample diff --git a/workspace/fr.n7.petrinet.tests/src/petrinet/tests/PetrinetTests.java b/workspace/fr.n7.petrinet.tests/src/petrinet/tests/PetrinetTests.java new file mode 100755 index 0000000..0fb58fd --- /dev/null +++ b/workspace/fr.n7.petrinet.tests/src/petrinet/tests/PetrinetTests.java @@ -0,0 +1,46 @@ +/** + */ +package petrinet.tests; + +import junit.framework.Test; +import junit.framework.TestSuite; + +import junit.textui.TestRunner; + +/** + * + * A test suite for the 'petrinet' package. + * + * @generated + */ +public class PetrinetTests extends TestSuite { + + /** + * + * + * @generated + */ + public static void main(String[] args) { + TestRunner.run(suite()); + } + + /** + * + * + * @generated + */ + public static Test suite() { + TestSuite suite = new PetrinetTests("petrinet Tests"); + return suite; + } + + /** + * + * + * @generated + */ + public PetrinetTests(String name) { + super(name); + } + +} //PetrinetTests diff --git a/workspace/fr.n7.petrinet.tests/src/petrinet/tests/PlaceTest.java b/workspace/fr.n7.petrinet.tests/src/petrinet/tests/PlaceTest.java new file mode 100755 index 0000000..19ff730 --- /dev/null +++ b/workspace/fr.n7.petrinet.tests/src/petrinet/tests/PlaceTest.java @@ -0,0 +1,70 @@ +/** + */ +package petrinet.tests; + +import junit.textui.TestRunner; + +import petrinet.PetrinetFactory; +import petrinet.Place; + +/** + * + * A test case for the model object 'Place'. + * + * @generated + */ +public class PlaceTest extends NodeTest { + + /** + * + * + * @generated + */ + public static void main(String[] args) { + TestRunner.run(PlaceTest.class); + } + + /** + * Constructs a new Place test case with the given name. + * + * + * @generated + */ + public PlaceTest(String name) { + super(name); + } + + /** + * Returns the fixture for this Place test case. + * + * + * @generated + */ + @Override + protected Place getFixture() { + return (Place)fixture; + } + + /** + * + * + * @see junit.framework.TestCase#setUp() + * @generated + */ + @Override + protected void setUp() throws Exception { + setFixture(PetrinetFactory.eINSTANCE.createPlace()); + } + + /** + * + * + * @see junit.framework.TestCase#tearDown() + * @generated + */ + @Override + protected void tearDown() throws Exception { + setFixture(null); + } + +} //PlaceTest diff --git a/workspace/fr.n7.petrinet.tests/src/petrinet/tests/TransitionTest.java b/workspace/fr.n7.petrinet.tests/src/petrinet/tests/TransitionTest.java new file mode 100755 index 0000000..eb87365 --- /dev/null +++ b/workspace/fr.n7.petrinet.tests/src/petrinet/tests/TransitionTest.java @@ -0,0 +1,70 @@ +/** + */ +package petrinet.tests; + +import junit.textui.TestRunner; + +import petrinet.PetrinetFactory; +import petrinet.Transition; + +/** + * + * A test case for the model object 'Transition'. + * + * @generated + */ +public class TransitionTest extends NodeTest { + + /** + * + * + * @generated + */ + public static void main(String[] args) { + TestRunner.run(TransitionTest.class); + } + + /** + * Constructs a new Transition test case with the given name. + * + * + * @generated + */ + public TransitionTest(String name) { + super(name); + } + + /** + * Returns the fixture for this Transition test case. + * + * + * @generated + */ + @Override + protected Transition getFixture() { + return (Transition)fixture; + } + + /** + * + * + * @see junit.framework.TestCase#setUp() + * @generated + */ + @Override + protected void setUp() throws Exception { + setFixture(PetrinetFactory.eINSTANCE.createTransition()); + } + + /** + * + * + * @see junit.framework.TestCase#tearDown() + * @generated + */ + @Override + protected void tearDown() throws Exception { + setFixture(null); + } + +} //TransitionTest diff --git a/workspace/fr.n7.petrinet.toTINA.ui/.classpath b/workspace/fr.n7.petrinet.toTINA.ui/.classpath new file mode 100755 index 0000000..64c5e31 --- /dev/null +++ b/workspace/fr.n7.petrinet.toTINA.ui/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/workspace/fr.n7.petrinet.toTINA.ui/.project b/workspace/fr.n7.petrinet.toTINA.ui/.project new file mode 100755 index 0000000..123d85f --- /dev/null +++ b/workspace/fr.n7.petrinet.toTINA.ui/.project @@ -0,0 +1,28 @@ + + + fr.n7.petrinet.toTINA.ui + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/workspace/fr.n7.petrinet.toTINA.ui/.settings/org.eclipse.jdt.core.prefs b/workspace/fr.n7.petrinet.toTINA.ui/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 0000000..d1c0bf9 --- /dev/null +++ b/workspace/fr.n7.petrinet.toTINA.ui/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/workspace/fr.n7.petrinet.toTINA.ui/META-INF/MANIFEST.MF b/workspace/fr.n7.petrinet.toTINA.ui/META-INF/MANIFEST.MF new file mode 100755 index 0000000..697ac8f --- /dev/null +++ b/workspace/fr.n7.petrinet.toTINA.ui/META-INF/MANIFEST.MF @@ -0,0 +1,20 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Acceleo ToTINA Module IDE Plug-in +Bundle-SymbolicName: fr.n7.petrinet.toTINA.ui;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: fr.n7.petrinet.toTINA.ui.Activator +Bundle-Vendor: Eclipse Modeling Project +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.core.resources, + fr.n7.petrinet.toTINA, + org.eclipse.emf.ecore, + org.eclipse.emf.ecore.xmi, + org.eclipse.ocl, + org.eclipse.ocl.ecore, + org.eclipse.acceleo.model, + org.eclipse.acceleo.engine +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-ActivationPolicy: lazy +Eclipse-LazyStart: true diff --git a/workspace/fr.n7.petrinet.toTINA.ui/build.properties b/workspace/fr.n7.petrinet.toTINA.ui/build.properties new file mode 100755 index 0000000..d0a0e71 --- /dev/null +++ b/workspace/fr.n7.petrinet.toTINA.ui/build.properties @@ -0,0 +1,7 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + icons/ + diff --git a/workspace/fr.n7.petrinet.toTINA.ui/icons/default.gif b/workspace/fr.n7.petrinet.toTINA.ui/icons/default.gif new file mode 100755 index 0000000..6a04c49 Binary files /dev/null and b/workspace/fr.n7.petrinet.toTINA.ui/icons/default.gif differ diff --git a/workspace/fr.n7.petrinet.toTINA.ui/plugin.xml b/workspace/fr.n7.petrinet.toTINA.ui/plugin.xml new file mode 100755 index 0000000..9979f98 --- /dev/null +++ b/workspace/fr.n7.petrinet.toTINA.ui/plugin.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + diff --git a/workspace/fr.n7.petrinet.toTINA.ui/src/fr/n7/petrinet/toTINA/ui/Activator.java b/workspace/fr.n7.petrinet.toTINA.ui/src/fr/n7/petrinet/toTINA/ui/Activator.java new file mode 100755 index 0000000..3a27a92 --- /dev/null +++ b/workspace/fr.n7.petrinet.toTINA.ui/src/fr/n7/petrinet/toTINA/ui/Activator.java @@ -0,0 +1,66 @@ +/******************************************************************************* + * Copyright (c) 2008, 2012 Obeo. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package fr.n7.petrinet.toTINA.ui; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle. + */ +public class Activator extends AbstractUIPlugin { + + /** + * The plug-in ID. + */ + public static final String PLUGIN_ID = "fr.n7.petrinet.toTINA.ui"; + + /** + * The shared instance. + */ + private static Activator plugin; + + /** + * The constructor. + */ + public Activator() { + } + + /**{@inheritDoc} + * + * @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext) + * @generated + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /**{@inheritDoc} + * + * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext) + * @generated + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance. + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/workspace/fr.n7.petrinet.toTINA.ui/src/fr/n7/petrinet/toTINA/ui/common/GenerateAll.java b/workspace/fr.n7.petrinet.toTINA.ui/src/fr/n7/petrinet/toTINA/ui/common/GenerateAll.java new file mode 100755 index 0000000..5c1db85 --- /dev/null +++ b/workspace/fr.n7.petrinet.toTINA.ui/src/fr/n7/petrinet/toTINA/ui/common/GenerateAll.java @@ -0,0 +1,86 @@ +/******************************************************************************* + * Copyright (c) 2008, 2012 Obeo. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package fr.n7.petrinet.toTINA.ui.common; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.emf.common.util.BasicMonitor; +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.common.util.URI; + + +/** + * Main entry point of the 'ToTINA' generation module. + */ +public class GenerateAll { + + /** + * The model URI. + */ + private URI modelURI; + + /** + * The output folder. + */ + private IContainer targetFolder; + + /** + * The other arguments. + */ + List arguments; + + /** + * Constructor. + * + * @param modelURI + * is the URI of the model. + * @param targetFolder + * is the output folder + * @param arguments + * are the other arguments + * @throws IOException + * Thrown when the output cannot be saved. + * @generated + */ + public GenerateAll(URI modelURI, IContainer targetFolder, List arguments) { + this.modelURI = modelURI; + this.targetFolder = targetFolder; + this.arguments = arguments; + } + + /** + * Launches the generation. + * + * @param monitor + * This will be used to display progress information to the user. + * @throws IOException + * Thrown when the output cannot be saved. + * @generated + */ + public void doGenerate(IProgressMonitor monitor) throws IOException { + if (!targetFolder.getLocation().toFile().exists()) { + targetFolder.getLocation().toFile().mkdirs(); + } + + monitor.subTask("Loading..."); + fr.n7.petrinet.toTINA.main.ToTINA gen0 = new fr.n7.petrinet.toTINA.main.ToTINA(modelURI, targetFolder.getLocation().toFile(), arguments); + monitor.worked(1); + String generationID = org.eclipse.acceleo.engine.utils.AcceleoLaunchingUtil.computeUIProjectID("fr.n7.petrinet.toTINA", "fr.n7.petrinet.toTINA.main.ToTINA", modelURI.toString(), targetFolder.getFullPath().toString(), new ArrayList()); + gen0.setGenerationID(generationID); + gen0.doGenerate(BasicMonitor.toMonitor(monitor)); + + + } + +} diff --git a/workspace/fr.n7.petrinet.toTINA.ui/src/fr/n7/petrinet/toTINA/ui/popupMenus/AcceleoGenerateToTINAAction.java b/workspace/fr.n7.petrinet.toTINA.ui/src/fr/n7/petrinet/toTINA/ui/popupMenus/AcceleoGenerateToTINAAction.java new file mode 100755 index 0000000..a866ef6 --- /dev/null +++ b/workspace/fr.n7.petrinet.toTINA.ui/src/fr/n7/petrinet/toTINA/ui/popupMenus/AcceleoGenerateToTINAAction.java @@ -0,0 +1,116 @@ +/******************************************************************************* + * Copyright (c) 2008, 2012 Obeo. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package fr.n7.petrinet.toTINA.ui.popupMenus; + +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.util.Iterator; +import java.util.List; +import java.util.ArrayList; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.emf.common.util.URI; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import fr.n7.petrinet.toTINA.ui.Activator; +import fr.n7.petrinet.toTINA.ui.common.GenerateAll; +import org.eclipse.ui.IActionDelegate; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.actions.ActionDelegate; + +/** + * ToTINA code generation. + */ +public class AcceleoGenerateToTINAAction extends ActionDelegate implements IActionDelegate { + + /** + * Selected model files. + */ + protected List files; + + /**{@inheritDoc} + * + * @see org.eclipse.ui.actions.ActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) + * @generated + */ + @SuppressWarnings("unchecked") + public void selectionChanged(IAction action, ISelection selection) { + if (selection instanceof IStructuredSelection) { + files = ((IStructuredSelection) selection).toList(); + } + } + + /**{@inheritDoc} + * + * @see org.eclipse.ui.actions.ActionDelegate#run(org.eclipse.jface.action.IAction) + * @generated + */ + public void run(IAction action) { + if (files != null) { + IRunnableWithProgress operation = new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) { + try { + Iterator filesIt = files.iterator(); + while (filesIt.hasNext()) { + IFile model = (IFile)filesIt.next(); + URI modelURI = URI.createPlatformResourceURI(model.getFullPath().toString(), true); + IContainer targetFolder = null; + try { + IContainer target = model.getProject().getFolder("src-gen"); + targetFolder = target; + GenerateAll generator = new GenerateAll(modelURI, targetFolder, getArguments()); + generator.doGenerate(monitor); + } catch (IOException e) { + IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e); + Activator.getDefault().getLog().log(status); + } finally { + if (targetFolder != null) { + targetFolder.getProject().refreshLocal(IResource.DEPTH_INFINITE, monitor); + } + } + } + } catch (CoreException e) { + IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e); + Activator.getDefault().getLog().log(status); + } + } + }; + try { + PlatformUI.getWorkbench().getProgressService().run(true, true, operation); + } catch (InvocationTargetException e) { + IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e); + Activator.getDefault().getLog().log(status); + } catch (InterruptedException e) { + IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e); + Activator.getDefault().getLog().log(status); + } + } + } + + /** + * Computes the arguments of the generator. + * + * @return the arguments + * @generated + */ + protected List getArguments() { + return new ArrayList(); + } + +} \ No newline at end of file diff --git a/workspace/fr.n7.petrinet.toTINA/.classpath b/workspace/fr.n7.petrinet.toTINA/.classpath new file mode 100755 index 0000000..91dbd49 --- /dev/null +++ b/workspace/fr.n7.petrinet.toTINA/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/workspace/fr.n7.petrinet.toTINA/.project b/workspace/fr.n7.petrinet.toTINA/.project new file mode 100755 index 0000000..828c245 --- /dev/null +++ b/workspace/fr.n7.petrinet.toTINA/.project @@ -0,0 +1,50 @@ + + + fr.n7.petrinet.toTINA + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + org.eclipse.acceleo.ide.ui.acceleoBuilder + + + compilation.kind + compilation.platform.resource + + + compliance + pragmatic + + + resource.kind + xmi + + + trim-position + false + + + + + + org.eclipse.acceleo.ide.ui.acceleoNature + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + diff --git a/workspace/fr.n7.petrinet.toTINA/META-INF/MANIFEST.MF b/workspace/fr.n7.petrinet.toTINA/META-INF/MANIFEST.MF new file mode 100755 index 0000000..43907e0 --- /dev/null +++ b/workspace/fr.n7.petrinet.toTINA/META-INF/MANIFEST.MF @@ -0,0 +1,24 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Acceleo ToTINA Module Runtime Plug-in +Bundle-SymbolicName: fr.n7.petrinet.toTINA +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: fr.n7.petrinet.toTINA.Activator +Bundle-Vendor: Eclipse Modeling Project +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.emf.ecore, + org.eclipse.emf.ecore, + org.eclipse.emf.ecore.xmi, + org.eclipse.ocl, + org.eclipse.ocl.ecore, + org.eclipse.acceleo.common;bundle-version="3.3.0", + org.eclipse.acceleo.model;bundle-version="3.3.0", + org.eclipse.acceleo.profiler;bundle-version="3.3.0", + org.eclipse.acceleo.engine;bundle-version="3.3.0", + com.google.guava +Bundle-RequiredExecutionEnvironment: JavaSE-11 +Bundle-ActivationPolicy: lazy +Eclipse-LazyStart: true +Export-Package: fr.n7.petrinet.toTINA.main +Import-Package: petrinet + diff --git a/workspace/fr.n7.petrinet.toTINA/bin/.gitignore b/workspace/fr.n7.petrinet.toTINA/bin/.gitignore new file mode 100644 index 0000000..44fde90 --- /dev/null +++ b/workspace/fr.n7.petrinet.toTINA/bin/.gitignore @@ -0,0 +1 @@ +/fr/ diff --git a/workspace/fr.n7.petrinet.toTINA/build.properties b/workspace/fr.n7.petrinet.toTINA/build.properties new file mode 100755 index 0000000..3230056 --- /dev/null +++ b/workspace/fr.n7.petrinet.toTINA/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . +jre.compilation.profile = JavaSE-11 diff --git a/workspace/fr.n7.petrinet.toTINA/src/fr/n7/petrinet/toTINA/Activator.java b/workspace/fr.n7.petrinet.toTINA/src/fr/n7/petrinet/toTINA/Activator.java new file mode 100755 index 0000000..50a5a2e --- /dev/null +++ b/workspace/fr.n7.petrinet.toTINA/src/fr/n7/petrinet/toTINA/Activator.java @@ -0,0 +1,66 @@ +/******************************************************************************* + * Copyright (c) 2008, 2011 Obeo. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package fr.n7.petrinet.toTINA; + +import org.eclipse.core.runtime.Plugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle. + */ +public class Activator extends Plugin { + + /** + * The plug-in ID. + */ + public static final String PLUGIN_ID = "fr.n7.petrinet.toTINA"; + + /** + * The shared instance. + */ + private static Activator plugin; + + /** + * The constructor. + */ + public Activator() { + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance. + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/workspace/fr.n7.petrinet.toTINA/src/fr/n7/petrinet/toTINA/main/ToTINA.java b/workspace/fr.n7.petrinet.toTINA/src/fr/n7/petrinet/toTINA/main/ToTINA.java new file mode 100755 index 0000000..c93cdbb --- /dev/null +++ b/workspace/fr.n7.petrinet.toTINA/src/fr/n7/petrinet/toTINA/main/ToTINA.java @@ -0,0 +1,417 @@ +/******************************************************************************* + * Copyright (c) 2008, 2012 Obeo. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package fr.n7.petrinet.toTINA.main; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.acceleo.engine.event.IAcceleoTextGenerationListener; +import org.eclipse.acceleo.engine.generation.strategy.IAcceleoGenerationStrategy; +import org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator; +import org.eclipse.emf.common.util.BasicMonitor; +import org.eclipse.emf.common.util.Monitor; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.ResourceSet; +import petrinet.PetrinetPackage; + +/** + * Entry point of the 'ToTINA' generation module. + * + * @generated + */ +public class ToTINA extends AbstractAcceleoGenerator { + /** + * The name of the module. + * + * @generated + */ + public static final String MODULE_FILE_NAME = "/fr/n7/petrinet/toTINA/main/toTINA"; + + /** + * The name of the templates that are to be generated. + * + * @generated + */ + public static final String[] TEMPLATE_NAMES = { "networkToTINA" }; + + /** + * The list of properties files from the launch parameters (Launch configuration). + * + * @generated + */ + private List propertiesFiles = new ArrayList(); + + /** + * Allows the public constructor to be used. Note that a generator created + * this way cannot be used to launch generations before one of + * {@link #initialize(EObject, File, List)} or + * {@link #initialize(URI, File, List)} is called. + *

+ * The main reason for this constructor is to allow clients of this + * generation to call it from another Java file, as it allows for the + * retrieval of {@link #getProperties()} and + * {@link #getGenerationListeners()}. + *

+ * + * @generated + */ + public ToTINA() { + // Empty implementation + } + + /** + * This allows clients to instantiates a generator with all required information. + * + * @param modelURI + * URI where the model on which this generator will be used is located. + * @param targetFolder + * This will be used as the output folder for this generation : it will be the base path + * against which all file block URLs will be resolved. + * @param arguments + * If the template which will be called requires more than one argument taken from the model, + * pass them here. + * @throws IOException + * This can be thrown in three scenarios : the module cannot be found, it cannot be loaded, or + * the model cannot be loaded. + * @generated + */ + public ToTINA(URI modelURI, File targetFolder, + List arguments) throws IOException { + initialize(modelURI, targetFolder, arguments); + } + + /** + * This allows clients to instantiates a generator with all required information. + * + * @param model + * We'll iterate over the content of this element to find Objects matching the first parameter + * of the template we need to call. + * @param targetFolder + * This will be used as the output folder for this generation : it will be the base path + * against which all file block URLs will be resolved. + * @param arguments + * If the template which will be called requires more than one argument taken from the model, + * pass them here. + * @throws IOException + * This can be thrown in two scenarios : the module cannot be found, or it cannot be loaded. + * @generated + */ + public ToTINA(EObject model, File targetFolder, + List arguments) throws IOException { + initialize(model, targetFolder, arguments); + } + + /** + * This can be used to launch the generation from a standalone application. + * + * @param args + * Arguments of the generation. + * @generated + */ + public static void main(String[] args) { + try { + if (args.length < 2) { + System.out.println("Arguments not valid : {model, folder}."); + } else { + URI modelURI = URI.createFileURI(args[0]); + File folder = new File(args[1]); + + List arguments = new ArrayList(); + + /* + * If you want to change the content of this method, do NOT forget to change the "@generated" + * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation + * of the Acceleo module with the main template that has caused the creation of this class will + * revert your modifications. + */ + + /* + * Add in this list all the arguments used by the starting point of the generation + * If your main template is called on an element of your model and a String, you can + * add in "arguments" this "String" attribute. + */ + + ToTINA generator = new ToTINA(modelURI, folder, arguments); + + /* + * Add the properties from the launch arguments. + * If you want to programmatically add new properties, add them in "propertiesFiles" + * You can add the absolute path of a properties files, or even a project relative path. + * If you want to add another "protocol" for your properties files, please override + * "getPropertiesLoaderService(AcceleoService)" in order to return a new property loader. + * The behavior of the properties loader service is explained in the Acceleo documentation + * (Help -> Help Contents). + */ + + for (int i = 2; i < args.length; i++) { + generator.addPropertiesFile(args[i]); + } + + generator.doGenerate(new BasicMonitor()); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + + /** + * Launches the generation described by this instance. + * + * @param monitor + * This will be used to display progress information to the user. + * @throws IOException + * This will be thrown if any of the output files cannot be saved to disk. + * @generated + */ + @Override + public void doGenerate(Monitor monitor) throws IOException { + /* + * TODO if you wish to change the generation as a whole, override this. The default behavior should + * be sufficient in most cases. If you want to change the content of this method, do NOT forget to + * change the "@generated" tag in the Javadoc of this method to "@generated NOT". Without this new tag, + * any compilation of the Acceleo module with the main template that has caused the creation of this + * class will revert your modifications. If you encounter a problem with an unresolved proxy during the + * generation, you can remove the comments in the following instructions to check for problems. Please + * note that those instructions may have a significant impact on the performances. + */ + + //org.eclipse.emf.ecore.util.EcoreUtil.resolveAll(model); + + /* + * If you want to check for potential errors in your models before the launch of the generation, you + * use the code below. + */ + + //if (model != null && model.eResource() != null) { + // List errors = model.eResource().getErrors(); + // for (org.eclipse.emf.ecore.resource.Resource.Diagnostic diagnostic : errors) { + // System.err.println(diagnostic.toString()); + // } + //} + + super.doGenerate(monitor); + } + + /** + * If this generator needs to listen to text generation events, listeners can be returned from here. + * + * @return List of listeners that are to be notified when text is generated through this launch. + * @generated + */ + @Override + public List getGenerationListeners() { + List listeners = super.getGenerationListeners(); + /* + * TODO if you need to listen to generation event, add listeners to the list here. If you want to change + * the content of this method, do NOT forget to change the "@generated" tag in the Javadoc of this method + * to "@generated NOT". Without this new tag, any compilation of the Acceleo module with the main template + * that has caused the creation of this class will revert your modifications. + */ + return listeners; + } + + /** + * If you need to change the way files are generated, this is your entry point. + *

+ * The default is {@link org.eclipse.acceleo.engine.generation.strategy.DefaultStrategy}; it generates + * files on the fly. If you only need to preview the results, return a new + * {@link org.eclipse.acceleo.engine.generation.strategy.PreviewStrategy}. Both of these aren't aware of + * the running Eclipse and can be used standalone. + *

+ *

+ * If you need the file generation to be aware of the workspace (A typical example is when you wanna + * override files that are under clear case or any other VCS that could forbid the overriding), then + * return a new {@link org.eclipse.acceleo.engine.generation.strategy.WorkspaceAwareStrategy}. + * Note, however, that this cannot be used standalone. + *

+ *

+ * All three of these default strategies support merging through JMerge. + *

+ * + * @return The generation strategy that is to be used for generations launched through this launcher. + * @generated + */ + @Override + public IAcceleoGenerationStrategy getGenerationStrategy() { + return super.getGenerationStrategy(); + } + + /** + * This will be called in order to find and load the module that will be launched through this launcher. + * We expect this name not to contain file extension, and the module to be located beside the launcher. + * + * @return The name of the module that is to be launched. + * @generated + */ + @Override + public String getModuleName() { + return MODULE_FILE_NAME; + } + + /** + * If the module(s) called by this launcher require properties files, return their qualified path from + * here.Take note that the first added properties files will take precedence over subsequent ones if they + * contain conflicting keys. + * + * @return The list of properties file we need to add to the generation context. + * @see java.util.ResourceBundle#getBundle(String) + * @generated + */ + @Override + public List getProperties() { + /* + * If you want to change the content of this method, do NOT forget to change the "@generated" + * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation + * of the Acceleo module with the main template that has caused the creation of this class will + * revert your modifications. + */ + + /* + * TODO if your generation module requires access to properties files, add their qualified path to the list here. + * + * Properties files can be located in an Eclipse plug-in or in the file system (all Acceleo projects are Eclipse + * plug-in). In order to use properties files located in an Eclipse plugin, you need to add the path of the properties + * files to the "propertiesFiles" list: + * + * final String prefix = "platform:/plugin/"; + * final String pluginName = "org.eclipse.acceleo.module.sample"; + * final String packagePath = "/org/eclipse/acceleo/module/sample/properties/"; + * final String fileName = "default.properties"; + * propertiesFiles.add(prefix + pluginName + packagePath + fileName); + * + * With this mechanism, you can load properties files from your plugin or from another plugin. + * + * You may want to load properties files from the file system, for that you need to add the absolute path of the file: + * + * propertiesFiles.add("C:\Users\MyName\MyFile.properties"); + * + * If you want to let your users add properties files located in the same folder as the model: + * + * if (EMFPlugin.IS_ECLIPSE_RUNNING && model != null && model.eResource() != null) { + * propertiesFiles.addAll(AcceleoEngineUtils.getPropertiesFilesNearModel(model.eResource())); + * } + * + * To learn more about Properties Files, have a look at the Acceleo documentation (Help -> Help Contents). + */ + return propertiesFiles; + } + + /** + * Adds a properties file in the list of properties files. + * + * @param propertiesFile + * The properties file to add. + * @generated + * @since 3.1 + */ + @Override + public void addPropertiesFile(String propertiesFile) { + this.propertiesFiles.add(propertiesFile); + } + + /** + * This will be used to get the list of templates that are to be launched by this launcher. + * + * @return The list of templates to call on the module {@link #getModuleName()}. + * @generated + */ + @Override + public String[] getTemplateNames() { + return TEMPLATE_NAMES; + } + + /** + * This can be used to update the resource set's package registry with all needed EPackages. + * + * @param resourceSet + * The resource set which registry has to be updated. + * @generated NOT + */ + @Override + public void registerPackages(ResourceSet resourceSet) { + super.registerPackages(resourceSet); + + if (!isInWorkspace(PetrinetPackage.class)) + resourceSet.getPackageRegistry().put( + PetrinetPackage.eNS_URI, PetrinetPackage.eINSTANCE); + + /* + * If you want to change the content of this method, do NOT forget to change the "@generated" + * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation + * of the Acceleo module with the main template that has caused the creation of this class will + * revert your modifications. + */ + + /* + * If you need additional package registrations, you can register them here. The following line + * (in comment) is an example of the package registration for UML. + * + * You can use the method "isInWorkspace(Class c)" to check if the package that you are about to + * register is in the workspace. + * + * To register a package properly, please follow the following conventions: + * + * If the package is located in another plug-in, already installed in Eclipse. The following content should + * have been generated at the beginning of this method. Do not register the package using this mechanism if + * the metamodel is located in the workspace. + * + * if (!isInWorkspace(UMLPackage.class)) { + * // The normal package registration if your metamodel is in a plugin. + * resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE); + * } + * + * If the package is located in another project in your workspace, the plugin containing the package has not + * been register by EMF and Acceleo should register it automatically. If you want to use the generator in + * stand alone, the regular registration (seen a couple lines before) is needed. + * + * To learn more about Package Registration, have a look at the Acceleo documentation (Help -> Help Contents). + */ + } + + /** + * This can be used to update the resource set's resource factory registry with all needed factories. + * + * @param resourceSet + * The resource set which registry has to be updated. + * @generated + */ + @Override + public void registerResourceFactories(ResourceSet resourceSet) { + super.registerResourceFactories(resourceSet); + /* + * If you want to change the content of this method, do NOT forget to change the "@generated" + * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation + * of the Acceleo module with the main template that has caused the creation of this class will + * revert your modifications. + */ + + /* + * TODO If you need additional resource factories registrations, you can register them here. the following line + * (in comment) is an example of the resource factory registration. + * + * If you want to use the generator in stand alone, the resource factory registration will be required. + * + * To learn more about the registration of Resource Factories, have a look at the Acceleo documentation (Help -> Help Contents). + */ + + // resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(XyzResource.FILE_EXTENSION, XyzResource.Factory.INSTANCE); + + /* + * Some metamodels require a very complex setup for standalone usage. For example, if you want to use a generator + * targetting UML models in standalone, you NEED to use the following: + */ + // UMLResourcesUtil.init(resourceSet) + } + +} diff --git a/workspace/fr.n7.petrinet.toTINA/src/fr/n7/petrinet/toTINA/main/toTINA.mtl b/workspace/fr.n7.petrinet.toTINA/src/fr/n7/petrinet/toTINA/main/toTINA.mtl new file mode 100755 index 0000000..601544f --- /dev/null +++ b/workspace/fr.n7.petrinet.toTINA/src/fr/n7/petrinet/toTINA/main/toTINA.mtl @@ -0,0 +1,44 @@ +[comment encoding = UTF-8 /] +[module toTINA('http://petrinet')] + +[template public networkToTINA(aNetwork : Network)] +[comment @main/] +[file (aNetwork.name + '.net', false, 'UTF-8')] +net [aNetwork.name/] +[let places : OrderedSet(Place) = aNetwork.getPlaces() ] + [if (places->size() > 0)] + [for (place : Place | places)] +pl [place.name/] ([place.tokens/]) + [/for] + [else] + [/if] +[/let] +[let transitions : OrderedSet(Transition) = aNetwork.getTransitions() ] + [if (transitions->size() > 0)] + [for (transition : Transition | transitions)] +[transition.afficher()/] + [/for] + [else] + [/if] +[/let] +[/file] +[/template] + +[query public getPlaces(n: Network) : OrderedSet(Place) = + n.nodes + ->select( e | e.oclIsTypeOf(Place) ) + ->collect( e | e.oclAsType(Place) ) + ->asOrderedSet() +/] + +[query public getTransitions(n: Network) : OrderedSet(Transition) = + n.nodes + ->select( e | e.oclIsTypeOf(Transition) ) + ->collect( e | e.oclAsType(Transition) ) + ->asOrderedSet() +/] + +[template public afficher(t : Transition) post (trim()) ] +[comment][let outgoing = t.getArcs()->select( e | e.isOutgoing() ) /][/comment] +tr [t.name/] [for (a : Arc | t.arcs)][if (not a.outgoing)][a.place.name/]*[a.weight/] [/if][/for]-> [for (a : Arc | t.arcs)][if (a.outgoing)][a.place.name/]*[a.weight/] [/if][/for] +[/template] \ No newline at end of file diff --git a/workspace/fr.n7.petrinet.toTINA/tasks/toTINA.xml b/workspace/fr.n7.petrinet.toTINA/tasks/toTINA.xml new file mode 100755 index 0000000..46dfe00 --- /dev/null +++ b/workspace/fr.n7.petrinet.toTINA/tasks/toTINA.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/workspace/fr.n7.petrinet.toTINA/tasks/toTINATarget.xml b/workspace/fr.n7.petrinet.toTINA/tasks/toTINATarget.xml new file mode 100755 index 0000000..4ddac80 --- /dev/null +++ b/workspace/fr.n7.petrinet.toTINA/tasks/toTINATarget.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/workspace/fr.n7.petrinet/.classpath b/workspace/fr.n7.petrinet/.classpath new file mode 100755 index 0000000..c3ba59e --- /dev/null +++ b/workspace/fr.n7.petrinet/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/workspace/fr.n7.petrinet/.project b/workspace/fr.n7.petrinet/.project new file mode 100755 index 0000000..8230b7d --- /dev/null +++ b/workspace/fr.n7.petrinet/.project @@ -0,0 +1,50 @@ + + + fr.n7.petrinet + + + + + + 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/workspace/fr.n7.petrinet/META-INF/MANIFEST.MF b/workspace/fr.n7.petrinet/META-INF/MANIFEST.MF new file mode 100755 index 0000000..d701b53 --- /dev/null +++ b/workspace/fr.n7.petrinet/META-INF/MANIFEST.MF @@ -0,0 +1,16 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: fr.n7.petrinet;singleton:=true +Automatic-Module-Name: fr.n7.petrinet +Bundle-Version: 1.0.0.qualifier +Bundle-ClassPath: . +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Export-Package: petrinet, + petrinet.impl, + petrinet.util +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.emf.ecore;visibility:=reexport +Bundle-ActivationPolicy: lazy diff --git a/workspace/fr.n7.petrinet/bin/.gitignore b/workspace/fr.n7.petrinet/bin/.gitignore new file mode 100644 index 0000000..79b56a6 --- /dev/null +++ b/workspace/fr.n7.petrinet/bin/.gitignore @@ -0,0 +1 @@ +/petrinet/ diff --git a/workspace/fr.n7.petrinet/build.properties b/workspace/fr.n7.petrinet/build.properties new file mode 100755 index 0000000..4465407 --- /dev/null +++ b/workspace/fr.n7.petrinet/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/workspace/fr.n7.petrinet/ko-net.xmi b/workspace/fr.n7.petrinet/ko-net.xmi new file mode 100755 index 0000000..da35c62 --- /dev/null +++ b/workspace/fr.n7.petrinet/ko-net.xmi @@ -0,0 +1,26 @@ + + + + + + + + + + diff --git a/workspace/fr.n7.petrinet/net.xmi b/workspace/fr.n7.petrinet/net.xmi new file mode 100755 index 0000000..ff67c65 --- /dev/null +++ b/workspace/fr.n7.petrinet/net.xmi @@ -0,0 +1,22 @@ + + + + + + + + + diff --git a/workspace/fr.n7.petrinet/petriNet.aird b/workspace/fr.n7.petrinet/petriNet.aird new file mode 100755 index 0000000..8d6e5bf --- /dev/null +++ b/workspace/fr.n7.petrinet/petriNet.aird @@ -0,0 +1,367 @@ + + + + petriNet.ecore + petriNet.genmodel + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bold + + + + + + + + + + + + + + + + bold + + + + bold + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + bold + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + italic + + + + + + + + bold + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + bold + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + bold + + + + + + + + bold + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + + + + italic + + + + + + + + + + + + italic + + + + + + + + + + + + + + + + + + + + + + bold + + + bold + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/workspace/fr.n7.petrinet/petriNet.ecore b/workspace/fr.n7.petrinet/petriNet.ecore new file mode 100755 index 0000000..18832c8 --- /dev/null +++ b/workspace/fr.n7.petrinet/petriNet.ecore @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/workspace/fr.n7.petrinet/petriNet.genmodel b/workspace/fr.n7.petrinet/petriNet.genmodel new file mode 100755 index 0000000..1e661ee --- /dev/null +++ b/workspace/fr.n7.petrinet/petriNet.genmodel @@ -0,0 +1,31 @@ + + + petriNet.ecore + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/workspace/fr.n7.petrinet/petriNet.ocl b/workspace/fr.n7.petrinet/petriNet.ocl new file mode 100755 index 0000000..f44a2e3 --- /dev/null +++ b/workspace/fr.n7.petrinet/petriNet.ocl @@ -0,0 +1,21 @@ +import 'petriNet.ecore' + +package petrinet + +context Network +inv validName('Invalid name: ' + self.name): + self.name.matches('[A-Za-z_][A-Za-z0-9_]*') +inv uniqNamesNode: self.nodes + ->forAll(n1, n2 | n1 = n2 or n1.name <> n2.name) + +context Node +inv nameMin2Char: self.name.matches('..+') +inv weirdName: not self.name.matches('([0-9]*|_*)') + +context Place +inv negativeQuantity: self.tokens >= 0 + +context Arc +inv negativeQuantity: self.weight >= 0 + +endpackage \ No newline at end of file diff --git a/workspace/fr.n7.petrinet/petriNet.png b/workspace/fr.n7.petrinet/petriNet.png new file mode 100755 index 0000000..ec8af88 Binary files /dev/null and b/workspace/fr.n7.petrinet/petriNet.png differ diff --git a/workspace/fr.n7.petrinet/plugin.properties b/workspace/fr.n7.petrinet/plugin.properties new file mode 100755 index 0000000..302299f --- /dev/null +++ b/workspace/fr.n7.petrinet/plugin.properties @@ -0,0 +1,4 @@ +# + +pluginName = Petrinet Model +providerName = www.example.org diff --git a/workspace/fr.n7.petrinet/plugin.xml b/workspace/fr.n7.petrinet/plugin.xml new file mode 100755 index 0000000..c87d55c --- /dev/null +++ b/workspace/fr.n7.petrinet/plugin.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + diff --git a/workspace/fr.n7.petrinet/src/petrinet/Arc.java b/workspace/fr.n7.petrinet/src/petrinet/Arc.java new file mode 100755 index 0000000..75c7d24 --- /dev/null +++ b/workspace/fr.n7.petrinet/src/petrinet/Arc.java @@ -0,0 +1,119 @@ +/** + */ +package petrinet; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Arc'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link petrinet.Arc#getWeight Weight}
  • + *
  • {@link petrinet.Arc#isOutgoing Outgoing}
  • + *
  • {@link petrinet.Arc#getPlace Place}
  • + *
  • {@link petrinet.Arc#getTransition Transition}
  • + *
+ * + * @see petrinet.PetrinetPackage#getArc() + * @model + * @generated + */ +public interface Arc extends EObject { + /** + * Returns the value of the 'Weight' attribute. + * + * + * @return the value of the 'Weight' attribute. + * @see #setWeight(int) + * @see petrinet.PetrinetPackage#getArc_Weight() + * @model required="true" + * @generated + */ + int getWeight(); + + /** + * Sets the value of the '{@link petrinet.Arc#getWeight Weight}' attribute. + * + * + * @param value the new value of the 'Weight' attribute. + * @see #getWeight() + * @generated + */ + void setWeight(int value); + + /** + * Returns the value of the 'Outgoing' attribute. + * + * + * @return the value of the 'Outgoing' attribute. + * @see #setOutgoing(boolean) + * @see petrinet.PetrinetPackage#getArc_Outgoing() + * @model required="true" + * @generated + */ + boolean isOutgoing(); + + /** + * Sets the value of the '{@link petrinet.Arc#isOutgoing Outgoing}' attribute. + * + * + * @param value the new value of the 'Outgoing' attribute. + * @see #isOutgoing() + * @generated + */ + void setOutgoing(boolean value); + + /** + * Returns the value of the 'Place' reference. + * It is bidirectional and its opposite is '{@link petrinet.Place#getArcs Arcs}'. + * + * + * @return the value of the 'Place' reference. + * @see #setPlace(Place) + * @see petrinet.PetrinetPackage#getArc_Place() + * @see petrinet.Place#getArcs + * @model opposite="arcs" required="true" + * @generated + */ + Place getPlace(); + + /** + * Sets the value of the '{@link petrinet.Arc#getPlace Place}' reference. + * + * + * @param value the new value of the 'Place' reference. + * @see #getPlace() + * @generated + */ + void setPlace(Place value); + + /** + * Returns the value of the 'Transition' container reference. + * It is bidirectional and its opposite is '{@link petrinet.Transition#getArcs Arcs}'. + * + * + * @return the value of the 'Transition' container reference. + * @see #setTransition(Transition) + * @see petrinet.PetrinetPackage#getArc_Transition() + * @see petrinet.Transition#getArcs + * @model opposite="arcs" required="true" transient="false" + * @generated + */ + Transition getTransition(); + + /** + * Sets the value of the '{@link petrinet.Arc#getTransition Transition}' container reference. + * + * + * @param value the new value of the 'Transition' container reference. + * @see #getTransition() + * @generated + */ + void setTransition(Transition value); + +} // Arc diff --git a/workspace/fr.n7.petrinet/src/petrinet/Network.java b/workspace/fr.n7.petrinet/src/petrinet/Network.java new file mode 100755 index 0000000..cdc1868 --- /dev/null +++ b/workspace/fr.n7.petrinet/src/petrinet/Network.java @@ -0,0 +1,63 @@ +/** + */ +package petrinet; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Network'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link petrinet.Network#getName Name}
  • + *
  • {@link petrinet.Network#getNodes Nodes}
  • + *
+ * + * @see petrinet.PetrinetPackage#getNetwork() + * @model + * @generated + */ +public interface Network extends EObject { + /** + * Returns the value of the 'Name' attribute. + * + * + * @return the value of the 'Name' attribute. + * @see #setName(String) + * @see petrinet.PetrinetPackage#getNetwork_Name() + * @model required="true" + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link petrinet.Network#getName Name}' attribute. + * + * + * @param value the new value of the 'Name' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + + /** + * Returns the value of the 'Nodes' containment reference list. + * The list contents are of type {@link petrinet.Node}. + * It is bidirectional and its opposite is '{@link petrinet.Node#getNetwork Network}'. + * + * + * @return the value of the 'Nodes' containment reference list. + * @see petrinet.PetrinetPackage#getNetwork_Nodes() + * @see petrinet.Node#getNetwork + * @model opposite="network" containment="true" + * @generated + */ + EList getNodes(); + +} // Network diff --git a/workspace/fr.n7.petrinet/src/petrinet/Node.java b/workspace/fr.n7.petrinet/src/petrinet/Node.java new file mode 100755 index 0000000..a97e9a9 --- /dev/null +++ b/workspace/fr.n7.petrinet/src/petrinet/Node.java @@ -0,0 +1,71 @@ +/** + */ +package petrinet; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Node'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link petrinet.Node#getName Name}
  • + *
  • {@link petrinet.Node#getNetwork Network}
  • + *
+ * + * @see petrinet.PetrinetPackage#getNode() + * @model abstract="true" + * @generated + */ +public interface Node extends EObject { + /** + * Returns the value of the 'Name' attribute. + * + * + * @return the value of the 'Name' attribute. + * @see #setName(String) + * @see petrinet.PetrinetPackage#getNode_Name() + * @model required="true" + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link petrinet.Node#getName Name}' attribute. + * + * + * @param value the new value of the 'Name' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + + /** + * Returns the value of the 'Network' container reference. + * It is bidirectional and its opposite is '{@link petrinet.Network#getNodes Nodes}'. + * + * + * @return the value of the 'Network' container reference. + * @see #setNetwork(Network) + * @see petrinet.PetrinetPackage#getNode_Network() + * @see petrinet.Network#getNodes + * @model opposite="nodes" required="true" transient="false" + * @generated + */ + Network getNetwork(); + + /** + * Sets the value of the '{@link petrinet.Node#getNetwork Network}' container reference. + * + * + * @param value the new value of the 'Network' container reference. + * @see #getNetwork() + * @generated + */ + void setNetwork(Network value); + +} // Node diff --git a/workspace/fr.n7.petrinet/src/petrinet/PetrinetFactory.java b/workspace/fr.n7.petrinet/src/petrinet/PetrinetFactory.java new file mode 100755 index 0000000..ec53b65 --- /dev/null +++ b/workspace/fr.n7.petrinet/src/petrinet/PetrinetFactory.java @@ -0,0 +1,69 @@ +/** + */ +package petrinet; + +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 petrinet.PetrinetPackage + * @generated + */ +public interface PetrinetFactory extends EFactory { + /** + * The singleton instance of the factory. + * + * + * @generated + */ + PetrinetFactory eINSTANCE = petrinet.impl.PetrinetFactoryImpl.init(); + + /** + * Returns a new object of class 'Network'. + * + * + * @return a new object of class 'Network'. + * @generated + */ + Network createNetwork(); + + /** + * Returns a new object of class 'Place'. + * + * + * @return a new object of class 'Place'. + * @generated + */ + Place createPlace(); + + /** + * Returns a new object of class 'Arc'. + * + * + * @return a new object of class 'Arc'. + * @generated + */ + Arc createArc(); + + /** + * Returns a new object of class 'Transition'. + * + * + * @return a new object of class 'Transition'. + * @generated + */ + Transition createTransition(); + + /** + * Returns the package supported by this factory. + * + * + * @return the package supported by this factory. + * @generated + */ + PetrinetPackage getPetrinetPackage(); + +} //PetrinetFactory diff --git a/workspace/fr.n7.petrinet/src/petrinet/PetrinetPackage.java b/workspace/fr.n7.petrinet/src/petrinet/PetrinetPackage.java new file mode 100755 index 0000000..9f214ca --- /dev/null +++ b/workspace/fr.n7.petrinet/src/petrinet/PetrinetPackage.java @@ -0,0 +1,669 @@ +/** + */ +package petrinet; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +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 petrinet.PetrinetFactory + * @model kind="package" + * @generated + */ +public interface PetrinetPackage extends EPackage { + /** + * The package name. + * + * + * @generated + */ + String eNAME = "petrinet"; + + /** + * The package namespace URI. + * + * + * @generated + */ + String eNS_URI = "http://petrinet"; + + /** + * The package namespace name. + * + * + * @generated + */ + String eNS_PREFIX = "petrinet"; + + /** + * The singleton instance of the package. + * + * + * @generated + */ + PetrinetPackage eINSTANCE = petrinet.impl.PetrinetPackageImpl.init(); + + /** + * The meta object id for the '{@link petrinet.impl.NetworkImpl Network}' class. + * + * + * @see petrinet.impl.NetworkImpl + * @see petrinet.impl.PetrinetPackageImpl#getNetwork() + * @generated + */ + int NETWORK = 0; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + int NETWORK__NAME = 0; + + /** + * The feature id for the 'Nodes' containment reference list. + * + * + * @generated + * @ordered + */ + int NETWORK__NODES = 1; + + /** + * The number of structural features of the 'Network' class. + * + * + * @generated + * @ordered + */ + int NETWORK_FEATURE_COUNT = 2; + + /** + * The number of operations of the 'Network' class. + * + * + * @generated + * @ordered + */ + int NETWORK_OPERATION_COUNT = 0; + + /** + * The meta object id for the '{@link petrinet.impl.NodeImpl Node}' class. + * + * + * @see petrinet.impl.NodeImpl + * @see petrinet.impl.PetrinetPackageImpl#getNode() + * @generated + */ + int NODE = 1; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + int NODE__NAME = 0; + + /** + * The feature id for the 'Network' container reference. + * + * + * @generated + * @ordered + */ + int NODE__NETWORK = 1; + + /** + * The number of structural features of the 'Node' class. + * + * + * @generated + * @ordered + */ + int NODE_FEATURE_COUNT = 2; + + /** + * The number of operations of the 'Node' class. + * + * + * @generated + * @ordered + */ + int NODE_OPERATION_COUNT = 0; + + /** + * The meta object id for the '{@link petrinet.impl.PlaceImpl Place}' class. + * + * + * @see petrinet.impl.PlaceImpl + * @see petrinet.impl.PetrinetPackageImpl#getPlace() + * @generated + */ + int PLACE = 2; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + int PLACE__NAME = NODE__NAME; + + /** + * The feature id for the 'Network' container reference. + * + * + * @generated + * @ordered + */ + int PLACE__NETWORK = NODE__NETWORK; + + /** + * The feature id for the 'Tokens' attribute. + * + * + * @generated + * @ordered + */ + int PLACE__TOKENS = NODE_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Arcs' reference list. + * + * + * @generated + * @ordered + */ + int PLACE__ARCS = NODE_FEATURE_COUNT + 1; + + /** + * The number of structural features of the 'Place' class. + * + * + * @generated + * @ordered + */ + int PLACE_FEATURE_COUNT = NODE_FEATURE_COUNT + 2; + + /** + * The number of operations of the 'Place' class. + * + * + * @generated + * @ordered + */ + int PLACE_OPERATION_COUNT = NODE_OPERATION_COUNT + 0; + + /** + * The meta object id for the '{@link petrinet.impl.ArcImpl Arc}' class. + * + * + * @see petrinet.impl.ArcImpl + * @see petrinet.impl.PetrinetPackageImpl#getArc() + * @generated + */ + int ARC = 3; + + /** + * The feature id for the 'Weight' attribute. + * + * + * @generated + * @ordered + */ + int ARC__WEIGHT = 0; + + /** + * The feature id for the 'Outgoing' attribute. + * + * + * @generated + * @ordered + */ + int ARC__OUTGOING = 1; + + /** + * The feature id for the 'Place' reference. + * + * + * @generated + * @ordered + */ + int ARC__PLACE = 2; + + /** + * The feature id for the 'Transition' container reference. + * + * + * @generated + * @ordered + */ + int ARC__TRANSITION = 3; + + /** + * The number of structural features of the 'Arc' class. + * + * + * @generated + * @ordered + */ + int ARC_FEATURE_COUNT = 4; + + /** + * The number of operations of the 'Arc' class. + * + * + * @generated + * @ordered + */ + int ARC_OPERATION_COUNT = 0; + + /** + * The meta object id for the '{@link petrinet.impl.TransitionImpl Transition}' class. + * + * + * @see petrinet.impl.TransitionImpl + * @see petrinet.impl.PetrinetPackageImpl#getTransition() + * @generated + */ + int TRANSITION = 4; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + int TRANSITION__NAME = NODE__NAME; + + /** + * The feature id for the 'Network' container reference. + * + * + * @generated + * @ordered + */ + int TRANSITION__NETWORK = NODE__NETWORK; + + /** + * The feature id for the 'Arcs' containment reference list. + * + * + * @generated + * @ordered + */ + int TRANSITION__ARCS = NODE_FEATURE_COUNT + 0; + + /** + * The number of structural features of the 'Transition' class. + * + * + * @generated + * @ordered + */ + int TRANSITION_FEATURE_COUNT = NODE_FEATURE_COUNT + 1; + + /** + * The number of operations of the 'Transition' class. + * + * + * @generated + * @ordered + */ + int TRANSITION_OPERATION_COUNT = NODE_OPERATION_COUNT + 0; + + + /** + * Returns the meta object for class '{@link petrinet.Network Network}'. + * + * + * @return the meta object for class 'Network'. + * @see petrinet.Network + * @generated + */ + EClass getNetwork(); + + /** + * Returns the meta object for the attribute '{@link petrinet.Network#getName Name}'. + * + * + * @return the meta object for the attribute 'Name'. + * @see petrinet.Network#getName() + * @see #getNetwork() + * @generated + */ + EAttribute getNetwork_Name(); + + /** + * Returns the meta object for the containment reference list '{@link petrinet.Network#getNodes Nodes}'. + * + * + * @return the meta object for the containment reference list 'Nodes'. + * @see petrinet.Network#getNodes() + * @see #getNetwork() + * @generated + */ + EReference getNetwork_Nodes(); + + /** + * Returns the meta object for class '{@link petrinet.Node Node}'. + * + * + * @return the meta object for class 'Node'. + * @see petrinet.Node + * @generated + */ + EClass getNode(); + + /** + * Returns the meta object for the attribute '{@link petrinet.Node#getName Name}'. + * + * + * @return the meta object for the attribute 'Name'. + * @see petrinet.Node#getName() + * @see #getNode() + * @generated + */ + EAttribute getNode_Name(); + + /** + * Returns the meta object for the container reference '{@link petrinet.Node#getNetwork Network}'. + * + * + * @return the meta object for the container reference 'Network'. + * @see petrinet.Node#getNetwork() + * @see #getNode() + * @generated + */ + EReference getNode_Network(); + + /** + * Returns the meta object for class '{@link petrinet.Place Place}'. + * + * + * @return the meta object for class 'Place'. + * @see petrinet.Place + * @generated + */ + EClass getPlace(); + + /** + * Returns the meta object for the attribute '{@link petrinet.Place#getTokens Tokens}'. + * + * + * @return the meta object for the attribute 'Tokens'. + * @see petrinet.Place#getTokens() + * @see #getPlace() + * @generated + */ + EAttribute getPlace_Tokens(); + + /** + * Returns the meta object for the reference list '{@link petrinet.Place#getArcs Arcs}'. + * + * + * @return the meta object for the reference list 'Arcs'. + * @see petrinet.Place#getArcs() + * @see #getPlace() + * @generated + */ + EReference getPlace_Arcs(); + + /** + * Returns the meta object for class '{@link petrinet.Arc Arc}'. + * + * + * @return the meta object for class 'Arc'. + * @see petrinet.Arc + * @generated + */ + EClass getArc(); + + /** + * Returns the meta object for the attribute '{@link petrinet.Arc#getWeight Weight}'. + * + * + * @return the meta object for the attribute 'Weight'. + * @see petrinet.Arc#getWeight() + * @see #getArc() + * @generated + */ + EAttribute getArc_Weight(); + + /** + * Returns the meta object for the attribute '{@link petrinet.Arc#isOutgoing Outgoing}'. + * + * + * @return the meta object for the attribute 'Outgoing'. + * @see petrinet.Arc#isOutgoing() + * @see #getArc() + * @generated + */ + EAttribute getArc_Outgoing(); + + /** + * Returns the meta object for the reference '{@link petrinet.Arc#getPlace Place}'. + * + * + * @return the meta object for the reference 'Place'. + * @see petrinet.Arc#getPlace() + * @see #getArc() + * @generated + */ + EReference getArc_Place(); + + /** + * Returns the meta object for the container reference '{@link petrinet.Arc#getTransition Transition}'. + * + * + * @return the meta object for the container reference 'Transition'. + * @see petrinet.Arc#getTransition() + * @see #getArc() + * @generated + */ + EReference getArc_Transition(); + + /** + * Returns the meta object for class '{@link petrinet.Transition Transition}'. + * + * + * @return the meta object for class 'Transition'. + * @see petrinet.Transition + * @generated + */ + EClass getTransition(); + + /** + * Returns the meta object for the containment reference list '{@link petrinet.Transition#getArcs Arcs}'. + * + * + * @return the meta object for the containment reference list 'Arcs'. + * @see petrinet.Transition#getArcs() + * @see #getTransition() + * @generated + */ + EReference getTransition_Arcs(); + + /** + * Returns the factory that creates the instances of the model. + * + * + * @return the factory that creates the instances of the model. + * @generated + */ + PetrinetFactory getPetrinetFactory(); + + /** + * + * 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 petrinet.impl.NetworkImpl Network}' class. + * + * + * @see petrinet.impl.NetworkImpl + * @see petrinet.impl.PetrinetPackageImpl#getNetwork() + * @generated + */ + EClass NETWORK = eINSTANCE.getNetwork(); + + /** + * The meta object literal for the 'Name' attribute feature. + * + * + * @generated + */ + EAttribute NETWORK__NAME = eINSTANCE.getNetwork_Name(); + + /** + * The meta object literal for the 'Nodes' containment reference list feature. + * + * + * @generated + */ + EReference NETWORK__NODES = eINSTANCE.getNetwork_Nodes(); + + /** + * The meta object literal for the '{@link petrinet.impl.NodeImpl Node}' class. + * + * + * @see petrinet.impl.NodeImpl + * @see petrinet.impl.PetrinetPackageImpl#getNode() + * @generated + */ + EClass NODE = eINSTANCE.getNode(); + + /** + * The meta object literal for the 'Name' attribute feature. + * + * + * @generated + */ + EAttribute NODE__NAME = eINSTANCE.getNode_Name(); + + /** + * The meta object literal for the 'Network' container reference feature. + * + * + * @generated + */ + EReference NODE__NETWORK = eINSTANCE.getNode_Network(); + + /** + * The meta object literal for the '{@link petrinet.impl.PlaceImpl Place}' class. + * + * + * @see petrinet.impl.PlaceImpl + * @see petrinet.impl.PetrinetPackageImpl#getPlace() + * @generated + */ + EClass PLACE = eINSTANCE.getPlace(); + + /** + * The meta object literal for the 'Tokens' attribute feature. + * + * + * @generated + */ + EAttribute PLACE__TOKENS = eINSTANCE.getPlace_Tokens(); + + /** + * The meta object literal for the 'Arcs' reference list feature. + * + * + * @generated + */ + EReference PLACE__ARCS = eINSTANCE.getPlace_Arcs(); + + /** + * The meta object literal for the '{@link petrinet.impl.ArcImpl Arc}' class. + * + * + * @see petrinet.impl.ArcImpl + * @see petrinet.impl.PetrinetPackageImpl#getArc() + * @generated + */ + EClass ARC = eINSTANCE.getArc(); + + /** + * The meta object literal for the 'Weight' attribute feature. + * + * + * @generated + */ + EAttribute ARC__WEIGHT = eINSTANCE.getArc_Weight(); + + /** + * The meta object literal for the 'Outgoing' attribute feature. + * + * + * @generated + */ + EAttribute ARC__OUTGOING = eINSTANCE.getArc_Outgoing(); + + /** + * The meta object literal for the 'Place' reference feature. + * + * + * @generated + */ + EReference ARC__PLACE = eINSTANCE.getArc_Place(); + + /** + * The meta object literal for the 'Transition' container reference feature. + * + * + * @generated + */ + EReference ARC__TRANSITION = eINSTANCE.getArc_Transition(); + + /** + * The meta object literal for the '{@link petrinet.impl.TransitionImpl Transition}' class. + * + * + * @see petrinet.impl.TransitionImpl + * @see petrinet.impl.PetrinetPackageImpl#getTransition() + * @generated + */ + EClass TRANSITION = eINSTANCE.getTransition(); + + /** + * The meta object literal for the 'Arcs' containment reference list feature. + * + * + * @generated + */ + EReference TRANSITION__ARCS = eINSTANCE.getTransition_Arcs(); + + } + +} //PetrinetPackage diff --git a/workspace/fr.n7.petrinet/src/petrinet/Place.java b/workspace/fr.n7.petrinet/src/petrinet/Place.java new file mode 100755 index 0000000..a2d90c7 --- /dev/null +++ b/workspace/fr.n7.petrinet/src/petrinet/Place.java @@ -0,0 +1,61 @@ +/** + */ +package petrinet; + +import org.eclipse.emf.common.util.EList; + +/** + * + * A representation of the model object 'Place'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link petrinet.Place#getTokens Tokens}
  • + *
  • {@link petrinet.Place#getArcs Arcs}
  • + *
+ * + * @see petrinet.PetrinetPackage#getPlace() + * @model + * @generated + */ +public interface Place extends Node { + /** + * Returns the value of the 'Tokens' attribute. + * + * + * @return the value of the 'Tokens' attribute. + * @see #setTokens(int) + * @see petrinet.PetrinetPackage#getPlace_Tokens() + * @model required="true" + * @generated + */ + int getTokens(); + + /** + * Sets the value of the '{@link petrinet.Place#getTokens Tokens}' attribute. + * + * + * @param value the new value of the 'Tokens' attribute. + * @see #getTokens() + * @generated + */ + void setTokens(int value); + + /** + * Returns the value of the 'Arcs' reference list. + * The list contents are of type {@link petrinet.Arc}. + * It is bidirectional and its opposite is '{@link petrinet.Arc#getPlace Place}'. + * + * + * @return the value of the 'Arcs' reference list. + * @see petrinet.PetrinetPackage#getPlace_Arcs() + * @see petrinet.Arc#getPlace + * @model opposite="place" + * @generated + */ + EList getArcs(); + +} // Place diff --git a/workspace/fr.n7.petrinet/src/petrinet/Transition.java b/workspace/fr.n7.petrinet/src/petrinet/Transition.java new file mode 100755 index 0000000..eba4736 --- /dev/null +++ b/workspace/fr.n7.petrinet/src/petrinet/Transition.java @@ -0,0 +1,38 @@ +/** + */ +package petrinet; + +import org.eclipse.emf.common.util.EList; + +/** + * + * A representation of the model object 'Transition'. + * + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link petrinet.Transition#getArcs Arcs}
  • + *
+ * + * @see petrinet.PetrinetPackage#getTransition() + * @model + * @generated + */ +public interface Transition extends Node { + /** + * Returns the value of the 'Arcs' containment reference list. + * The list contents are of type {@link petrinet.Arc}. + * It is bidirectional and its opposite is '{@link petrinet.Arc#getTransition Transition}'. + * + * + * @return the value of the 'Arcs' containment reference list. + * @see petrinet.PetrinetPackage#getTransition_Arcs() + * @see petrinet.Arc#getTransition + * @model opposite="transition" containment="true" + * @generated + */ + EList getArcs(); + +} // Transition diff --git a/workspace/fr.n7.petrinet/src/petrinet/impl/ArcImpl.java b/workspace/fr.n7.petrinet/src/petrinet/impl/ArcImpl.java new file mode 100755 index 0000000..c71a52b --- /dev/null +++ b/workspace/fr.n7.petrinet/src/petrinet/impl/ArcImpl.java @@ -0,0 +1,407 @@ +/** + */ +package petrinet.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 org.eclipse.emf.ecore.impl.MinimalEObjectImpl; + +import org.eclipse.emf.ecore.util.EcoreUtil; + +import petrinet.Arc; +import petrinet.PetrinetPackage; +import petrinet.Place; +import petrinet.Transition; + +/** + * + * An implementation of the model object 'Arc'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link petrinet.impl.ArcImpl#getWeight Weight}
  • + *
  • {@link petrinet.impl.ArcImpl#isOutgoing Outgoing}
  • + *
  • {@link petrinet.impl.ArcImpl#getPlace Place}
  • + *
  • {@link petrinet.impl.ArcImpl#getTransition Transition}
  • + *
+ * + * @generated + */ +public class ArcImpl extends MinimalEObjectImpl.Container implements Arc { + /** + * The default value of the '{@link #getWeight() Weight}' attribute. + * + * + * @see #getWeight() + * @generated + * @ordered + */ + protected static final int WEIGHT_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getWeight() Weight}' attribute. + * + * + * @see #getWeight() + * @generated + * @ordered + */ + protected int weight = WEIGHT_EDEFAULT; + + /** + * The default value of the '{@link #isOutgoing() Outgoing}' attribute. + * + * + * @see #isOutgoing() + * @generated + * @ordered + */ + protected static final boolean OUTGOING_EDEFAULT = false; + + /** + * The cached value of the '{@link #isOutgoing() Outgoing}' attribute. + * + * + * @see #isOutgoing() + * @generated + * @ordered + */ + protected boolean outgoing = OUTGOING_EDEFAULT; + + /** + * The cached value of the '{@link #getPlace() Place}' reference. + * + * + * @see #getPlace() + * @generated + * @ordered + */ + protected Place place; + + /** + * + * + * @generated + */ + protected ArcImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return PetrinetPackage.Literals.ARC; + } + + /** + * + * + * @generated + */ + public int getWeight() { + return weight; + } + + /** + * + * + * @generated + */ + public void setWeight(int newWeight) { + int oldWeight = weight; + weight = newWeight; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, PetrinetPackage.ARC__WEIGHT, oldWeight, weight)); + } + + /** + * + * + * @generated + */ + public boolean isOutgoing() { + return outgoing; + } + + /** + * + * + * @generated + */ + public void setOutgoing(boolean newOutgoing) { + boolean oldOutgoing = outgoing; + outgoing = newOutgoing; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, PetrinetPackage.ARC__OUTGOING, oldOutgoing, outgoing)); + } + + /** + * + * + * @generated + */ + public Place getPlace() { + if (place != null && place.eIsProxy()) { + InternalEObject oldPlace = (InternalEObject)place; + place = (Place)eResolveProxy(oldPlace); + if (place != oldPlace) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, PetrinetPackage.ARC__PLACE, oldPlace, place)); + } + } + return place; + } + + /** + * + * + * @generated + */ + public Place basicGetPlace() { + return place; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetPlace(Place newPlace, NotificationChain msgs) { + Place oldPlace = place; + place = newPlace; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, PetrinetPackage.ARC__PLACE, oldPlace, newPlace); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setPlace(Place newPlace) { + if (newPlace != place) { + NotificationChain msgs = null; + if (place != null) + msgs = ((InternalEObject)place).eInverseRemove(this, PetrinetPackage.PLACE__ARCS, Place.class, msgs); + if (newPlace != null) + msgs = ((InternalEObject)newPlace).eInverseAdd(this, PetrinetPackage.PLACE__ARCS, Place.class, msgs); + msgs = basicSetPlace(newPlace, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, PetrinetPackage.ARC__PLACE, newPlace, newPlace)); + } + + /** + * + * + * @generated + */ + public Transition getTransition() { + if (eContainerFeatureID() != PetrinetPackage.ARC__TRANSITION) return null; + return (Transition)eInternalContainer(); + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetTransition(Transition newTransition, NotificationChain msgs) { + msgs = eBasicSetContainer((InternalEObject)newTransition, PetrinetPackage.ARC__TRANSITION, msgs); + return msgs; + } + + /** + * + * + * @generated + */ + public void setTransition(Transition newTransition) { + if (newTransition != eInternalContainer() || (eContainerFeatureID() != PetrinetPackage.ARC__TRANSITION && newTransition != null)) { + if (EcoreUtil.isAncestor(this, newTransition)) + throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); + NotificationChain msgs = null; + if (eInternalContainer() != null) + msgs = eBasicRemoveFromContainer(msgs); + if (newTransition != null) + msgs = ((InternalEObject)newTransition).eInverseAdd(this, PetrinetPackage.TRANSITION__ARCS, Transition.class, msgs); + msgs = basicSetTransition(newTransition, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, PetrinetPackage.ARC__TRANSITION, newTransition, newTransition)); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case PetrinetPackage.ARC__PLACE: + if (place != null) + msgs = ((InternalEObject)place).eInverseRemove(this, PetrinetPackage.PLACE__ARCS, Place.class, msgs); + return basicSetPlace((Place)otherEnd, msgs); + case PetrinetPackage.ARC__TRANSITION: + if (eInternalContainer() != null) + msgs = eBasicRemoveFromContainer(msgs); + return basicSetTransition((Transition)otherEnd, msgs); + } + return super.eInverseAdd(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case PetrinetPackage.ARC__PLACE: + return basicSetPlace(null, msgs); + case PetrinetPackage.ARC__TRANSITION: + return basicSetTransition(null, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { + switch (eContainerFeatureID()) { + case PetrinetPackage.ARC__TRANSITION: + return eInternalContainer().eInverseRemove(this, PetrinetPackage.TRANSITION__ARCS, Transition.class, msgs); + } + return super.eBasicRemoveFromContainerFeature(msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case PetrinetPackage.ARC__WEIGHT: + return getWeight(); + case PetrinetPackage.ARC__OUTGOING: + return isOutgoing(); + case PetrinetPackage.ARC__PLACE: + if (resolve) return getPlace(); + return basicGetPlace(); + case PetrinetPackage.ARC__TRANSITION: + return getTransition(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case PetrinetPackage.ARC__WEIGHT: + setWeight((Integer)newValue); + return; + case PetrinetPackage.ARC__OUTGOING: + setOutgoing((Boolean)newValue); + return; + case PetrinetPackage.ARC__PLACE: + setPlace((Place)newValue); + return; + case PetrinetPackage.ARC__TRANSITION: + setTransition((Transition)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case PetrinetPackage.ARC__WEIGHT: + setWeight(WEIGHT_EDEFAULT); + return; + case PetrinetPackage.ARC__OUTGOING: + setOutgoing(OUTGOING_EDEFAULT); + return; + case PetrinetPackage.ARC__PLACE: + setPlace((Place)null); + return; + case PetrinetPackage.ARC__TRANSITION: + setTransition((Transition)null); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case PetrinetPackage.ARC__WEIGHT: + return weight != WEIGHT_EDEFAULT; + case PetrinetPackage.ARC__OUTGOING: + return outgoing != OUTGOING_EDEFAULT; + case PetrinetPackage.ARC__PLACE: + return place != null; + case PetrinetPackage.ARC__TRANSITION: + return getTransition() != null; + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuilder result = new StringBuilder(super.toString()); + result.append(" (weight: "); + result.append(weight); + result.append(", outgoing: "); + result.append(outgoing); + result.append(')'); + return result.toString(); + } + +} //ArcImpl diff --git a/workspace/fr.n7.petrinet/src/petrinet/impl/NetworkImpl.java b/workspace/fr.n7.petrinet/src/petrinet/impl/NetworkImpl.java new file mode 100755 index 0000000..9793369 --- /dev/null +++ b/workspace/fr.n7.petrinet/src/petrinet/impl/NetworkImpl.java @@ -0,0 +1,237 @@ +/** + */ +package petrinet.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.EObjectContainmentWithInverseEList; +import org.eclipse.emf.ecore.util.InternalEList; + +import petrinet.Network; +import petrinet.Node; +import petrinet.PetrinetPackage; + +/** + * + * An implementation of the model object 'Network'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link petrinet.impl.NetworkImpl#getName Name}
  • + *
  • {@link petrinet.impl.NetworkImpl#getNodes Nodes}
  • + *
+ * + * @generated + */ +public class NetworkImpl extends MinimalEObjectImpl.Container implements Network { + /** + * 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 #getNodes() Nodes}' containment reference list. + * + * + * @see #getNodes() + * @generated + * @ordered + */ + protected EList nodes; + + /** + * + * + * @generated + */ + protected NetworkImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return PetrinetPackage.Literals.NETWORK; + } + + /** + * + * + * @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, PetrinetPackage.NETWORK__NAME, oldName, name)); + } + + /** + * + * + * @generated + */ + public EList getNodes() { + if (nodes == null) { + nodes = new EObjectContainmentWithInverseEList(Node.class, this, PetrinetPackage.NETWORK__NODES, PetrinetPackage.NODE__NETWORK); + } + return nodes; + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case PetrinetPackage.NETWORK__NODES: + return ((InternalEList)(InternalEList)getNodes()).basicAdd(otherEnd, msgs); + } + return super.eInverseAdd(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case PetrinetPackage.NETWORK__NODES: + return ((InternalEList)getNodes()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case PetrinetPackage.NETWORK__NAME: + return getName(); + case PetrinetPackage.NETWORK__NODES: + return getNodes(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case PetrinetPackage.NETWORK__NAME: + setName((String)newValue); + return; + case PetrinetPackage.NETWORK__NODES: + getNodes().clear(); + getNodes().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case PetrinetPackage.NETWORK__NAME: + setName(NAME_EDEFAULT); + return; + case PetrinetPackage.NETWORK__NODES: + getNodes().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case PetrinetPackage.NETWORK__NAME: + return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + case PetrinetPackage.NETWORK__NODES: + return nodes != null && !nodes.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(); + } + +} //NetworkImpl diff --git a/workspace/fr.n7.petrinet/src/petrinet/impl/NodeImpl.java b/workspace/fr.n7.petrinet/src/petrinet/impl/NodeImpl.java new file mode 100755 index 0000000..ed2a1a5 --- /dev/null +++ b/workspace/fr.n7.petrinet/src/petrinet/impl/NodeImpl.java @@ -0,0 +1,264 @@ +/** + */ +package petrinet.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 org.eclipse.emf.ecore.impl.MinimalEObjectImpl; + +import org.eclipse.emf.ecore.util.EcoreUtil; + +import petrinet.Network; +import petrinet.Node; +import petrinet.PetrinetPackage; + +/** + * + * An implementation of the model object 'Node'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link petrinet.impl.NodeImpl#getName Name}
  • + *
  • {@link petrinet.impl.NodeImpl#getNetwork Network}
  • + *
+ * + * @generated + */ +public abstract class NodeImpl extends MinimalEObjectImpl.Container implements Node { + /** + * 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 NodeImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return PetrinetPackage.Literals.NODE; + } + + /** + * + * + * @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, PetrinetPackage.NODE__NAME, oldName, name)); + } + + /** + * + * + * @generated + */ + public Network getNetwork() { + if (eContainerFeatureID() != PetrinetPackage.NODE__NETWORK) return null; + return (Network)eInternalContainer(); + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetNetwork(Network newNetwork, NotificationChain msgs) { + msgs = eBasicSetContainer((InternalEObject)newNetwork, PetrinetPackage.NODE__NETWORK, msgs); + return msgs; + } + + /** + * + * + * @generated + */ + public void setNetwork(Network newNetwork) { + if (newNetwork != eInternalContainer() || (eContainerFeatureID() != PetrinetPackage.NODE__NETWORK && newNetwork != null)) { + if (EcoreUtil.isAncestor(this, newNetwork)) + throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); + NotificationChain msgs = null; + if (eInternalContainer() != null) + msgs = eBasicRemoveFromContainer(msgs); + if (newNetwork != null) + msgs = ((InternalEObject)newNetwork).eInverseAdd(this, PetrinetPackage.NETWORK__NODES, Network.class, msgs); + msgs = basicSetNetwork(newNetwork, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, PetrinetPackage.NODE__NETWORK, newNetwork, newNetwork)); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case PetrinetPackage.NODE__NETWORK: + if (eInternalContainer() != null) + msgs = eBasicRemoveFromContainer(msgs); + return basicSetNetwork((Network)otherEnd, msgs); + } + return super.eInverseAdd(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case PetrinetPackage.NODE__NETWORK: + return basicSetNetwork(null, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { + switch (eContainerFeatureID()) { + case PetrinetPackage.NODE__NETWORK: + return eInternalContainer().eInverseRemove(this, PetrinetPackage.NETWORK__NODES, Network.class, msgs); + } + return super.eBasicRemoveFromContainerFeature(msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case PetrinetPackage.NODE__NAME: + return getName(); + case PetrinetPackage.NODE__NETWORK: + return getNetwork(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case PetrinetPackage.NODE__NAME: + setName((String)newValue); + return; + case PetrinetPackage.NODE__NETWORK: + setNetwork((Network)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case PetrinetPackage.NODE__NAME: + setName(NAME_EDEFAULT); + return; + case PetrinetPackage.NODE__NETWORK: + setNetwork((Network)null); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case PetrinetPackage.NODE__NAME: + return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + case PetrinetPackage.NODE__NETWORK: + return getNetwork() != null; + } + 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(); + } + +} //NodeImpl diff --git a/workspace/fr.n7.petrinet/src/petrinet/impl/PetrinetFactoryImpl.java b/workspace/fr.n7.petrinet/src/petrinet/impl/PetrinetFactoryImpl.java new file mode 100755 index 0000000..d769926 --- /dev/null +++ b/workspace/fr.n7.petrinet/src/petrinet/impl/PetrinetFactoryImpl.java @@ -0,0 +1,128 @@ +/** + */ +package petrinet.impl; + +import org.eclipse.emf.ecore.EClass; +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 petrinet.*; + +/** + * + * An implementation of the model Factory. + * + * @generated + */ +public class PetrinetFactoryImpl extends EFactoryImpl implements PetrinetFactory { + /** + * Creates the default factory implementation. + * + * + * @generated + */ + public static PetrinetFactory init() { + try { + PetrinetFactory thePetrinetFactory = (PetrinetFactory)EPackage.Registry.INSTANCE.getEFactory(PetrinetPackage.eNS_URI); + if (thePetrinetFactory != null) { + return thePetrinetFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new PetrinetFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public PetrinetFactoryImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case PetrinetPackage.NETWORK: return createNetwork(); + case PetrinetPackage.PLACE: return createPlace(); + case PetrinetPackage.ARC: return createArc(); + case PetrinetPackage.TRANSITION: return createTransition(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public Network createNetwork() { + NetworkImpl network = new NetworkImpl(); + return network; + } + + /** + * + * + * @generated + */ + public Place createPlace() { + PlaceImpl place = new PlaceImpl(); + return place; + } + + /** + * + * + * @generated + */ + public Arc createArc() { + ArcImpl arc = new ArcImpl(); + return arc; + } + + /** + * + * + * @generated + */ + public Transition createTransition() { + TransitionImpl transition = new TransitionImpl(); + return transition; + } + + /** + * + * + * @generated + */ + public PetrinetPackage getPetrinetPackage() { + return (PetrinetPackage)getEPackage(); + } + + /** + * + * + * @deprecated + * @generated + */ + @Deprecated + public static PetrinetPackage getPackage() { + return PetrinetPackage.eINSTANCE; + } + +} //PetrinetFactoryImpl diff --git a/workspace/fr.n7.petrinet/src/petrinet/impl/PetrinetPackageImpl.java b/workspace/fr.n7.petrinet/src/petrinet/impl/PetrinetPackageImpl.java new file mode 100755 index 0000000..db9424e --- /dev/null +++ b/workspace/fr.n7.petrinet/src/petrinet/impl/PetrinetPackageImpl.java @@ -0,0 +1,374 @@ +/** + */ +package petrinet.impl; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +import org.eclipse.emf.ecore.impl.EPackageImpl; + +import petrinet.Arc; +import petrinet.Network; +import petrinet.Node; +import petrinet.PetrinetFactory; +import petrinet.PetrinetPackage; +import petrinet.Place; +import petrinet.Transition; + +/** + * + * An implementation of the model Package. + * + * @generated + */ +public class PetrinetPackageImpl extends EPackageImpl implements PetrinetPackage { + /** + * + * + * @generated + */ + private EClass networkEClass = null; + + /** + * + * + * @generated + */ + private EClass nodeEClass = null; + + /** + * + * + * @generated + */ + private EClass placeEClass = null; + + /** + * + * + * @generated + */ + private EClass arcEClass = null; + + /** + * + * + * @generated + */ + private EClass transitionEClass = 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 petrinet.PetrinetPackage#eNS_URI + * @see #init() + * @generated + */ + private PetrinetPackageImpl() { + super(eNS_URI, PetrinetFactory.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 PetrinetPackage#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 PetrinetPackage init() { + if (isInited) return (PetrinetPackage)EPackage.Registry.INSTANCE.getEPackage(PetrinetPackage.eNS_URI); + + // Obtain or create and register package + Object registeredPetrinetPackage = EPackage.Registry.INSTANCE.get(eNS_URI); + PetrinetPackageImpl thePetrinetPackage = registeredPetrinetPackage instanceof PetrinetPackageImpl ? (PetrinetPackageImpl)registeredPetrinetPackage : new PetrinetPackageImpl(); + + isInited = true; + + // Create package meta-data objects + thePetrinetPackage.createPackageContents(); + + // Initialize created meta-data + thePetrinetPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + thePetrinetPackage.freeze(); + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(PetrinetPackage.eNS_URI, thePetrinetPackage); + return thePetrinetPackage; + } + + /** + * + * + * @generated + */ + public EClass getNetwork() { + return networkEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getNetwork_Name() { + return (EAttribute)networkEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getNetwork_Nodes() { + return (EReference)networkEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EClass getNode() { + return nodeEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getNode_Name() { + return (EAttribute)nodeEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getNode_Network() { + return (EReference)nodeEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EClass getPlace() { + return placeEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getPlace_Tokens() { + return (EAttribute)placeEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getPlace_Arcs() { + return (EReference)placeEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EClass getArc() { + return arcEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getArc_Weight() { + return (EAttribute)arcEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getArc_Outgoing() { + return (EAttribute)arcEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EReference getArc_Place() { + return (EReference)arcEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EReference getArc_Transition() { + return (EReference)arcEClass.getEStructuralFeatures().get(3); + } + + /** + * + * + * @generated + */ + public EClass getTransition() { + return transitionEClass; + } + + /** + * + * + * @generated + */ + public EReference getTransition_Arcs() { + return (EReference)transitionEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public PetrinetFactory getPetrinetFactory() { + return (PetrinetFactory)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 + networkEClass = createEClass(NETWORK); + createEAttribute(networkEClass, NETWORK__NAME); + createEReference(networkEClass, NETWORK__NODES); + + nodeEClass = createEClass(NODE); + createEAttribute(nodeEClass, NODE__NAME); + createEReference(nodeEClass, NODE__NETWORK); + + placeEClass = createEClass(PLACE); + createEAttribute(placeEClass, PLACE__TOKENS); + createEReference(placeEClass, PLACE__ARCS); + + arcEClass = createEClass(ARC); + createEAttribute(arcEClass, ARC__WEIGHT); + createEAttribute(arcEClass, ARC__OUTGOING); + createEReference(arcEClass, ARC__PLACE); + createEReference(arcEClass, ARC__TRANSITION); + + transitionEClass = createEClass(TRANSITION); + createEReference(transitionEClass, TRANSITION__ARCS); + } + + /** + * + * + * @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 + placeEClass.getESuperTypes().add(this.getNode()); + transitionEClass.getESuperTypes().add(this.getNode()); + + // Initialize classes, features, and operations; add parameters + initEClass(networkEClass, Network.class, "Network", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getNetwork_Name(), ecorePackage.getEString(), "name", null, 1, 1, Network.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getNetwork_Nodes(), this.getNode(), this.getNode_Network(), "nodes", null, 0, -1, Network.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(nodeEClass, Node.class, "Node", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getNode_Name(), ecorePackage.getEString(), "name", null, 1, 1, Node.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getNode_Network(), this.getNetwork(), this.getNetwork_Nodes(), "network", null, 1, 1, Node.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(placeEClass, Place.class, "Place", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getPlace_Tokens(), ecorePackage.getEInt(), "tokens", null, 1, 1, Place.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getPlace_Arcs(), this.getArc(), this.getArc_Place(), "arcs", null, 0, -1, Place.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(arcEClass, Arc.class, "Arc", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getArc_Weight(), ecorePackage.getEInt(), "weight", null, 1, 1, Arc.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getArc_Outgoing(), ecorePackage.getEBoolean(), "outgoing", null, 1, 1, Arc.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getArc_Place(), this.getPlace(), this.getPlace_Arcs(), "place", null, 1, 1, Arc.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getArc_Transition(), this.getTransition(), this.getTransition_Arcs(), "transition", null, 1, 1, Arc.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(transitionEClass, Transition.class, "Transition", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getTransition_Arcs(), this.getArc(), this.getArc_Transition(), "arcs", null, 0, -1, Transition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + // Create resource + createResource(eNS_URI); + } + +} //PetrinetPackageImpl diff --git a/workspace/fr.n7.petrinet/src/petrinet/impl/PlaceImpl.java b/workspace/fr.n7.petrinet/src/petrinet/impl/PlaceImpl.java new file mode 100755 index 0000000..7832bda --- /dev/null +++ b/workspace/fr.n7.petrinet/src/petrinet/impl/PlaceImpl.java @@ -0,0 +1,236 @@ +/** + */ +package petrinet.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.EObjectWithInverseResolvingEList; +import org.eclipse.emf.ecore.util.InternalEList; + +import petrinet.Arc; +import petrinet.PetrinetPackage; +import petrinet.Place; + +/** + * + * An implementation of the model object 'Place'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link petrinet.impl.PlaceImpl#getTokens Tokens}
  • + *
  • {@link petrinet.impl.PlaceImpl#getArcs Arcs}
  • + *
+ * + * @generated + */ +public class PlaceImpl extends NodeImpl implements Place { + /** + * The default value of the '{@link #getTokens() Tokens}' attribute. + * + * + * @see #getTokens() + * @generated + * @ordered + */ + protected static final int TOKENS_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getTokens() Tokens}' attribute. + * + * + * @see #getTokens() + * @generated + * @ordered + */ + protected int tokens = TOKENS_EDEFAULT; + + /** + * The cached value of the '{@link #getArcs() Arcs}' reference list. + * + * + * @see #getArcs() + * @generated + * @ordered + */ + protected EList arcs; + + /** + * + * + * @generated + */ + protected PlaceImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return PetrinetPackage.Literals.PLACE; + } + + /** + * + * + * @generated + */ + public int getTokens() { + return tokens; + } + + /** + * + * + * @generated + */ + public void setTokens(int newTokens) { + int oldTokens = tokens; + tokens = newTokens; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, PetrinetPackage.PLACE__TOKENS, oldTokens, tokens)); + } + + /** + * + * + * @generated + */ + public EList getArcs() { + if (arcs == null) { + arcs = new EObjectWithInverseResolvingEList(Arc.class, this, PetrinetPackage.PLACE__ARCS, PetrinetPackage.ARC__PLACE); + } + return arcs; + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case PetrinetPackage.PLACE__ARCS: + return ((InternalEList)(InternalEList)getArcs()).basicAdd(otherEnd, msgs); + } + return super.eInverseAdd(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case PetrinetPackage.PLACE__ARCS: + return ((InternalEList)getArcs()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case PetrinetPackage.PLACE__TOKENS: + return getTokens(); + case PetrinetPackage.PLACE__ARCS: + return getArcs(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case PetrinetPackage.PLACE__TOKENS: + setTokens((Integer)newValue); + return; + case PetrinetPackage.PLACE__ARCS: + getArcs().clear(); + getArcs().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case PetrinetPackage.PLACE__TOKENS: + setTokens(TOKENS_EDEFAULT); + return; + case PetrinetPackage.PLACE__ARCS: + getArcs().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case PetrinetPackage.PLACE__TOKENS: + return tokens != TOKENS_EDEFAULT; + case PetrinetPackage.PLACE__ARCS: + return arcs != null && !arcs.isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuilder result = new StringBuilder(super.toString()); + result.append(" (tokens: "); + result.append(tokens); + result.append(')'); + return result.toString(); + } + +} //PlaceImpl diff --git a/workspace/fr.n7.petrinet/src/petrinet/impl/TransitionImpl.java b/workspace/fr.n7.petrinet/src/petrinet/impl/TransitionImpl.java new file mode 100755 index 0000000..f03b0ec --- /dev/null +++ b/workspace/fr.n7.petrinet/src/petrinet/impl/TransitionImpl.java @@ -0,0 +1,165 @@ +/** + */ +package petrinet.impl; + +import java.util.Collection; + +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.util.EObjectContainmentWithInverseEList; +import org.eclipse.emf.ecore.util.InternalEList; + +import petrinet.Arc; +import petrinet.PetrinetPackage; +import petrinet.Transition; + +/** + * + * An implementation of the model object 'Transition'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link petrinet.impl.TransitionImpl#getArcs Arcs}
  • + *
+ * + * @generated + */ +public class TransitionImpl extends NodeImpl implements Transition { + /** + * The cached value of the '{@link #getArcs() Arcs}' containment reference list. + * + * + * @see #getArcs() + * @generated + * @ordered + */ + protected EList arcs; + + /** + * + * + * @generated + */ + protected TransitionImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return PetrinetPackage.Literals.TRANSITION; + } + + /** + * + * + * @generated + */ + public EList getArcs() { + if (arcs == null) { + arcs = new EObjectContainmentWithInverseEList(Arc.class, this, PetrinetPackage.TRANSITION__ARCS, PetrinetPackage.ARC__TRANSITION); + } + return arcs; + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case PetrinetPackage.TRANSITION__ARCS: + return ((InternalEList)(InternalEList)getArcs()).basicAdd(otherEnd, msgs); + } + return super.eInverseAdd(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case PetrinetPackage.TRANSITION__ARCS: + return ((InternalEList)getArcs()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case PetrinetPackage.TRANSITION__ARCS: + return getArcs(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case PetrinetPackage.TRANSITION__ARCS: + getArcs().clear(); + getArcs().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case PetrinetPackage.TRANSITION__ARCS: + getArcs().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case PetrinetPackage.TRANSITION__ARCS: + return arcs != null && !arcs.isEmpty(); + } + return super.eIsSet(featureID); + } + +} //TransitionImpl diff --git a/workspace/fr.n7.petrinet/src/petrinet/util/PetrinetAdapterFactory.java b/workspace/fr.n7.petrinet/src/petrinet/util/PetrinetAdapterFactory.java new file mode 100755 index 0000000..726ae31 --- /dev/null +++ b/workspace/fr.n7.petrinet/src/petrinet/util/PetrinetAdapterFactory.java @@ -0,0 +1,192 @@ +/** + */ +package petrinet.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 petrinet.*; + +/** + * + * The Adapter Factory for the model. + * It provides an adapter createXXX method for each class of the model. + * + * @see petrinet.PetrinetPackage + * @generated + */ +public class PetrinetAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * + * + * @generated + */ + protected static PetrinetPackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * + * + * @generated + */ + public PetrinetAdapterFactory() { + if (modelPackage == null) { + modelPackage = PetrinetPackage.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 PetrinetSwitch modelSwitch = + new PetrinetSwitch() { + @Override + public Adapter caseNetwork(Network object) { + return createNetworkAdapter(); + } + @Override + public Adapter caseNode(Node object) { + return createNodeAdapter(); + } + @Override + public Adapter casePlace(Place object) { + return createPlaceAdapter(); + } + @Override + public Adapter caseArc(Arc object) { + return createArcAdapter(); + } + @Override + public Adapter caseTransition(Transition object) { + return createTransitionAdapter(); + } + @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 petrinet.Network Network}'. + * + * 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 petrinet.Network + * @generated + */ + public Adapter createNetworkAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link petrinet.Node Node}'. + * + * 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 petrinet.Node + * @generated + */ + public Adapter createNodeAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link petrinet.Place Place}'. + * + * 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 petrinet.Place + * @generated + */ + public Adapter createPlaceAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link petrinet.Arc Arc}'. + * + * 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 petrinet.Arc + * @generated + */ + public Adapter createArcAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link petrinet.Transition Transition}'. + * + * 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 petrinet.Transition + * @generated + */ + public Adapter createTransitionAdapter() { + 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; + } + +} //PetrinetAdapterFactory diff --git a/workspace/fr.n7.petrinet/src/petrinet/util/PetrinetSwitch.java b/workspace/fr.n7.petrinet/src/petrinet/util/PetrinetSwitch.java new file mode 100755 index 0000000..b5bcd9e --- /dev/null +++ b/workspace/fr.n7.petrinet/src/petrinet/util/PetrinetSwitch.java @@ -0,0 +1,196 @@ +/** + */ +package petrinet.util; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.util.Switch; + +import petrinet.*; + +/** + * + * 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 petrinet.PetrinetPackage + * @generated + */ +public class PetrinetSwitch extends Switch { + /** + * The cached model package + * + * + * @generated + */ + protected static PetrinetPackage modelPackage; + + /** + * Creates an instance of the switch. + * + * + * @generated + */ + public PetrinetSwitch() { + if (modelPackage == null) { + modelPackage = PetrinetPackage.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 PetrinetPackage.NETWORK: { + Network network = (Network)theEObject; + T result = caseNetwork(network); + if (result == null) result = defaultCase(theEObject); + return result; + } + case PetrinetPackage.NODE: { + Node node = (Node)theEObject; + T result = caseNode(node); + if (result == null) result = defaultCase(theEObject); + return result; + } + case PetrinetPackage.PLACE: { + Place place = (Place)theEObject; + T result = casePlace(place); + if (result == null) result = caseNode(place); + if (result == null) result = defaultCase(theEObject); + return result; + } + case PetrinetPackage.ARC: { + Arc arc = (Arc)theEObject; + T result = caseArc(arc); + if (result == null) result = defaultCase(theEObject); + return result; + } + case PetrinetPackage.TRANSITION: { + Transition transition = (Transition)theEObject; + T result = caseTransition(transition); + if (result == null) result = caseNode(transition); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of 'Network'. + * + * 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 'Network'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseNetwork(Network object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Node'. + * + * 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 'Node'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseNode(Node object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Place'. + * + * 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 'Place'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T casePlace(Place object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Arc'. + * + * 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 'Arc'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseArc(Arc object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Transition'. + * + * 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 'Transition'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseTransition(Transition 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; + } + +} //PetrinetSwitch diff --git a/workspace/game.tests/test-bin/.gitignore b/workspace/game.tests/test-bin/.gitignore new file mode 100644 index 0000000..7904a1c --- /dev/null +++ b/workspace/game.tests/test-bin/.gitignore @@ -0,0 +1,2 @@ +/game/ +/xtext/ diff --git a/workspace/game.tests/test-bin/xtext/tests/.GameParsingTest.xtendbin b/workspace/game.tests/test-bin/xtext/tests/.GameParsingTest.xtendbin index e4d0dcc..1f5bcf7 100644 Binary files a/workspace/game.tests/test-bin/xtext/tests/.GameParsingTest.xtendbin and b/workspace/game.tests/test-bin/xtext/tests/.GameParsingTest.xtendbin differ diff --git a/workspace/game.tests/xtend-gen/xtext/tests/.GameParsingTest.xtendbin b/workspace/game.tests/xtend-gen/xtext/tests/.GameParsingTest.xtendbin index e4d0dcc..1f5bcf7 100644 Binary files a/workspace/game.tests/xtend-gen/xtext/tests/.GameParsingTest.xtendbin and b/workspace/game.tests/xtend-gen/xtext/tests/.GameParsingTest.xtendbin differ diff --git a/workspace/game.tests/xtend-gen/xtext/tests/.gitignore b/workspace/game.tests/xtend-gen/xtext/tests/.gitignore new file mode 100644 index 0000000..5fdc003 --- /dev/null +++ b/workspace/game.tests/xtend-gen/xtext/tests/.gitignore @@ -0,0 +1,3 @@ +/.GameParsingTest.java._trace +/.GameParsingTest.xtendbin +/GameParsingTest.java diff --git a/workspace/game/.gitignore b/workspace/game/.gitignore new file mode 100644 index 0000000..ae3c172 --- /dev/null +++ b/workspace/game/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/workspace/game/bin/xtext/AbstractGameRuntimeModule.class b/workspace/game/bin/xtext/AbstractGameRuntimeModule.class index 84e1ca6..9afebf5 100644 Binary files a/workspace/game/bin/xtext/AbstractGameRuntimeModule.class and b/workspace/game/bin/xtext/AbstractGameRuntimeModule.class differ diff --git a/workspace/game/bin/xtext/GameRuntimeModule.class b/workspace/game/bin/xtext/GameRuntimeModule.class index 2b91d0f..f995be5 100644 Binary files a/workspace/game/bin/xtext/GameRuntimeModule.class and b/workspace/game/bin/xtext/GameRuntimeModule.class differ diff --git a/workspace/game/bin/xtext/GameStandaloneSetup.class b/workspace/game/bin/xtext/GameStandaloneSetup.class index 049a1fb..17bdee6 100644 Binary files a/workspace/game/bin/xtext/GameStandaloneSetup.class and b/workspace/game/bin/xtext/GameStandaloneSetup.class differ diff --git a/workspace/game/bin/xtext/GameStandaloneSetupGenerated.class b/workspace/game/bin/xtext/GameStandaloneSetupGenerated.class index e40af6f..ccf68f5 100644 Binary files a/workspace/game/bin/xtext/GameStandaloneSetupGenerated.class and b/workspace/game/bin/xtext/GameStandaloneSetupGenerated.class differ diff --git a/workspace/game/bin/xtext/game/Action.class b/workspace/game/bin/xtext/game/Action.class index f386a09..758a43d 100644 Binary files a/workspace/game/bin/xtext/game/Action.class and b/workspace/game/bin/xtext/game/Action.class differ diff --git a/workspace/game/bin/xtext/game/AntiConditionConnaissance.class b/workspace/game/bin/xtext/game/AntiConditionConnaissance.class index 02aa32d..11851c9 100644 Binary files a/workspace/game/bin/xtext/game/AntiConditionConnaissance.class and b/workspace/game/bin/xtext/game/AntiConditionConnaissance.class differ diff --git a/workspace/game/bin/xtext/game/Chemin.class b/workspace/game/bin/xtext/game/Chemin.class index 174a88c..d521b45 100644 Binary files a/workspace/game/bin/xtext/game/Chemin.class and b/workspace/game/bin/xtext/game/Chemin.class differ diff --git a/workspace/game/bin/xtext/game/Condition.class b/workspace/game/bin/xtext/game/Condition.class index 38bdc71..5db4537 100644 Binary files a/workspace/game/bin/xtext/game/Condition.class and b/workspace/game/bin/xtext/game/Condition.class differ diff --git a/workspace/game/bin/xtext/game/ConditionConnaissance.class b/workspace/game/bin/xtext/game/ConditionConnaissance.class index b4b7e0a..0c6c59d 100644 Binary files a/workspace/game/bin/xtext/game/ConditionConnaissance.class and b/workspace/game/bin/xtext/game/ConditionConnaissance.class differ diff --git a/workspace/game/bin/xtext/game/ConditionEt.class b/workspace/game/bin/xtext/game/ConditionEt.class index 285e4a1..c83a266 100644 Binary files a/workspace/game/bin/xtext/game/ConditionEt.class and b/workspace/game/bin/xtext/game/ConditionEt.class differ diff --git a/workspace/game/bin/xtext/game/ConditionObjet.class b/workspace/game/bin/xtext/game/ConditionObjet.class index 43ae1ab..556eb2d 100644 Binary files a/workspace/game/bin/xtext/game/ConditionObjet.class and b/workspace/game/bin/xtext/game/ConditionObjet.class differ diff --git a/workspace/game/bin/xtext/game/ConditionTest.class b/workspace/game/bin/xtext/game/ConditionTest.class index 96694a6..dc32196 100644 Binary files a/workspace/game/bin/xtext/game/ConditionTest.class and b/workspace/game/bin/xtext/game/ConditionTest.class differ diff --git a/workspace/game/bin/xtext/game/Connaissance.class b/workspace/game/bin/xtext/game/Connaissance.class index efbb9d6..008f44b 100644 Binary files a/workspace/game/bin/xtext/game/Connaissance.class and b/workspace/game/bin/xtext/game/Connaissance.class differ diff --git a/workspace/game/bin/xtext/game/Description.class b/workspace/game/bin/xtext/game/Description.class index 3d422e7..e8733f9 100644 Binary files a/workspace/game/bin/xtext/game/Description.class and b/workspace/game/bin/xtext/game/Description.class differ diff --git a/workspace/game/bin/xtext/game/Explorateur.class b/workspace/game/bin/xtext/game/Explorateur.class index f576c4f..ff2c3de 100644 Binary files a/workspace/game/bin/xtext/game/Explorateur.class and b/workspace/game/bin/xtext/game/Explorateur.class differ diff --git a/workspace/game/bin/xtext/game/GameFactory.class b/workspace/game/bin/xtext/game/GameFactory.class index 6f5f0ae..c23facb 100644 Binary files a/workspace/game/bin/xtext/game/GameFactory.class and b/workspace/game/bin/xtext/game/GameFactory.class differ diff --git a/workspace/game/bin/xtext/game/GamePackage$Literals.class b/workspace/game/bin/xtext/game/GamePackage$Literals.class index e1fe8cc..2213ec9 100644 Binary files a/workspace/game/bin/xtext/game/GamePackage$Literals.class and b/workspace/game/bin/xtext/game/GamePackage$Literals.class differ diff --git a/workspace/game/bin/xtext/game/GamePackage.class b/workspace/game/bin/xtext/game/GamePackage.class index 8e3ead7..a750462 100644 Binary files a/workspace/game/bin/xtext/game/GamePackage.class and b/workspace/game/bin/xtext/game/GamePackage.class differ diff --git a/workspace/game/bin/xtext/game/Interraction.class b/workspace/game/bin/xtext/game/Interraction.class index da58b1a..178251d 100644 Binary files a/workspace/game/bin/xtext/game/Interraction.class and b/workspace/game/bin/xtext/game/Interraction.class differ diff --git a/workspace/game/bin/xtext/game/Jeu.class b/workspace/game/bin/xtext/game/Jeu.class index 96a2404..81d529b 100644 Binary files a/workspace/game/bin/xtext/game/Jeu.class and b/workspace/game/bin/xtext/game/Jeu.class differ diff --git a/workspace/game/bin/xtext/game/Lieu.class b/workspace/game/bin/xtext/game/Lieu.class index a2c17c2..dfcb385 100644 Binary files a/workspace/game/bin/xtext/game/Lieu.class and b/workspace/game/bin/xtext/game/Lieu.class differ diff --git a/workspace/game/bin/xtext/game/Objet.class b/workspace/game/bin/xtext/game/Objet.class index 48daf2f..a6b6840 100644 Binary files a/workspace/game/bin/xtext/game/Objet.class and b/workspace/game/bin/xtext/game/Objet.class differ diff --git a/workspace/game/bin/xtext/game/Personne.class b/workspace/game/bin/xtext/game/Personne.class index 68d2450..9f9423f 100644 Binary files a/workspace/game/bin/xtext/game/Personne.class and b/workspace/game/bin/xtext/game/Personne.class differ diff --git a/workspace/game/bin/xtext/game/Territoire.class b/workspace/game/bin/xtext/game/Territoire.class index 24a452a..d80c976 100644 Binary files a/workspace/game/bin/xtext/game/Territoire.class and b/workspace/game/bin/xtext/game/Territoire.class differ diff --git a/workspace/game/bin/xtext/game/Transformation.class b/workspace/game/bin/xtext/game/Transformation.class index cf33288..7ed21f8 100644 Binary files a/workspace/game/bin/xtext/game/Transformation.class and b/workspace/game/bin/xtext/game/Transformation.class differ diff --git a/workspace/game/bin/xtext/game/impl/ActionImpl.class b/workspace/game/bin/xtext/game/impl/ActionImpl.class index 39d6ff0..2681834 100644 Binary files a/workspace/game/bin/xtext/game/impl/ActionImpl.class and b/workspace/game/bin/xtext/game/impl/ActionImpl.class differ diff --git a/workspace/game/bin/xtext/game/impl/AntiConditionConnaissanceImpl.class b/workspace/game/bin/xtext/game/impl/AntiConditionConnaissanceImpl.class index e70b588..3928a45 100644 Binary files a/workspace/game/bin/xtext/game/impl/AntiConditionConnaissanceImpl.class and b/workspace/game/bin/xtext/game/impl/AntiConditionConnaissanceImpl.class differ diff --git a/workspace/game/bin/xtext/game/impl/CheminImpl.class b/workspace/game/bin/xtext/game/impl/CheminImpl.class index 6962bb2..867cc64 100644 Binary files a/workspace/game/bin/xtext/game/impl/CheminImpl.class and b/workspace/game/bin/xtext/game/impl/CheminImpl.class differ diff --git a/workspace/game/bin/xtext/game/impl/ConditionConnaissanceImpl.class b/workspace/game/bin/xtext/game/impl/ConditionConnaissanceImpl.class index 4f76b11..03e77f9 100644 Binary files a/workspace/game/bin/xtext/game/impl/ConditionConnaissanceImpl.class and b/workspace/game/bin/xtext/game/impl/ConditionConnaissanceImpl.class differ diff --git a/workspace/game/bin/xtext/game/impl/ConditionEtImpl.class b/workspace/game/bin/xtext/game/impl/ConditionEtImpl.class index 3e204e4..7bf76bf 100644 Binary files a/workspace/game/bin/xtext/game/impl/ConditionEtImpl.class and b/workspace/game/bin/xtext/game/impl/ConditionEtImpl.class differ diff --git a/workspace/game/bin/xtext/game/impl/ConditionImpl.class b/workspace/game/bin/xtext/game/impl/ConditionImpl.class index 673dd33..531fe2b 100644 Binary files a/workspace/game/bin/xtext/game/impl/ConditionImpl.class and b/workspace/game/bin/xtext/game/impl/ConditionImpl.class differ diff --git a/workspace/game/bin/xtext/game/impl/ConditionObjetImpl.class b/workspace/game/bin/xtext/game/impl/ConditionObjetImpl.class index 7328001..c9c14c4 100644 Binary files a/workspace/game/bin/xtext/game/impl/ConditionObjetImpl.class and b/workspace/game/bin/xtext/game/impl/ConditionObjetImpl.class differ diff --git a/workspace/game/bin/xtext/game/impl/ConditionTestImpl.class b/workspace/game/bin/xtext/game/impl/ConditionTestImpl.class index b77540f..6da469c 100644 Binary files a/workspace/game/bin/xtext/game/impl/ConditionTestImpl.class and b/workspace/game/bin/xtext/game/impl/ConditionTestImpl.class differ diff --git a/workspace/game/bin/xtext/game/impl/ConnaissanceImpl.class b/workspace/game/bin/xtext/game/impl/ConnaissanceImpl.class index 99b7ca3..59c556d 100644 Binary files a/workspace/game/bin/xtext/game/impl/ConnaissanceImpl.class and b/workspace/game/bin/xtext/game/impl/ConnaissanceImpl.class differ diff --git a/workspace/game/bin/xtext/game/impl/DescriptionImpl.class b/workspace/game/bin/xtext/game/impl/DescriptionImpl.class index 9608862..162a3f6 100644 Binary files a/workspace/game/bin/xtext/game/impl/DescriptionImpl.class and b/workspace/game/bin/xtext/game/impl/DescriptionImpl.class differ diff --git a/workspace/game/bin/xtext/game/impl/ExplorateurImpl.class b/workspace/game/bin/xtext/game/impl/ExplorateurImpl.class index bc4727e..151f0da 100644 Binary files a/workspace/game/bin/xtext/game/impl/ExplorateurImpl.class and b/workspace/game/bin/xtext/game/impl/ExplorateurImpl.class differ diff --git a/workspace/game/bin/xtext/game/impl/GameFactoryImpl.class b/workspace/game/bin/xtext/game/impl/GameFactoryImpl.class index 4d5b7cc..28c57df 100644 Binary files a/workspace/game/bin/xtext/game/impl/GameFactoryImpl.class and b/workspace/game/bin/xtext/game/impl/GameFactoryImpl.class differ diff --git a/workspace/game/bin/xtext/game/impl/GamePackageImpl.class b/workspace/game/bin/xtext/game/impl/GamePackageImpl.class index 9dc83ac..dbf22da 100644 Binary files a/workspace/game/bin/xtext/game/impl/GamePackageImpl.class and b/workspace/game/bin/xtext/game/impl/GamePackageImpl.class differ diff --git a/workspace/game/bin/xtext/game/impl/InterractionImpl.class b/workspace/game/bin/xtext/game/impl/InterractionImpl.class index e77ab91..74025f8 100644 Binary files a/workspace/game/bin/xtext/game/impl/InterractionImpl.class and b/workspace/game/bin/xtext/game/impl/InterractionImpl.class differ diff --git a/workspace/game/bin/xtext/game/impl/JeuImpl.class b/workspace/game/bin/xtext/game/impl/JeuImpl.class index bf66a21..49c9ea2 100644 Binary files a/workspace/game/bin/xtext/game/impl/JeuImpl.class and b/workspace/game/bin/xtext/game/impl/JeuImpl.class differ diff --git a/workspace/game/bin/xtext/game/impl/LieuImpl.class b/workspace/game/bin/xtext/game/impl/LieuImpl.class index 6ea44e3..f92a42a 100644 Binary files a/workspace/game/bin/xtext/game/impl/LieuImpl.class and b/workspace/game/bin/xtext/game/impl/LieuImpl.class differ diff --git a/workspace/game/bin/xtext/game/impl/ObjetImpl.class b/workspace/game/bin/xtext/game/impl/ObjetImpl.class index 26bde9e..0d80db9 100644 Binary files a/workspace/game/bin/xtext/game/impl/ObjetImpl.class and b/workspace/game/bin/xtext/game/impl/ObjetImpl.class differ diff --git a/workspace/game/bin/xtext/game/impl/PersonneImpl.class b/workspace/game/bin/xtext/game/impl/PersonneImpl.class index 28308f3..28d49f0 100644 Binary files a/workspace/game/bin/xtext/game/impl/PersonneImpl.class and b/workspace/game/bin/xtext/game/impl/PersonneImpl.class differ diff --git a/workspace/game/bin/xtext/game/impl/TerritoireImpl.class b/workspace/game/bin/xtext/game/impl/TerritoireImpl.class index e9069a1..9413cec 100644 Binary files a/workspace/game/bin/xtext/game/impl/TerritoireImpl.class and b/workspace/game/bin/xtext/game/impl/TerritoireImpl.class differ diff --git a/workspace/game/bin/xtext/game/impl/TransformationImpl.class b/workspace/game/bin/xtext/game/impl/TransformationImpl.class index 29e84f9..4e9693e 100644 Binary files a/workspace/game/bin/xtext/game/impl/TransformationImpl.class and b/workspace/game/bin/xtext/game/impl/TransformationImpl.class differ diff --git a/workspace/game/bin/xtext/game/util/GameAdapterFactory.class b/workspace/game/bin/xtext/game/util/GameAdapterFactory.class index 20259b2..a8b5d6b 100644 Binary files a/workspace/game/bin/xtext/game/util/GameAdapterFactory.class and b/workspace/game/bin/xtext/game/util/GameAdapterFactory.class differ diff --git a/workspace/game/bin/xtext/game/util/GameSwitch.class b/workspace/game/bin/xtext/game/util/GameSwitch.class index aa303ba..7d45a00 100644 Binary files a/workspace/game/bin/xtext/game/util/GameSwitch.class and b/workspace/game/bin/xtext/game/util/GameSwitch.class differ diff --git a/workspace/game/bin/xtext/generator/.GameGenerator.xtendbin b/workspace/game/bin/xtext/generator/.GameGenerator.xtendbin index 4d0c9e6..1119808 100644 Binary files a/workspace/game/bin/xtext/generator/.GameGenerator.xtendbin and b/workspace/game/bin/xtext/generator/.GameGenerator.xtendbin differ diff --git a/workspace/game/bin/xtext/generator/GameGenerator.class b/workspace/game/bin/xtext/generator/GameGenerator.class index c9c35e4..b946db0 100644 Binary files a/workspace/game/bin/xtext/generator/GameGenerator.class and b/workspace/game/bin/xtext/generator/GameGenerator.class differ diff --git a/workspace/game/bin/xtext/generator/GameGenerator.xtend b/workspace/game/bin/xtext/generator/GameGenerator.xtend deleted file mode 100644 index 8ab531b..0000000 --- a/workspace/game/bin/xtext/generator/GameGenerator.xtend +++ /dev/null @@ -1,25 +0,0 @@ -/* - * generated by Xtext 2.23.0 - */ -package xtext.generator - -import org.eclipse.emf.ecore.resource.Resource -import org.eclipse.xtext.generator.AbstractGenerator -import org.eclipse.xtext.generator.IFileSystemAccess2 -import org.eclipse.xtext.generator.IGeneratorContext - -/** - * Generates code from your model files on save. - * - * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#code-generation - */ -class GameGenerator extends AbstractGenerator { - - override void doGenerate(Resource resource, IFileSystemAccess2 fsa, IGeneratorContext context) { -// fsa.generateFile('greetings.txt', 'People to greet: ' + -// resource.allContents -// .filter(Greeting) -// .map[name] -// .join(', ')) - } -} diff --git a/workspace/game/bin/xtext/parser/antlr/GameAntlrTokenFileProvider.class b/workspace/game/bin/xtext/parser/antlr/GameAntlrTokenFileProvider.class index 740df99..0a1c952 100644 Binary files a/workspace/game/bin/xtext/parser/antlr/GameAntlrTokenFileProvider.class and b/workspace/game/bin/xtext/parser/antlr/GameAntlrTokenFileProvider.class differ diff --git a/workspace/game/bin/xtext/parser/antlr/GameParser.class b/workspace/game/bin/xtext/parser/antlr/GameParser.class index 09e94ca..9b455f4 100644 Binary files a/workspace/game/bin/xtext/parser/antlr/GameParser.class and b/workspace/game/bin/xtext/parser/antlr/GameParser.class differ diff --git a/workspace/game/bin/xtext/parser/antlr/internal/InternalGameLexer$DFA12.class b/workspace/game/bin/xtext/parser/antlr/internal/InternalGameLexer$DFA12.class index 292d7e0..087d08e 100644 Binary files a/workspace/game/bin/xtext/parser/antlr/internal/InternalGameLexer$DFA12.class and b/workspace/game/bin/xtext/parser/antlr/internal/InternalGameLexer$DFA12.class differ diff --git a/workspace/game/bin/xtext/parser/antlr/internal/InternalGameLexer.class b/workspace/game/bin/xtext/parser/antlr/internal/InternalGameLexer.class index 32ac2d9..3a7e0bd 100644 Binary files a/workspace/game/bin/xtext/parser/antlr/internal/InternalGameLexer.class and b/workspace/game/bin/xtext/parser/antlr/internal/InternalGameLexer.class differ diff --git a/workspace/game/bin/xtext/parser/antlr/internal/InternalGameParser.class b/workspace/game/bin/xtext/parser/antlr/internal/InternalGameParser.class index 9c08ba0..1e5ea21 100644 Binary files a/workspace/game/bin/xtext/parser/antlr/internal/InternalGameParser.class and b/workspace/game/bin/xtext/parser/antlr/internal/InternalGameParser.class differ diff --git a/workspace/game/bin/xtext/scoping/AbstractGameScopeProvider.class b/workspace/game/bin/xtext/scoping/AbstractGameScopeProvider.class index af399db..1e8c263 100644 Binary files a/workspace/game/bin/xtext/scoping/AbstractGameScopeProvider.class and b/workspace/game/bin/xtext/scoping/AbstractGameScopeProvider.class differ diff --git a/workspace/game/bin/xtext/scoping/GameScopeProvider.class b/workspace/game/bin/xtext/scoping/GameScopeProvider.class index acaf6eb..12427a2 100644 Binary files a/workspace/game/bin/xtext/scoping/GameScopeProvider.class and b/workspace/game/bin/xtext/scoping/GameScopeProvider.class differ diff --git a/workspace/game/bin/xtext/serializer/GameSemanticSequencer.class b/workspace/game/bin/xtext/serializer/GameSemanticSequencer.class index dceac9a..655f1ed 100644 Binary files a/workspace/game/bin/xtext/serializer/GameSemanticSequencer.class and b/workspace/game/bin/xtext/serializer/GameSemanticSequencer.class differ diff --git a/workspace/game/bin/xtext/serializer/GameSyntacticSequencer.class b/workspace/game/bin/xtext/serializer/GameSyntacticSequencer.class index ccfe568..ea390f2 100644 Binary files a/workspace/game/bin/xtext/serializer/GameSyntacticSequencer.class and b/workspace/game/bin/xtext/serializer/GameSyntacticSequencer.class differ diff --git a/workspace/game/bin/xtext/services/GameGrammarAccess$ActionElements.class b/workspace/game/bin/xtext/services/GameGrammarAccess$ActionElements.class index 6771d99..de3922f 100644 Binary files a/workspace/game/bin/xtext/services/GameGrammarAccess$ActionElements.class and b/workspace/game/bin/xtext/services/GameGrammarAccess$ActionElements.class differ diff --git a/workspace/game/bin/xtext/services/GameGrammarAccess$AntiConditionConnaissanceElements.class b/workspace/game/bin/xtext/services/GameGrammarAccess$AntiConditionConnaissanceElements.class index 1fe2d3f..f1de71a 100644 Binary files a/workspace/game/bin/xtext/services/GameGrammarAccess$AntiConditionConnaissanceElements.class and b/workspace/game/bin/xtext/services/GameGrammarAccess$AntiConditionConnaissanceElements.class differ diff --git a/workspace/game/bin/xtext/services/GameGrammarAccess$CheminElements.class b/workspace/game/bin/xtext/services/GameGrammarAccess$CheminElements.class index 859014f..b95b4d5 100644 Binary files a/workspace/game/bin/xtext/services/GameGrammarAccess$CheminElements.class and b/workspace/game/bin/xtext/services/GameGrammarAccess$CheminElements.class differ diff --git a/workspace/game/bin/xtext/services/GameGrammarAccess$ComparateurElements.class b/workspace/game/bin/xtext/services/GameGrammarAccess$ComparateurElements.class index faac0b2..47dc825 100644 Binary files a/workspace/game/bin/xtext/services/GameGrammarAccess$ComparateurElements.class and b/workspace/game/bin/xtext/services/GameGrammarAccess$ComparateurElements.class differ diff --git a/workspace/game/bin/xtext/services/GameGrammarAccess$ConditionConnaissanceElements.class b/workspace/game/bin/xtext/services/GameGrammarAccess$ConditionConnaissanceElements.class index a483293..dbe4523 100644 Binary files a/workspace/game/bin/xtext/services/GameGrammarAccess$ConditionConnaissanceElements.class and b/workspace/game/bin/xtext/services/GameGrammarAccess$ConditionConnaissanceElements.class differ diff --git a/workspace/game/bin/xtext/services/GameGrammarAccess$ConditionElements.class b/workspace/game/bin/xtext/services/GameGrammarAccess$ConditionElements.class index ea6758f..a4cb6c9 100644 Binary files a/workspace/game/bin/xtext/services/GameGrammarAccess$ConditionElements.class and b/workspace/game/bin/xtext/services/GameGrammarAccess$ConditionElements.class differ diff --git a/workspace/game/bin/xtext/services/GameGrammarAccess$ConditionEtElements.class b/workspace/game/bin/xtext/services/GameGrammarAccess$ConditionEtElements.class index 2cd10a7..00f1fb3 100644 Binary files a/workspace/game/bin/xtext/services/GameGrammarAccess$ConditionEtElements.class and b/workspace/game/bin/xtext/services/GameGrammarAccess$ConditionEtElements.class differ diff --git a/workspace/game/bin/xtext/services/GameGrammarAccess$ConditionObjetElements.class b/workspace/game/bin/xtext/services/GameGrammarAccess$ConditionObjetElements.class index 678215a..94aed1f 100644 Binary files a/workspace/game/bin/xtext/services/GameGrammarAccess$ConditionObjetElements.class and b/workspace/game/bin/xtext/services/GameGrammarAccess$ConditionObjetElements.class differ diff --git a/workspace/game/bin/xtext/services/GameGrammarAccess$ConditionTestElements.class b/workspace/game/bin/xtext/services/GameGrammarAccess$ConditionTestElements.class index 3bbbf0d..81a6e34 100644 Binary files a/workspace/game/bin/xtext/services/GameGrammarAccess$ConditionTestElements.class and b/workspace/game/bin/xtext/services/GameGrammarAccess$ConditionTestElements.class differ diff --git a/workspace/game/bin/xtext/services/GameGrammarAccess$ConnaissanceElements.class b/workspace/game/bin/xtext/services/GameGrammarAccess$ConnaissanceElements.class index 3ff5169..b0ffc8d 100644 Binary files a/workspace/game/bin/xtext/services/GameGrammarAccess$ConnaissanceElements.class and b/workspace/game/bin/xtext/services/GameGrammarAccess$ConnaissanceElements.class differ diff --git a/workspace/game/bin/xtext/services/GameGrammarAccess$DescriptionElements.class b/workspace/game/bin/xtext/services/GameGrammarAccess$DescriptionElements.class index 22dfa15..9636932 100644 Binary files a/workspace/game/bin/xtext/services/GameGrammarAccess$DescriptionElements.class and b/workspace/game/bin/xtext/services/GameGrammarAccess$DescriptionElements.class differ diff --git a/workspace/game/bin/xtext/services/GameGrammarAccess$ExplorateurElements.class b/workspace/game/bin/xtext/services/GameGrammarAccess$ExplorateurElements.class index b627ade..a732eee 100644 Binary files a/workspace/game/bin/xtext/services/GameGrammarAccess$ExplorateurElements.class and b/workspace/game/bin/xtext/services/GameGrammarAccess$ExplorateurElements.class differ diff --git a/workspace/game/bin/xtext/services/GameGrammarAccess$InterractionElements.class b/workspace/game/bin/xtext/services/GameGrammarAccess$InterractionElements.class index 5d66ce4..d9ad700 100644 Binary files a/workspace/game/bin/xtext/services/GameGrammarAccess$InterractionElements.class and b/workspace/game/bin/xtext/services/GameGrammarAccess$InterractionElements.class differ diff --git a/workspace/game/bin/xtext/services/GameGrammarAccess$JeuElements.class b/workspace/game/bin/xtext/services/GameGrammarAccess$JeuElements.class index 20248e3..2defa5f 100644 Binary files a/workspace/game/bin/xtext/services/GameGrammarAccess$JeuElements.class and b/workspace/game/bin/xtext/services/GameGrammarAccess$JeuElements.class differ diff --git a/workspace/game/bin/xtext/services/GameGrammarAccess$LieuElements.class b/workspace/game/bin/xtext/services/GameGrammarAccess$LieuElements.class index a40c53a..3ba1128 100644 Binary files a/workspace/game/bin/xtext/services/GameGrammarAccess$LieuElements.class and b/workspace/game/bin/xtext/services/GameGrammarAccess$LieuElements.class differ diff --git a/workspace/game/bin/xtext/services/GameGrammarAccess$NomElements.class b/workspace/game/bin/xtext/services/GameGrammarAccess$NomElements.class index f56773c..6e6de0f 100644 Binary files a/workspace/game/bin/xtext/services/GameGrammarAccess$NomElements.class and b/workspace/game/bin/xtext/services/GameGrammarAccess$NomElements.class differ diff --git a/workspace/game/bin/xtext/services/GameGrammarAccess$ObjetElements.class b/workspace/game/bin/xtext/services/GameGrammarAccess$ObjetElements.class index 6138d99..3202054 100644 Binary files a/workspace/game/bin/xtext/services/GameGrammarAccess$ObjetElements.class and b/workspace/game/bin/xtext/services/GameGrammarAccess$ObjetElements.class differ diff --git a/workspace/game/bin/xtext/services/GameGrammarAccess$PersonneElements.class b/workspace/game/bin/xtext/services/GameGrammarAccess$PersonneElements.class index 62c3674..b4d6439 100644 Binary files a/workspace/game/bin/xtext/services/GameGrammarAccess$PersonneElements.class and b/workspace/game/bin/xtext/services/GameGrammarAccess$PersonneElements.class differ diff --git a/workspace/game/bin/xtext/services/GameGrammarAccess$TerritoireElements.class b/workspace/game/bin/xtext/services/GameGrammarAccess$TerritoireElements.class index 5c61e9e..0279c76 100644 Binary files a/workspace/game/bin/xtext/services/GameGrammarAccess$TerritoireElements.class and b/workspace/game/bin/xtext/services/GameGrammarAccess$TerritoireElements.class differ diff --git a/workspace/game/bin/xtext/services/GameGrammarAccess$TransformationElements.class b/workspace/game/bin/xtext/services/GameGrammarAccess$TransformationElements.class index c59533b..a38c239 100644 Binary files a/workspace/game/bin/xtext/services/GameGrammarAccess$TransformationElements.class and b/workspace/game/bin/xtext/services/GameGrammarAccess$TransformationElements.class differ diff --git a/workspace/game/bin/xtext/services/GameGrammarAccess.class b/workspace/game/bin/xtext/services/GameGrammarAccess.class index 622d256..d400077 100644 Binary files a/workspace/game/bin/xtext/services/GameGrammarAccess.class and b/workspace/game/bin/xtext/services/GameGrammarAccess.class differ diff --git a/workspace/game/bin/xtext/validation/AbstractGameValidator.class b/workspace/game/bin/xtext/validation/AbstractGameValidator.class index 1e9b1e3..f71a9a5 100644 Binary files a/workspace/game/bin/xtext/validation/AbstractGameValidator.class and b/workspace/game/bin/xtext/validation/AbstractGameValidator.class differ diff --git a/workspace/game/bin/xtext/validation/GameConfigurableIssueCodesProvider.class b/workspace/game/bin/xtext/validation/GameConfigurableIssueCodesProvider.class index f4d0c88..0ddcb2b 100644 Binary files a/workspace/game/bin/xtext/validation/GameConfigurableIssueCodesProvider.class and b/workspace/game/bin/xtext/validation/GameConfigurableIssueCodesProvider.class differ diff --git a/workspace/game/bin/xtext/validation/GameValidator.class b/workspace/game/bin/xtext/validation/GameValidator.class index e8052c6..fe0db24 100644 Binary files a/workspace/game/bin/xtext/validation/GameValidator.class and b/workspace/game/bin/xtext/validation/GameValidator.class differ diff --git a/workspace/game/xtend-gen/xtext/generator/.GameGenerator.xtendbin b/workspace/game/xtend-gen/xtext/generator/.GameGenerator.xtendbin index 4d0c9e6..1119808 100644 Binary files a/workspace/game/xtend-gen/xtext/generator/.GameGenerator.xtendbin and b/workspace/game/xtend-gen/xtext/generator/.GameGenerator.xtendbin differ diff --git a/workspace/game/xtend-gen/xtext/generator/.gitignore b/workspace/game/xtend-gen/xtext/generator/.gitignore new file mode 100644 index 0000000..3674055 --- /dev/null +++ b/workspace/game/xtend-gen/xtext/generator/.gitignore @@ -0,0 +1,3 @@ +/.GameGenerator.java._trace +/.GameGenerator.xtendbin +/GameGenerator.java