Bug 129773 - EMFCoreUtil.destroy() cannot destroy non-contained dependents
Summary: EMFCoreUtil.destroy() cannot destroy non-contained dependents
Status: RESOLVED FIXED
Alias: None
Product: GMF-Runtime
Classification: Modeling
Component: General (show other bugs)
Version: 1.0   Edit
Hardware: PC Linux
: P1 major
Target Milestone: 1.0   Edit
Assignee: Christian Damus CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2006-02-28 08:58 EST by Christian Damus CLA
Modified: 2010-07-19 12:24 EDT (History)
4 users (show)

See Also:


Attachments
New extensible DestroyElementCommand and related changes (50.37 KB, patch)
2006-03-06 22:06 EST, Christian Damus CLA
no flags Details | Diff
Follow-up for destruction of root objects (15.99 KB, patch)
2006-03-09 18:11 EST, Christian Damus CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Damus CLA 2006-02-28 08:58:39 EST
The current implementation of EMFCoreUtil.destroy() recursively destroys contained elements.  However, there can be other elements that have an existence dependency on the element being destroyed but are not contained.  It should be possible for a metamodel provider or a client application to indicate which other dependents should also be destroyed.
Comment 1 Christian Damus CLA 2006-03-06 22:06:45 EST
Created attachment 35805 [details]
New extensible DestroyElementCommand and related changes

The attached patch makes the following changes:

- re-implement DestroyElementCommand to
    1. recursively destroy contained objects (bottom-up)
    2. find the non-contained dependents of the element that
       also need to be destroyed and destroy them (using a new
       DestroyDependentsRequest)
    3. destroy the element
- sweep GMF run-time to replace calls to EMFCoreUtil.destroy(EObject)
    (which does not work) with a new DestroyElementCommand.destroy(EObject)
    utility method
- sweep GMF run-time to replace DESTROY semantic procedures with advice on
    the DestroyDependentsRequest.  This included:
    - NotationSemProc (for view-related semantic procedures)
    - added a TerminalEditHelper to the Logic Example to destroy the wires
      attached to a terminal when a terminal is destroyed (this was missing
      behaviour; deleting gates would leave invisible wires in the semantic
      model)
- re-implement EObjectUtil.destroy(EObject) in the compatibility layer to
    use the DestroyElementCommand
- for compatibility purposes, added advice to fire PRE_DESTROY and DESTROY
    events (MSL specials) before and after object destruction, respectively
- added support for wildcard advice (advice on all element types) to the
    EMF Type API, together with a default metamodel type that matches
    elements having no other type registered for them (required to support 
    the notation view destruction)
Comment 2 Christian Damus CLA 2006-03-06 22:07:23 EST
Patch committed by Linda.
Comment 3 Christian Damus CLA 2006-03-09 18:11:23 EST
Created attachment 36027 [details]
Follow-up for destruction of root objects

This is a follow-up patch to support destruction of resource roots (with two new unit tests).  The DestroyElementRequest now returns the default metamodel type as the edit context for objects that have no container but are attached to a resource (i.e., resource roots).  Detached elements cannot be destroyed.
Comment 4 Christian Damus CLA 2006-03-10 14:37:07 EST
Forgot to mention that the second patch was applied and is included in the 20060310 integration build.
Comment 5 Richard Gronback CLA 2008-08-13 13:07:24 EDT
[target cleanup] 1.0 M6 was the original target milestone for this bug
Comment 6 Eclipse Webmaster CLA 2010-07-19 12:24:13 EDT
[GMF Restructure] Bug 319140 : product GMF and component
Runtime EMF was the original product and component for this bug