Bug 147944 - SPACE key causes contents editpart to become selected
Summary: SPACE key causes contents editpart to become selected
Status: RESOLVED FIXED
Alias: None
Product: GEF
Classification: Tools
Component: GEF-Legacy GEF (MVC) (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P2 major (vote)
Target Milestone: 3.2.2 (Callisto SR2)   Edit
Assignee: Alex Boyko CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2006-06-20 16:27 EDT by Randy Hudson CLA
Modified: 2008-09-18 13:26 EDT (History)
1 user (show)

See Also:


Attachments
proposed patch (4.84 KB, patch)
2006-11-16 15:30 EST, Alex Boyko CLA
no flags Details | Diff
proposed patch (1.57 KB, patch)
2006-11-17 14:07 EST, Alex Boyko CLA
no flags Details | Diff
patch (1.52 KB, patch)
2006-11-22 12:43 EST, Alex Boyko CLA
ahunter.eclipse: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Randy Hudson CLA 2006-06-20 16:27:23 EDT
pressing the SPACE key when no parts are selected, causes the contents editpart to become selected. The contents editpart is implicitly selected, but should never be explicitly selected like this.
Comment 1 Randy Hudson CLA 2006-07-11 10:30:33 EDT
This may be a regression due to the SelectionManager added in 3.2, but even if it's not, it's an easy fix most likely.
Comment 2 Anthony Hunter CLA 2006-11-10 10:26:59 EST
Alex will investigate.
Comment 3 Randy Hudson CLA 2006-11-10 10:47:57 EST
I've described the problem, but not the symptoms.  The symptoms are that many normal activities are mysteriously (because the selection is never visually shown) disallowed if the contents are part of selection. For example, you can't delete, you can't drag/move/reparent.  You can't resize, etc. Of course, to see these symptoms you would have to press SPACE, then SHIFT+Select something rather than simple select, which would replace the selection.
Comment 4 Alex Boyko CLA 2006-11-16 15:30:57 EST
Created attachment 54020 [details]
proposed patch

Hi Randy,

It seems that the problem with the "Space" key occurs, because in this case we don't check whether the edit part to be appended to the selection is selectable. GraphicalViewerKeyHandler.processSelect() method doesn't check whether the edit part is selectable and passes the edit part to SelectionManager.appendSelection() method which also doesn't check whether the edit part can be selected. Hence the contents edit part can be selected by pressing "Space" key although it may not be selectable.
There are 2 solutions for this issue:
1) place checking code in GraphicalViewerKeyHandler.processSelect()
2) place checking code in SelectionManager

The patch implements 2). The code for checking whether edit part is selectable is moved from MarqueeSelectionTool to SelectionManager.

Randy, could you please take a look at my reasoning and the attached solution and tell me whether it's acceptable?
Comment 5 Alex Boyko CLA 2006-11-17 10:56:02 EST
There is an exception thrown by the patch code in one of the use cases, so it will be reworked a bit, but I'd like you still to evaluate the idea - the fix plan that I have... is it ok to fix it this way or not...
Comment 6 Alex Boyko CLA 2006-11-17 14:07:02 EST
Created attachment 54086 [details]
proposed patch

Randy, as per our discussion I'm attaching a new patch.
The check for contents edit part is done in GraphicalViewerKeyHandler.processSelect() method.

However, perhaps this check should be done in SelectionManager? In the tree viewer (outline view) GMF logic example user can select the diagram's tree item, hence when it's selected SelectionSynchronyzer calls setSelection() on the GraphicalViewer passing DiagramEditPart as one of the edit parts to select. Since, there is no checking done in setSelection method from the SelectionManager, the content edit part becomes selected explicitly... This is why I'm thinking about moving the check on the SelectionManager. What do you think about it?
Comment 7 Randy Hudson CLA 2006-11-21 11:13:36 EST
The patch looks correct but there is no need to also test for the root editpart. It is valid for the contents part to be the "focus" part. But it is never valid for the root to have focus.
Comment 8 Alex Boyko CLA 2006-11-22 12:43:24 EST
Created attachment 54348 [details]
patch

This is the patch to be committed. (The check for root edit part is removed)
Comment 9 Anthony Hunter CLA 2007-01-09 15:03:40 EST
Committed patch to HEAD and R32_Maintenance.
Also updated the copyright to indicate change in 2007.