Bug 426863 - Crosstable editor not selecting right properties context
Summary: Crosstable editor not selecting right properties context
Status: NEW
Alias: None
Product: Sirius
Classification: Modeling
Component: Table (show other bugs)
Version: 1.0.0M5   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2014-01-29 03:59 EST by Wilbert Alberts CLA
Modified: 2014-01-29 05:00 EST (History)
2 users (show)

See Also:


Attachments
Crosstable after selecting Connection (119.67 KB, image/jpeg)
2014-01-29 04:00 EST, Wilbert Alberts CLA
no flags Details
Metamodel (1.23 KB, text/plain)
2014-01-29 04:02 EST, Wilbert Alberts CLA
no flags Details
Viewpoint specification project defining crosstable. (1.30 KB, text/plain)
2014-01-29 04:02 EST, Wilbert Alberts CLA
no flags Details
A reproduction case with a VSM based on Ecore (2.09 KB, application/x-zip-compressed)
2014-01-29 04:49 EST, Maxime Porhel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Wilbert Alberts CLA 2014-01-29 03:59:49 EST
I tried to change the properties of an edge based relation represented in a crosstable cell.

Given the meta model and viewpoint specification model, when selecting a cell from the crosstable, properties of the selected line element are shown instead of the element representing the cell.

When selecting a cell defined by 'Paris' and 'Amsterdam', I expected to be able to change the distance in the properties view. However, it shows the properties of Amsterdam in stead of the corresponding Connection entity.
Comment 1 Wilbert Alberts CLA 2014-01-29 04:00:33 EST
Created attachment 239416 [details]
Crosstable after selecting Connection
Comment 2 Wilbert Alberts CLA 2014-01-29 04:02:09 EST
Created attachment 239418 [details]
Metamodel
Comment 3 Wilbert Alberts CLA 2014-01-29 04:02:40 EST
Created attachment 239419 [details]
Viewpoint specification project defining crosstable.
Comment 4 Wilbert Alberts CLA 2014-01-29 04:04:58 EST
Reported bug based on question in Sirius forum:
http://www.eclipse.org/forums/index.php/mv/msg/641736/1236939/#msg_1236939
Comment 5 Maxime Porhel CLA 2014-01-29 04:44:04 EST
I proposed a workaround in http://www.eclipse.org/forums/index.php/mv/msg/641736/1237276/#msg_1237276 to set this distance value with a direct edit.
Comment 6 Maxime Porhel CLA 2014-01-29 04:49:16 EST
Created attachment 239422 [details]
A reproduction case with a VSM based on Ecore

The new attached reproduction case is based on Ecore. 
It contains a VSM with a Cross Table description on EPackage, line and column mappings on EClass and an IntersectionMapping on EReference.

Steps to reproduce: 
* Unzip the attached 426863.zip project in your workspace/runtime
* Open the 426863.aird and the 426863 cross table.
* Try to display the reference cell property through keyboard navigation or mouse selection/double click
* It always fails and the line properties are shown.
Comment 7 Maxime Porhel CLA 2014-01-29 05:00:58 EST
See org.eclipse.sirius.table.ui.tools.internal.editor.DTableTreeViewer.triggerEditorActivationEvent(ColumnViewerEditorActivationEvent) l:156

It tries to detect the selected cell when the user use left and right keyboard arrows.

We might detect up and down and mouse clic and double clic too: 
boolean keyBoardNav = event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED
                        && (event.keyCode == SWT.ARROW_LEFT || event.keyCode == SWT.ARROW_RIGHT || event.keyCode == SWT.ARROW_DOWN || event.keyCode == SWT.ARROW_UP);

boolean mouseNav = event.eventType == ColumnViewerEditorActivationEvent.MOUSE_CLICK_SELECTION || event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION;

if (mouseNav || keyBoardNav) {
...



See org.eclipse.sirius.table.ui.tools.internal.editor.DTableTreeViewer.updateSelection(ISelection), if the selectedCell is known, fireSelectionChanged is called with the cell in a new StructuredSelection, but the property page is a post listener and so it is not notified. 
We will have another issue with mouse clic/double clic: even if we detect the selected cell and call firePostSelection in updateSelection, the OpenStrategy which detects the selection change will call the firePostSelectionEvent with the initial selection: the line.

We will have to analyze more deeply the selection mecanism to see how we can manage the cell selection in a better way.