Bug 477211 - Exception when selecting part of a container already selected
Summary: Exception when selecting part of a container already selected
Status: CLOSED FIXED
Alias: None
Product: Sirius
Classification: Modeling
Component: Diagram (show other bugs)
Version: 3.0.0   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 3.1.0   Edit
Assignee: Maxime Porhel CLA
QA Contact: Jessy Mallet CLA
URL:
Whiteboard:
Keywords: triaged
Depends on: 477208
Blocks:
  Show dependency tree
 
Reported: 2015-09-11 10:52 EDT by Pierre-Charles David CLA
Modified: 2015-10-16 09:09 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pierre-Charles David CLA 2015-09-11 10:52:40 EDT
+++ This bug was initially created as a clone of Bug #477208 +++

Steps to reproduce:
1. Open a diagram with two containers with labels.
2. Select both containers using Ctrl-click. One is the primary selection (black handles) and one is not (white handles).
3. Click on the label of the container which is not the primary selection: KO, an exception appears in the error log:

eclipse.buildId=4.5.1.M20150904-0015
java.version=1.7.0_79
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=fr_FR
Framework arguments:  -product org.eclipse.epp.package.modeling.product
Command-line arguments:  -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.modeling.product

org.eclipse.ui
Error
Fri Sep 11 16:49:09 CEST 2015
Unhandled event loop exception

java.lang.IllegalArgumentException: An EditPart has to be selectable (isSelectable() == true) in order to get selected.
	at org.eclipse.core.runtime.Assert.isLegal(Assert.java:63)
	at org.eclipse.gef.editparts.AbstractEditPart.setSelected(AbstractEditPart.java:1060)
	at org.eclipse.gef.SelectionManager.appendSelection(SelectionManager.java:89)
	at org.eclipse.gef.ui.parts.AbstractEditPartViewer.appendSelection(AbstractEditPartViewer.java:190)
	at org.eclipse.gef.ui.parts.AbstractEditPartViewer.select(AbstractEditPartViewer.java:599)
	at org.eclipse.gef.tools.SelectEditPartTracker.performSelection(SelectEditPartTracker.java:221)
	at org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx.performSelection(DragEditPartsTrackerEx.java:247)
	at org.eclipse.gef.tools.SelectEditPartTracker.performConditionalSelection(SelectEditPartTracker.java:167)
	at org.eclipse.gef.tools.SelectEditPartTracker.handleButtonDown(SelectEditPartTracker.java:92)
	at org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx.handleButtonDown(DragEditPartsTrackerEx.java:231)
	at org.eclipse.gef.tools.AbstractTool.mouseDown(AbstractTool.java:1091)
	at org.eclipse.gef.tools.SelectionTool.mouseDown(SelectionTool.java:514)
	at org.eclipse.gef.EditDomain.mouseDown(EditDomain.java:245)
	at org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchMousePressed(DomainEventDispatcher.java:348)
	at org.eclipse.draw2d.LightweightSystem$EventHandler.mouseDown(LightweightSystem.java:523)

If at step 3 you use the mouse to draw a selection rectangle which includes the non-primary selected container's label, the exception appears too, but in addition the selection marquee stays on the diagram and can not be removed except by closing and reopening the diagram.
Comment 1 Maxime Porhel CLA 2015-09-11 11:39:07 EDT
The getParent().isSelectable() == EditPart.SELECTED has been introduce before the move to open source. 

This test is weird, it make the name part selectable only when the main part is in secondary selection (see EditPart.SELECTED vs EditPart.SELECTED_PRIMARY). Furthermore, the container/list/region name parts cannot be moved and the direct edit works. So we can simply always return false in isSelectable().

The IllegalArgumentException occurS because the drag tracker saw the name edit part as a selectable part (its parent is secondary selected) but during the set selection the AbstractEditPartView call primDeselectAll() which change the isSelectable() status of the DDiagramElementContainer name edit parts.
Comment 2 Eclipse Genie CLA 2015-09-11 11:45:30 EDT
New Gerrit change created: https://git.eclipse.org/r/55761
Comment 3 Eclipse Genie CLA 2015-09-14 08:04:08 EDT
New Gerrit change created: https://git.eclipse.org/r/55852
Comment 7 Pierre-Charles David CLA 2015-09-14 10:22:17 EDT
Fixed by af1d22c7376477e55a3dc84e844f7be1ff527026.
Comment 8 Jessy Mallet CLA 2015-09-29 09:41:17 EDT
Validated with Sirius 3.1.0.201509241504
Comment 9 Pierre-Charles David CLA 2015-10-16 09:09:57 EDT
Available in Sirius 3.1.0.