Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 324966 - [ElementTypes] Centralized element edit service provide command for model element deletion, creation, modification ...
Summary: [ElementTypes] Centralized element edit service provide command for model ele...
Status: ASSIGNED
Alias: None
Product: Papyrus
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Remi Schnekenburger CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 316754 424305 (view as bug list)
Depends on: 325014 328224 328506 328557 338389 324174 325013 327999 328000 328106 328108 328109 328407 328626 328927 330243 330759 331313 331328 354273 357458 400419
Blocks:
  Show dependency tree
 
Reported: 2010-09-10 09:51 EDT by Yann Tanguy CLA
Modified: 2017-03-07 11:42 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yann Tanguy CLA 2010-09-10 09:51:16 EDT
This task describes the centralized element edit service for Papyrus.

Main objective:
Provide a centralized Papyrus service that can provide various type of command for elements (Create, Delete, Set)

Implementation:

Fully based on GMF ExtensibleType framework which provide anything needed for this purpose. This framework offers the possibility to declare IElementTypes (referring to model metaclasses) in a common registry. These IElementTypes can build various edit command using EditHelper(s). These edit helper can be extended completed, shared between element... 

One problem is that this framework is more or less used (IElementType are declared, but the default EditHelper are modified) by the code generated with GMF tooling. In addition to the fact that the tooling makes lot of duplication in IElementTypes, it also override some edit command which sometimes rely on activated edit part to be created. This leads to different behavior for the same kind of command depending on where they are created (e.g. deleting lifeline may have different result depending if it is executed in the model explorer, the sequence diagram or communication diagram). From a semantic model aspect the behavior should be the same (deleting element differently in diagrams may lead to unpredictable result when the same element are used in several diagrams).

The ExtensibleType framework will be used as the default implementation for Papyrus edit service (though it could perfectly be used without Papyrus). In order to avoid any undesired mix in IElementType declared by Papyrus service or generated by the GMF tooling for Papyrus diagrams, all access to the Edit service in Papyrus will require a shared IClientContext to be explicitely provided and every IElementType, Advices to be bound to this context.

The GMF notation dependant advice is also bound to Papyrus IClientContext. This advice is in charge of the deletion of View (in Notation file) when model element referred by these views are deleted. As the notation file is loaded when the model is open, the deletion of an element with the Edit service should lead to a correct deletion of any representation of this element in any kind of diagram (whether diagrams are opened or not).
Main access to the extensible type framework is wrapped by Papyrus classes that ensure that Papyrus IClientContext is explicitely set in Request. To get an edit command, GMF edit request are used.

The edit helper for UML element can be customized (e.g. Deleting a Lifeline -> delete parts that covers the Lifeline). Not tested but, whereas the edit command should have same behavior on the model, the graphical behavior may requires different behavior depending on the kind of edited diagram, it should be possible to add diagram specific notation related edit action (similar to notation dependent advice).
Comment 1 Yann Tanguy CLA 2010-09-10 14:58:38 EDT
r2670 : org.eclipse.papyrus.service.edit (added to svn) 
r2672 : org.eclipse.papyrus.uml.service.types (added to svn)

r2674 : oep.modelexplorer (delete command based on Edit service added)
r2675 : oep.properties.runtime (modified to use the Element Edit Service)
r2676 : oep.uml.modelexplorer (creation command and handlers for UML)
r2678 : oep.sysml.service.types (types from former oep.sysml.service.creation)
r2680 : oep.sysml.modelexplorer (sysml creation handler moved from former oep.sysml.service.creation)

The following plug-ins are deprecated :
 - org.eclipse.papyrus.service.creation, 
 - org.eclipse.papyrus.uml.service.creation,
 - org.eclipse.papyrus.sysml.service.creation
Comment 2 Yann Tanguy CLA 2010-09-10 15:07:40 EDT
To use the element edit service, get the service associated to an specific element an use the getEditCommand passing in parameter a request depending on the kind of command to retrieve.

Usage example of the element edit service:
- Get destroy element command

			IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
			// Warning : the service may be null is no IElementType matching the selectedEObject is bound to Papyrus IClientContext

			// Retrieve delete command from the Element Edit service
			DestroyElementRequest request = new DestroyElementRequest(selectedEObject, false);
			ICommand deleteCommand = provider.getEditCommand(request);

- Get creation command

		IElementEditService provider = ElementEditServiceUtils.getCommandProvider(container);
		// Warning : the service may be null is no IElementType matching the container is bound to Papyrus IClientContext

		// Retrieve create command from the Element Edit service
		CreateElementRequest createRequest = new CreateElementRequest(container, getElementTypeToCreate());
		ICommand createGMFCommand = provider.getEditCommand(createRequest);
Comment 3 Yann Tanguy CLA 2010-09-10 15:11:34 EDT
r2682 : source formatting.
Comment 4 Yann Tanguy CLA 2010-09-10 15:42:11 EDT
r2684 : Replacement of existing service.creation by the new plug-in listed in previous comment in the build.
Comment 5 Vincent Lorenzo CLA 2010-10-06 11:55:56 EDT
r2900 : 
	In oep.gmfgenExtension : add a child to the Papyrus Extension Root Node : EditPartUsingDeleteService
	This child allows to list the EditPart which use the DeleteService (like in th Papyrus Model Explorer)
	
	In oep.def : LinkItemSemanticEditPolicy, NodeItemSemanticEditPolicy and manifest.xml are modified in order to use the child EditPartUsingDeleteService
	
		With these changes, we can now choose the deleting method for the elements using the gmfgen
Comment 6 Vincent Lorenzo CLA 2010-10-08 04:34:32 EDT
r2911 : 

The goal of this commit is to allow to define which links use the ReorientCommand provided by the Edit Service in the gmfgen.
The plugin oep.gmfgenextension is modified : a new child for Papyrus Root Node Extension is added: EditPartUsingReorientService
In this node, we list the Links using the EditService for the ReorientCommand.

The templates in oep.def are modified to generate code using this new information.
	- manifest.xpt is modified
	- linkCommands.xpt is added
Comment 7 Yann Tanguy CLA 2010-10-17 13:11:30 EDT
r2955 : 

- Generated comment added on getDestroyElementCommand (using EditService)
- linkCommands.xpt fixed (erroneous switch / case generation)
Comment 8 Yann Tanguy CLA 2010-10-20 18:38:01 EDT
r2988 : oep.sysml.service.types

- Matcher added for Block
- Binding pattern corrected

The previous binding pattern included element types defined in the Parametric diagram (their prefix also starts by org.papyrus.sysml.*) which are generated and not supposed to be registered in the Element Edit Service.
The new regular expression used in pattern excludes org.papyrus.sysml.diagram.* element types.
Comment 9 Yann Tanguy CLA 2010-10-21 16:32:59 EDT
The following deprecated plug-ins were removed (in r2993)  :
- org.eclipse.papyrus.service.creation, 
- org.eclipse.papyrus.uml.service.creation,
- org.eclipse.papyrus.sysml.service.creation
Comment 10 Yann Tanguy CLA 2010-10-21 16:36:51 EDT
*** Bug 316754 has been marked as a duplicate of this bug. ***
Comment 11 Yann Tanguy CLA 2010-10-21 17:32:15 EDT
(In reply to comment #8)
> r2988 : oep.sysml.service.types
> 
> - Matcher added for Block
> - Binding pattern corrected
> 
> The previous binding pattern included element types defined in the Parametric
> diagram (their prefix also starts by org.papyrus.sysml.*) which are generated
> and not supposed to be registered in the Element Edit Service.
> The new regular expression used in pattern excludes org.papyrus.sysml.diagram.*
> element types.

Regular expression corrected (in r2994).
Comment 12 Yann Tanguy CLA 2010-10-29 05:11:39 EDT
In r3059:
- The shared context was not passed during getContainedTypeEditServices
Comment 13 Yann Tanguy CLA 2010-12-14 09:44:40 EST
In r3523:
- Regeneration (after r3520 update)
Comment 14 Yann Tanguy CLA 2010-12-14 13:04:18 EST
In r3526: 
- Fix : Model explorer delete command caused an exception in case the selection was null
Comment 15 Yann Tanguy CLA 2010-12-16 12:22:55 EST
In r3573:
- The pattern for UML ElementTypes binding was incorrect (patch from V. Hemery)
Comment 16 Yann Tanguy CLA 2011-02-03 04:27:11 EST
In r3878 (0.8.0M4 Indigo):
- DefaultHeditHelper systematic declaration removed element type declaration from plugin.xml. The metamodel inheritance is used, but still need to be very cautious in case multiple inheritance may lead to incorrect helper (ex: Model -> Package -> TemplateableElement -> Element tested first, the NamedElement Helper would not be used here is an Element Helper is defined).
- Minor change in default names, they start with upper case except for Feature(s).
- Create and Re-orient support for DirectedRelationship
- DirectedRelationship deletion when source or target are deleted
- DirectedRelationship view removed after re-orient (requires diagram regeneration)
- Behavior created in BehavioredClassifier are now added as ownedBehavior (instead of NestedClassifier)
Comment 17 Yann Tanguy CLA 2011-02-03 04:39:07 EST
In r3880:
- in oep.modelexplorer the delete command on multiple selection should now take into account the dependents to be deleted for each item in the selection.
Comment 18 Yann Tanguy CLA 2011-02-03 04:47:45 EST
(In reply to comment #17)
> In r3880:
> - in oep.modelexplorer the delete command on multiple selection should now take
> into account the dependents to be deleted for each item in the selection.

Current "delete from model" implementation when graphical element are selected has not been modified, it still rely on each graphical edit part delete command, which rely on element edit service, but currently the ItemSementicEditPolicy providing this command flush parameters in DestroyElementRequest which does not enable the reuse of this parameters to take previous delete dependents into account.

The same implementation as in model explorer should probably be used here rather than relying in EditPart policy.
Comment 19 Yann Tanguy CLA 2011-02-14 04:22:42 EST
In r4013:
- API extended to retrieve service provider from IElementType (IElementEditServiceProvider#getEditService()).
Comment 20 Yann Tanguy CLA 2011-02-28 05:32:46 EST
In r4093:
- Incorrect declaration of Papyrus service (now use ServiceFactory)

In r4094:
- IElementEditServiceProvider::isKnownElementType() method added to state if an IElementType is declared in Papyrus shared context
- IElementEditServiceProvider::getEditService(Object) with an IElementType used as parameter now returns null if the IElementType is not declared in Papyrus shared context.
Comment 21 Yann Tanguy CLA 2011-04-17 10:10:14 EDT
In 4464 - Default Constraint specification initialization added.

New ValueSpecification in Constraint are now added as constraint specification.
Comment 22 Yann Tanguy CLA 2011-04-18 03:23:17 EDT
In r4473 - NLS support added.
In r4474 - Configure command can now be contributed as request Parameter to easily set an EStructuralFeature on a newly created element.
In r4475 - Activation of Configure command contributed in request parameters in UML service type.
Comment 23 Yann Tanguy CLA 2011-04-18 04:13:04 EDT
In r4478
- Restriction on FlowSpecification Behavioral & StructuralFeatures (can not own Operation or Reception, and only FlowProperty ownedAttributes)
- Restriction on ConstraintBlock Behavioral & StructuralFeatures (can only own Property and ConstraintProperty)
- All property created in the context of a ConstraintBlock are now Composite
Comment 24 Yann Tanguy CLA 2011-04-28 12:51:48 EDT
In r4542 - Support added for binary connectors create and re-orient commands.
Comment 25 Yann Tanguy CLA 2011-05-04 12:15:45 EDT
In r4630 : dependency added in undocumented rev. (r4586 [Palette] Update palette dependencies) removed.
Comment 26 Yann Tanguy CLA 2011-05-19 14:33:07 EDT
In r4733.

- Creation restriction:
	- Port can only be created in an EncapsulatedClassifier
	
- DirectedRelationship creation corrected
- Generalization creation corrected
- ClassCastExceptions fixed in several advices (during before set, the new value type was not tested)

In r4734.
- ClassCastExceptions fixed in several advices (during before set, the new value type was not tested)

In r4735.
- Trace (from Standard will be needed by Requirement Diagram) declaration
- MultiplicityElement declaration (add default [1..1]) declaration
- Dependencies fixed.

In r4736 - 4737.
- Refactor.
- FlowPort and FlowProperty allowed types were incorrect (inverted)
Comment 27 Yann Tanguy CLA 2011-05-20 04:37:32 EDT
In r4738.
- Association support for UML and SysML associations.
Comment 28 Yann Tanguy CLA 2011-05-20 10:46:28 EDT
In r4745.
- Relationship link Creation and Re-orient fixes.
Comment 29 Yann Tanguy CLA 2011-05-20 10:49:48 EDT
(In reply to comment #27)
> In r4738.
> - Association support for UML and SysML associations.

Lots of specific modifications commands related to Association are not implemented yet (move property end, modify the type of a property end...).
Comment 30 Yann Tanguy CLA 2011-11-02 06:58:30 EDT
Reduce restriction for Property creation inside a FlowSpecification:
- must be a FlowProperty OR a sub-specializationType

Done in r6161 (0.8.X).
Comment 31 Yann Tanguy CLA 2011-11-21 04:50:10 EST
(In reply to comment #30)
> Reduce restriction for Property creation inside a FlowSpecification:
> - must be a FlowProperty OR a sub-specializationType
> 
> Done in r6161 (0.8.X).

Merge in trunk r6253.
Comment 32 Yann Tanguy CLA 2012-03-16 12:28:34 EDT
In 7421 (trunk 0.9.0):
- Refactoring to wrap the use of some request parameters
- Default multiplicity fix (should not be explicitely set)
Comment 33 Yann Tanguy CLA 2012-03-16 13:05:45 EDT
In r7424 (trunk 0.9.0):
- Declaration to use ServiceEdit on stereotype application (static impl. SysML, partial on Standard profile)
Comment 34 Florian Noyrit CLA 2017-03-07 11:42:27 EST
*** Bug 424305 has been marked as a duplicate of this bug. ***