Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 399285 - [Dawn] GMF editor support assumes that IDawnEditor is a DiagramDocumentEditor
Summary: [Dawn] GMF editor support assumes that IDawnEditor is a DiagramDocumentEditor
Status: CLOSED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.dawn (show other bugs)
Version: 4.1   Edit
Hardware: PC Mac OS X
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: Christian Damus CLA
QA Contact: Eike Stepper CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 290952
  Show dependency tree
 
Reported: 2013-01-28 12:42 EST by Christian Damus CLA
Modified: 2013-06-27 03:27 EDT (History)
1 user (show)

See Also:
martin.fluegge: review+


Attachments
Patch for IDawnEditor adapter support (9.04 KB, patch)
2013-01-28 12:55 EST, Christian Damus CLA
no flags Details | Diff
patch v2 (37.70 KB, patch)
2013-01-28 14:55 EST, Martin Fluegge 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 2013-01-28 12:42:54 EST
Currently, the DawnGMFEditorSupport class makes a critical assumption about the nature of its integration into a GMF-based editor:  that the IDawnEditor implementation is the DiagramDocumentEditor generated by GMF, not some proxy or adapter for it.

This assumes that the editor is the Dawn-generated subclass of the GMF-generated editor, that mixes in the IDawnEditor interface.  For integration of CDO into Papyrus, this is awkward because I am trying not to generate 14 Dawn-specific subclasses of each of the 14 Papyrus diagram editors (not to mention that Papyrus lets end-users generate their own diagram editors, too).  The approach I am taking is to inject the Dawn plumbing into the existing diagram editors using Papyrus's own extensibility mechanisms.

Accordingly, the IDawnEditor that I supply to the DawnGMFEditorSupport is not actually the diagram editor but an adapter that delegates to it.  Thus, I need to be able to customize the way in which the DawnGMFEditorSupport and its cohorts obtain the real diagram editor from the IDawnEditor (currently Dawn assumes that it can cast the IDawnEditor as a DiagramDocumentEditor).
Comment 1 Christian Damus CLA 2013-01-28 12:55:24 EST
Created attachment 226216 [details]
Patch for IDawnEditor adapter support

Attached a patch that implements support for IDawnEditors that are IAdaptable to DiagramDocumentEditor instead of actually instances of the latter.  The DawnGMFEditorSupport provides an API for getting the GMF editor from an IDawnEditor and replaces straight-up casts with this API.

Also, the DawnGMFEditorSupport provides a provides a new hook for subclasses to create custom DawnGMFHandler implementations.  I use this in Papyrus to post edit-part refreshes asynchronously on the display thread, because Papyrus has edit-parts that update GEF/SWT objects when refreshing, requiring the display thread.
Comment 2 Christian Damus CLA 2013-01-28 12:57:28 EST
Requesting code review from Martin, if he has the time (please indicate if not; I will adapt).
Comment 3 Christian Damus CLA 2013-01-28 12:58:33 EST
Adding Martin to cc (it seems that e-mails referenced for review requests are not notified by Bugzilla).
Comment 4 Martin Fluegge CLA 2013-01-28 14:55:23 EST
Created attachment 226224 [details]
patch v2

Hi Christian,

great changes. There is only one small thing to mention. You forgot to update the Manifest.MF exported packages regarding the version increment. I fixed that with patch v2. 

Apart from that: Great work! Thanks for your effort and please go ahead and commit the patch :)
Comment 5 Martin Fluegge CLA 2013-01-28 14:56:23 EST
Btw. I recieved the review request by mail :)
Comment 6 Christian Damus CLA 2013-01-28 15:50:10 EST
(In reply to comment #4)
> 
> great changes. There is only one small thing to mention. You forgot to
> update the Manifest.MF exported packages regarding the version increment. I
> fixed that with patch v2. 

Thanks, Martin!  That's a good point. I would have expected some warning or error from PDE or API Tools ... I'll double-check and if I don't see it flagged, I'll report the issue.

(In reply to comment #5)
> Btw. I recieved the review request by mail :)

OK, good. Thanks for letting me know. Bugzilla didn't mention it as usual when submitting changes to a bug.
Comment 7 Christian Damus CLA 2013-01-28 16:18:49 EST
commit 246e19229f3937236e1062e712a378b292b4f7ab
Comment 8 Eike Stepper CLA 2013-01-29 01:06:16 EST
(In reply to comment #6)
> (In reply to comment #4)
> > 
> > great changes. There is only one small thing to mention. You forgot to
> > update the Manifest.MF exported packages regarding the version increment. I
> > fixed that with patch v2. 
> 
> Thanks, Martin!  That's a good point. I would have expected some warning or
> error from PDE or API Tools ... 

AFAIK. that's nothing the mentioned tools would ever check and that's one of the reasons why CDO committers are expected to install our own versioning tool. Compare http://wiki.eclipse.org/CDO_Source_Installation#Prepare_the_IDE

You'll like it!
Comment 9 Christian Damus CLA 2013-01-29 08:26:48 EST
(In reply to comment #8)
> 
> AFAIK. that's nothing the mentioned tools would ever check and that's one of
> the reasons why CDO committers are expected to install our own versioning
> tool. Compare http://wiki.eclipse.org/CDO_Source_Installation#Prepare_the_IDE
> 
> You'll like it!

Thanks, I do!  I realize now that I was missing it, before.

However, now I see that the release.xml file is has an out-of-date version number for the org.eclipse.emf.cdo.dawn.gmf plug-in in which I just bumped the version number.  But, the version tool didn't complain.

Should I update the release.xml?  Or is that something that you will do closer to release time?
Comment 10 Eike Stepper CLA 2013-01-29 12:26:56 EST
(In reply to comment #9)
> However, now I see that the release.xml file is has an out-of-date version
> number for the org.eclipse.emf.cdo.dawn.gmf plug-in in which I just bumped
> the version number.  But, the version tool didn't complain.
> 
> Should I update the release.xml?  Or is that something that you will do
> closer to release time?

I always regenerate the release.xml directly after a release so that it captures the released versions. Not the to-be-released versions ;-)
Comment 11 Eike Stepper CLA 2013-01-29 12:27:56 EST
The release.xml and release.digest files are similar to an API baseline.
Comment 12 Christian Damus CLA 2013-01-29 12:33:47 EST
(In reply to comment #11)
> The release.xml and release.digest files are similar to an API baseline.

Ah!  Thanks, that explains why it looks woefully out of date.  :-)  Hands off, then.
Comment 13 Eike Stepper CLA 2013-06-27 03:27:23 EDT
Available in R20130213-0014 (4.1.2)