Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 351682

Summary: [Tabular Editor] Papyrus should provide an cell editor for Properties typed with a Stereotype
Product: [Modeling] Papyrus Reporter: Vincent Lorenzo <vincent.lorenzo>
Component: CoreAssignee: Vincent Lorenzo <vincent.lorenzo>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
An example of facet declaring using EAnnotation
none
This patch provides emf-facet modification to allow to register specific editor
none
This patch modify the PapyrusNattableWidget to register specific CellEditor none

Description Vincent Lorenzo CLA 2011-07-11 05:27:34 EDT
Papyrus should provide a specific cell editor for properties typed with a Stereotype.
Comment 1 Vincent Lorenzo CLA 2011-07-26 10:07:00 EDT
To do that, we need : 
	- a FacetReference to represent the property typed with a Stereotype
	- A QuerySet to do the set action
	- A query to get the values to display in the table
	- A CellEditor
	
1rst method : 
	- creating a FacetReference typed with Stereotype
	- creating a CellEditor typed with Stereotype
		-> doesn't work, because the GetQuery should return Stereotype and it is false : GetQuery returns Elements stereotyped with the wanted stereotype
		
2nd method : 
	- Creating a FacetReference typed with Element
	- creating a CellEditor typed with Element
		->doesn't work, because the CellEditor hides all other celleditors

3rd method : (see future attachement)
    - hard code for StereotypedElementCellEditor (like EEnumCellEditor)
    - we add an EAnnotation to the FacetReference, this EAnnotation contents the name of the stereotype.
    	-> works fine, but we need to change the emf-facet API (see future attachement), and we override Nattablewidget.class

4th method : 
	- add the possibility to declare a CellEditor on a feature (see bug 352566) to declare CellEditor on some facet
	- not the best solution, because we need to associate this editor to each new FacetReference which represent an object typed with a Stereotype

5th method : 
	- add the possibility to associate a query to a CellEditor. This Query will test the feature (here FacetReference, with its EAnnotation (like in the 3rd method)) to know if the Editor can be chosen to edit the value.
	- need to implements a default behavior, when no query is provided
		-> should work, but we need to change the EMF-Facet API
		-> we need to add a field in the cell editor. This field reference the feature edited by the editor(in order to get the stereotype qualified name)
		
Requirements : 
	- the CellEditor should know which Stereotype is required for the element, in order to filter the elements
	- the CellEditor should not hide the other editors when it is not useful
	- NAryEReferenceCellEditor for stereotyped elements
	- UnaryEReferenceCellEditor for stereotyped elements
	- distinguish FacetReference (or FacetAttribute?) representing element stereotyped from other FacetReference in order to provide the correct editor.
		-> we can't distinguish them using the type of the facet, because the "type" is "stereotypedElement".
		-> I think that we can use the solution proposed in the 3rd method : 
				add an EAnnotation to the FacetReference, with : 
					source = "based_on_Stereotype" (for example)
					details : key = "Stereotype", value = "qualified name of the stereotype"
					this qualified name will be used by the celleditor to find the correct value.
Comment 2 Vincent Lorenzo CLA 2011-07-26 11:37:15 EDT
Created attachment 200372 [details]
An example of facet declaring using EAnnotation

This zip contains a UML profile, and a facet to represent its stereotype. The FacetReference use EAnnotation to precise that it represents a property typed with a Stereotype (like described in method 3).
Comment 3 Vincent Lorenzo CLA 2011-07-26 11:41:37 EDT
Created attachment 200373 [details]
This patch provides emf-facet modification to allow to register specific editor

(1) I, Vincent Lorenzo, wrote 100% of the code I've provided.
(2) This code contains no cryptography
(3) I have the right to contribute the code to Eclipse.
(4) I contribute the content under the EPL.

I think this patch will be not applied in the EMF-Facet project. It is only here to illustrate a solution for this bug.
Comment 4 Vincent Lorenzo CLA 2011-07-26 11:50:24 EDT
Created attachment 200374 [details]
This patch modify the PapyrusNattableWidget to register specific CellEditor
Comment 5 Vincent Lorenzo CLA 2011-07-26 11:52:13 EDT
The 3 attachments allows to modify the existing plugins to register specific CellEditor (like described in the 3rd method). The zip provides a profile and its corresponding facets to test these change on a new Papyrus model (not yet provided).
Comment 6 Vincent Lorenzo CLA 2013-03-13 10:14:26 EDT
This bug can be marked as closed fixed.