Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 328109 - [Element Edit Service] Deleting an OccurenceSpecification should delete its related Event
Summary: [Element Edit Service] Deleting an OccurenceSpecification should delete its r...
Status: RESOLVED FIXED
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: Yann Tanguy CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 324966
  Show dependency tree
 
Reported: 2010-10-19 05:39 EDT by Yann Tanguy CLA
Modified: 2010-10-23 11:24 EDT (History)
3 users (show)

See Also:


Attachments
os delete (3.11 KB, patch)
2010-10-22 05:17 EDT, Mathieu Velten CLA
no flags Details | Diff
mylyn/context/zip (1.16 KB, application/octet-stream)
2010-10-22 05:17 EDT, Mathieu Velten CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yann Tanguy CLA 2010-10-19 05:39:50 EDT
An Event (ExecutionEvent SendOperationEvent...) is created during the creation of an OccurenceSpecification.

If the OccurenceSpecification is deleted, its referenced Event becomes meaningless and should be deleted as well. It is not currently the case because these elements are indirectly referenced but not contained by their OccurenceSpecification.
Comment 1 Thibault Landré CLA 2010-10-21 08:20:57 EDT
Now supported in the sequence diagram.

the algo is :
when deleting an occurence specification, delete its associated event if this event is not referenced elsewhere in the model.
Comment 2 Yann Tanguy CLA 2010-10-21 15:09:44 EDT
Thanks Thibault.

In fact the implementation is not exactly what is expected, such action should be provided to the Element Edit Service as it is an action on the model itself. In other words it should provide the same behavior when the delete command is executed from the model explorer, the sequence diagram or any other diagram that would give access to "Delete from model" command on such element. Also the result should not necessarily required diagrams where involved elements appears to be opened (in other words it should provide correct result even if edit part is not activated).

I planned to do this, in case you prefer doing it yourself, no problem but I'd prefer that you provide the patch for validation from me before commit. The reason is that contributing to the edit service is not fully trivial (I tried to provide some description in bug324966) and may result in undesired effect on other diagrams. Currently I was waiting for some info from GMF Runtime team (bug328232) to decide how we should deal with it.

If you are ok with this, I can provide the implementation (your algo is fine) for the Element Edit Service, and you will be able to test it via the "Delete from model" in model explorer before deciding to use the EEService for this in the Sequence diagram. Note that other element deletion that are supposed to delete not contained (directly or indirectly) elements will have to be supported in the EEService as well. You can add tasks under bug324966 for these.
Comment 3 Mathieu Velten CLA 2010-10-22 05:16:32 EDT
sorry it was me for the previous comment, we had some account problems with mylyn when sharing eclipse platform between devs.

anyway, please find attached an attempt to implement this. I didn't add it to the plugin.xml because I don't really know where to put it : if I put it on the OS metatype does this also will apply for subtypes like MOS ?

There is a lot of "elements not contained" to delete in the sequence diagram like associated time constraint, duration etc.
Comment 4 Mathieu Velten CLA 2010-10-22 05:17:19 EDT
Created attachment 181479 [details]
os delete
Comment 5 Mathieu Velten CLA 2010-10-22 05:17:22 EDT
Created attachment 181480 [details]
mylyn/context/zip
Comment 6 Yann Tanguy CLA 2010-10-22 16:35:17 EDT
Thanks Mathieu, I applied your patch with minor changes (in r3007).

By the way, I'm not quite sure where the best place to put dependent element deletion is. If you put it in the EditHelper, then you need to add it to each relevant ElementType (e.g. MOS, not OS), could not find out yet if this is normal.

I found it better to add this command in an EditHelperAdvice, doing this, we can take advantage of the meta-model
by adding the advice directly on OS. The EditHelperAdvice will be used by any element inheriting from OS.
Comment 7 Yann Tanguy CLA 2010-10-22 16:36:33 EDT
Fixed in r3007.
Comment 8 Yann Tanguy CLA 2010-10-23 11:24:57 EDT
In r3008 : Basic refactoring.