Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Dawn] Problem in Dawn***CanonicalEditPolicy getCreateViewRequest
[Dawn] Problem in Dawn***CanonicalEditPolicy getCreateViewRequest [message #742541] Thu, 20 October 2011 15:34 Go to next message
Bjoern Sundin is currently offline Bjoern SundinFriend
Messages: 19
Registered: July 2009
Location: Switzerland
Junior Member
Hallo Martin,

In my project I make some promising tests using GMF and Dawn.

However 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);
}


I am not sure if this is a bug or a feature, but in my case it definitely causes a problem.

Kind regards
Björn
Re: [Dawn] Problem in Dawn***CanonicalEditPolicy getCreateViewRequest [message #743330 is a reply to message #742541] Fri, 21 October 2011 11:04 Go to previous messageGo to next message
Martin Fluegge is currently offline Martin FlueggeFriend
Messages: 141
Registered: July 2009
Senior Member
Hi Björn,

comments inline...

Am 20.10.2011 17:34, schrieb Bjoern Sundin:
> Hallo Martin,
>
> In my project I make some promising tests using GMF and Dawn.

Great! Keep going ;)

> However 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);
> }
>
>

As far as I remember this code was introduced to prevent a doubled
creation of the node element if remote changes are reflected in the
local editor.

> I am not sure if this is a bug or a feature, but in my case it
> definitely causes a problem.

The example editor works fine with this mechanism, but it is not the
most complex one. And there might be a better way to handle this.

Could you please file a bugzilla for this problem?

Cheers,

Martin

> Kind regards
> Björn
Re: [Dawn] Problem in Dawn***CanonicalEditPolicy getCreateViewRequest [message #743370 is a reply to message #743330] Fri, 21 October 2011 11:57 Go to previous messageGo to next message
Bjoern Sundin is currently offline Bjoern SundinFriend
Messages: 19
Registered: July 2009
Location: Switzerland
Junior Member
Hi Martin and thanks for the quick reply,

Yes, I thought there would be a deeper sense with this. I currently only work with one client so I cannot test the case you describe. But as I actually invoke the framework GMF mechanism "outside" of GMF and CDO it might be a yet untested scenario. For me it works if I change 'if (!found)' to 'if (found)'...

Bugzilla filed: https://bugs.eclipse.org/bugs/show_bug.cgi?id=361641

I would need to discuss a problem with the DawnDiagramUpdater too, but it's maybe better to open a new thread for that?

Cheers
Björn
Re: [Dawn] Problem in Dawn***CanonicalEditPolicy getCreateViewRequest [message #743558 is a reply to message #743370] Fri, 21 October 2011 15:20 Go to previous message
Martin Fluegge is currently offline Martin FlueggeFriend
Messages: 141
Registered: July 2009
Senior Member
Am 21.10.2011 13:57, schrieb Bjoern Sundin:
> Hi Martin and thanks for the quick reply,
>
> Yes, I thought there would be a deeper sense with this. I currently only
> work with one client so I cannot test the case you describe. But as I
> actually invoke the framework GMF mechanism "outside" of GMF and CDO it
> might be a yet untested scenario. For me it works if I change 'if
> (!found)' to 'if (found)'...

O.k. I see. Please let me know if working with multiple users will also
work in your case.

> Bugzilla filed: https://bugs.eclipse.org/bugs/show_bug.cgi?id=361641
>

Thanks for filing the bug. ;)

Cheers,

Martin
Previous Topic:CDO Table 'tnt6.cdoresourcenode' doesn't exist
Next Topic:CDO Hibernate Store ID Integer problem
Goto Forum:
  


Current Time: Thu Apr 25 18:49:11 GMT 2024

Powered by FUDForum. Page generated in 0.03879 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top