Bug 473944 - Table/Tree editor are not able to resolve their proxy input after reload
Summary: Table/Tree editor are not able to resolve their proxy input after reload
Status: CLOSED FIXED
Alias: None
Product: Sirius
Classification: Modeling
Component: Core (show other bugs)
Version: 2.0.5   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: 3.1.0   Edit
Assignee: Maxime Porhel CLA
QA Contact: Jessy Mallet CLA
URL:
Whiteboard:
Keywords: triaged
Depends on: 473263
Blocks: 473943
  Show dependency tree
 
Reported: 2015-07-30 11:50 EDT by Maxime Porhel CLA
Modified: 2015-10-16 09:10 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maxime Porhel CLA 2015-07-30 11:50:54 EDT
+++ This bug was initially created as a clone of Bug #473263 +++

Steps to reproduce: 
 . Open a DTree/DTable
 . Open the aird a text editor, modify it (add a space) and save
 . The aird is reloaded
 . Set the focus to the DTable/DTree editor
 . Popup "The root element has been deleted, the editor will close." > KO



The main issue seems to be the aird reload with an open Table or Tree editor: our Tree and Table editors are not able to resolve their proxy Viewpoint/Sirius element, see: 
 . AbstractDTableEditor.table
 . DTreeEditor.treeModel
 . DDiagramEditor.setFocus: getDiagramGraphicalViewer().getRootEditPart().getChildren().get(0): DDiagramEditPart.resolveSemanticElement is able to resolve the proxy.

Fast working DRAFT:
> private void checkSemanticAssociation() {
>   if (tableModel != null && tableModel.eIsProxy()) {
>     URI uri = ((InternalEObject) tableModel).eProxyURI();
>     tableModel = (DTable)
session.getTransactionalEditingDomain().getResourceSet().getEObject(uri, false);
>   }
>   if (tableModel == null || tableModel.eResource() == null || tableModel.getTarget() == null || tableModel.getTarget().eResource() == null) {
>  ...


Look for resolve/resolveSemanticeElement methods into GrapicalEditPart/ViewUiil/EMFCoreUtile/Util/EcoreUtil
Comment 1 Eclipse Genie CLA 2015-07-30 12:32:38 EDT
New Gerrit change created: https://git.eclipse.org/r/52882
Comment 2 Eclipse Genie CLA 2015-07-30 12:32:39 EDT
New Gerrit change created: https://git.eclipse.org/r/52881
Comment 3 Maxime Porhel CLA 2015-07-31 09:19:56 EDT
The 52881 review is the cherry-pick of the correction done on 2.x and 3.0.x branches. 

We could improve this correction on master:
 . instead of doing the proxy resolution only in setFocus() for tree and table, we could call it from AbstractDTreeEditorSessionListenerDelegate as it detect the SessionListener.REPLACED event. 
 . we could do the same from DDiagramEditorSessionListenerDelegate, but for diagram, if the aird has been replaced this means to at least detach and re-attach the editor to the ui session to make the DialectEditorClose "resolve" its notification filter key. 
 . We could also update the dialect editor closer mechanism to display only one 'the root element has been deleted, representations will close" popup when there are several  representtion targeting the same semantic element.
Comment 4 Eclipse Genie CLA 2015-08-03 12:37:19 EDT
New Gerrit change created: https://git.eclipse.org/r/53085
Comment 5 Eclipse Genie CLA 2015-08-03 12:37:21 EDT
New Gerrit change created: https://git.eclipse.org/r/53084
Comment 8 Eclipse Genie CLA 2015-08-04 05:27:48 EDT
New Gerrit change created: https://git.eclipse.org/r/53124
Comment 9 Eclipse Genie CLA 2015-08-04 06:11:23 EDT
New Gerrit change created: https://git.eclipse.org/r/53133
Comment 13 Maxime Porhel CLA 2015-08-04 12:08:22 EDT
Corrected on master.
Comment 14 Jessy Mallet CLA 2015-09-29 04:11:30 EDT
Validated with Sirius 3.1.0.201509241504
Comment 15 Pierre-Charles David CLA 2015-10-16 09:10:48 EDT
Available in Sirius 3.1.0.