Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 361641 - [Dawn] Dawn***CanonicalEditPolicy removes ViewDescriptor in CreateViewRequest when View is missing
Summary: [Dawn] Dawn***CanonicalEditPolicy removes ViewDescriptor in CreateViewRequest...
Status: NEW
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.dawn (show other bugs)
Version: 4.13   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Martin Fluegge CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-21 07:51 EDT by Bjoern Sundin CLA
Modified: 2020-12-11 10:40 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bjoern Sundin CLA 2011-10-21 07:51:45 EDT
Build Identifier: Build id: M20110909-1335

Referring to conversation in newsgroups: http://www.eclipse.org/forums/index.php/m/742541/#msg_742541

I encounter a problem in the generated  Dawn***CanonicalEditPolicy method getCreateViewRequest. 

In order to programmatically create a model AND diagram object (EditPart) I use to create an edit request and pass it into the semantic edit policy (getCommand). Since I started to use Dawn only the model object (semantic) is created while executing the command. The diagram edit part (canonical) is not created anymore. 

Debugging through the code I found that the ViewDescriptor that should be used to create the EditPart is getting removed inside the method getCreateViewRequest of the generated Dawn***CanonicalEditPolicy (see comment inside code):

@Override
protected CreateViewRequest getCreateViewRequest(
        List<ViewDescriptor> descriptors) {
    List<View> viewChildren = getViewChildren();

    List<ViewDescriptor> tbr = new ArrayList<CreateViewRequest.ViewDescriptor>();

    for (ViewDescriptor desc : descriptors) {
        EObject obj = (EObject) ((CanonicalElementAdapter) desc
                .getElementAdapter()).getRealObject();

        boolean found = false;

        for (View view : viewChildren) {
            if (view.getElement().equals(obj)) {
                found = true;
                break;
            }
        }
        if (!found) {
            // Comment: There was no view found for this "real 
            //          object" but why is then the descriptor
            //          added to the tbr list? Shouldn't it be 
            //          the other way around?
            tbr.add(desc);
        }
    }

    descriptors.removeAll(tbr);

    return new CreateViewRequest(descriptors);
}

(Changing 'if (!found)' to 'if (found)' handles the problem in my case)

Reproducible: Always
Comment 1 Eike Stepper CLA 2012-08-14 22:52:18 EDT
Moving all open issues to 4.2. Open bugs can be ported to 4.1 maintenance after they've been fixed in master.
Comment 2 Eike Stepper CLA 2013-06-29 12:18:14 EDT
We'll try to address open problems in 4.3 (master) first and then port fixes back to 4.2.
Comment 3 Eike Stepper CLA 2015-07-14 02:12:15 EDT
Moving all open bugzillas to 4.5.
Comment 4 Eike Stepper CLA 2016-07-31 00:54:48 EDT
Moving all unaddressed bugzillas to 4.6.
Comment 5 Eike Stepper CLA 2017-12-28 01:19:36 EST
Moving all open bugs to 4.7
Comment 6 Eike Stepper CLA 2019-11-08 02:09:02 EST
Moving all unresolved issues to version 4.8-
Comment 7 Eike Stepper CLA 2019-12-13 12:43:52 EST
Moving all unresolved issues to version 4.9
Comment 8 Eike Stepper CLA 2020-12-11 10:40:32 EST
Moving to 4.13.