Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Redor2014-07-02 08:29:57 +0000
committerLaurent Redor2014-07-04 09:41:54 +0000
commit840ebe0d0e69111d507b174088f0cf0d35145c5b (patch)
treef23766ea7e9729135448f9653c113f6433374e04
parentc092cac5da2f003fc7798e3e3b037642fc2cc121 (diff)
downloadorg.eclipse.sirius-840ebe0d0e69111d507b174088f0cf0d35145c5b.tar.gz
org.eclipse.sirius-840ebe0d0e69111d507b174088f0cf0d35145c5b.tar.xz
org.eclipse.sirius-840ebe0d0e69111d507b174088f0cf0d35145c5b.zip
[438691] Add "touched" mode for selection with rectangle
Currently, you can select several elements by using a selection rectangle. To be selected, an element must be completely contained by the selection rectangle. This commit adds a new mode ("touched" mode), in which to be selected, an element must intersect the selection rectangle. This new mode will be activated when the user selects elements from right to left. The current mode remains when the user selects elements from left to right. Bug: 438691 Change-Id: I3f376bc9b2292cf56835338c8a3ae9a0140bc74d Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/ui/RubberbandSelectionTool.java36
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/Release Notes.html16
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/Release Notes.textile6
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.html9
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.textile5
5 files changed, 61 insertions, 11 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/ui/RubberbandSelectionTool.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/ui/RubberbandSelectionTool.java
index 789e37c810..8324e2c313 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/ui/RubberbandSelectionTool.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/ui/RubberbandSelectionTool.java
@@ -1,5 +1,5 @@
/******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Obeo - Allow ports selection (IBorderItemEditPart)
+ * Obeo - Add "Touched" mode
****************************************************************************/
// CHECKSTYLE:OFF
package org.eclipse.sirius.diagram.ui.tools.internal.ui;
@@ -51,6 +52,11 @@ import org.eclipse.swt.widgets.Display;
* key is pressed at the beginning of the drag, the enclosed items will have
* their selection state inverted.
* <P>
+ * If the selection is made from left to right, the behavior is the one
+ * described previously. But if the selection is made from right to left the
+ * items that intersect the selection rectangle are concerned (and not only
+ * enclosed items).
+ * <P>
* By default, only editparts whose figure's are on the primary layer will be
* considered within the enclosed rectangle.
*
@@ -78,6 +84,18 @@ public class RubberbandSelectionTool extends AbstractTool {
static final int APPEND_MODE = 2;
+ /**
+ * When marquee is made from left to right, it is a standard selection:
+ * select elements wholly inside the marquee selection rectangle
+ */
+ static final int SELECTION_CONTAINED_MODE = 1;
+
+ /**
+ * When marquee is made from right to left, it is an alternative selection:
+ * select elements partially inside the marquee selection rectangle
+ */
+ static final int SELECTION_TOUCHED_MODE = 2;
+
private int mode;
private Figure marqueeRectangleFigure;
@@ -107,6 +125,13 @@ public class RubberbandSelectionTool extends AbstractTool {
List newSelections = new ArrayList();
Iterator children = getAllChildren().iterator();
+ int selectionMode = SELECTION_CONTAINED_MODE;
+ if (feedBackStartLocation != null && feedBackStartLocation.x != getMarqueeBounds().getLeft().x) {
+ // Marquee from right to left (alternative selection: select
+ // elements partially inside the marquee selection rectangle
+ selectionMode = SELECTION_TOUCHED_MODE;
+ }
+
// Calculate new selections based on which children fall
// inside the marquee selection rectangle. Do not select
// children who are not visible
@@ -121,9 +146,12 @@ public class RubberbandSelectionTool extends AbstractTool {
Rectangle marqueeBounds = getMarqueeBounds();
getMarqueeFeedbackFigure().translateToRelative(r);
- if (marqueeBounds.contains(r.getTopLeft()) && marqueeBounds.contains(r.getBottomRight()) && child.getTargetEditPart(MARQUEE_REQUEST) == child) {
- if ((child instanceof IBorderItemEditPart && isBorderFigureVisible(figure)) || isFigureVisible(figure)) {
- newSelections.add(child);
+ if (child.getTargetEditPart(MARQUEE_REQUEST) == child) {
+ if ((selectionMode == SELECTION_CONTAINED_MODE && marqueeBounds.contains(r.getTopLeft()) && marqueeBounds.contains(r.getBottomRight()))
+ || (selectionMode == SELECTION_TOUCHED_MODE && marqueeBounds.intersects(r))) {
+ if ((child instanceof IBorderItemEditPart && isBorderFigureVisible(figure)) || isFigureVisible(figure)) {
+ newSelections.add(child);
+ }
}
}
}
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release Notes.html
index 9dd3a27033..ce854fd10b 100644
--- a/plugins/org.eclipse.sirius.doc/doc/Release Notes.html
+++ b/plugins/org.eclipse.sirius.doc/doc/Release Notes.html
@@ -13,6 +13,9 @@
<a href="#ReleaseNotesforSirius">Release Notes for Sirius</a>
<ol style="list-style: disc;">
<li>
+ <a href="#sirius2.0.0">Changes in Sirius 2.0.0 (from Sirius 1.0.0)</a>
+ </li>
+ <li>
<a href="#sirius1.0.0">Changes in Sirius 1.0.0 (from Sirius 1.0.0M7)</a>
</li>
<li>
@@ -34,9 +37,14 @@
</li>
</ol>
<p>This document contains the release notes for all major releases of Sirius.</p>
- <h2 id="sirius1.0.0">Changes in Sirius 1.0.0 (from Sirius 1.0.0M7)</h2>
+ <h2 id="sirius2.0.0">Changes in Sirius 2.0.0 (from Sirius 1.0.0)</h2>
<h3 id="UserVisibleChanges">User-Visible Changes</h3>
<ul>
+ <li>It is now possible to select element that intersects the selection rectangle and not that is completely contained by the selection rectangle. This new behavior is enabled when user selects elements from right to left. The normal mode (previous mode) remains when the user selects elements from left to right. </li>
+ </ul>
+ <h2 id="sirius1.0.0">Changes in Sirius 1.0.0 (from Sirius 1.0.0M7)</h2>
+ <h3 id="UserVisibleChanges2">User-Visible Changes</h3>
+ <ul>
<li>The ability to print table representations has been disabled for the 1.0.0 release due to an external dependency issue (see
<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=435204">bug #435204</a> for the details).
</li>
@@ -807,7 +815,7 @@ if (rootPackage != null &amp;&amp; rootPackage.getNsURI().equals(DiagramPackage.
</li>
</ul>
<h2 id="sirius1.0M5">Changes in Sirius 1.0.0M5 (from Sirius 1.0M4)</h2>
- <h3 id="UserVisibleChanges2">User-Visible Changes</h3>
+ <h3 id="UserVisibleChanges3">User-Visible Changes</h3>
<ul>
<li>The table csv export has been improved to handle cropped label. In some specific cases, the cell label is automatically cropped and &#8249;...&#8250; is concatenated to the resulting value. This cropped displayed label was previously exported, now the complete semantic value is exported.</li>
</ul>
@@ -935,7 +943,7 @@ if (rootPackage != null &amp;&amp; rootPackage.getNsURI().equals(DiagramPackage.
</li>
</ul>
<h2 id="sirius1.0M4">Changes in Sirius 1.0.0M4 (from Sirius 0.9)</h2>
- <h3 id="UserVisibleChanges3">User-Visible Changes</h3>
+ <h3 id="UserVisibleChanges4">User-Visible Changes</h3>
<ul>
<li>The ability to print table representations, which had been disabled for the 0.9 release, has been re-enabled.</li>
</ul>
@@ -1533,7 +1541,7 @@ void removeSelectedView(DView view);
<em>targetView</em>: the target view of the current edge.
</li>
</ul>
- <h3 id="UserVisibleChanges4">User-Visible Changes</h3>
+ <h3 id="UserVisibleChanges5">User-Visible Changes</h3>
<ul>
<li>The ability to print table representations has been disabled for the 0.9 release due to an external dependency issue (see
<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=422223">bug #422223</a> for the details). It should be re-introduced in 1.0.
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release Notes.textile
index d5f0292e6f..0106649c7f 100644
--- a/plugins/org.eclipse.sirius.doc/doc/Release Notes.textile
+++ b/plugins/org.eclipse.sirius.doc/doc/Release Notes.textile
@@ -4,6 +4,12 @@ h1. Release Notes for Sirius
This document contains the release notes for all major releases of Sirius.
+h2(#sirius2.0.0). Changes in Sirius 2.0.0 (from Sirius 1.0.0)
+
+h3. User-Visible Changes
+
+* It is now possible to select element that intersects the selection rectangle and not that is completely contained by the selection rectangle. This new behavior is enabled when user selects elements from right to left. The normal mode (previous mode) remains when the user selects elements from left to right.
+
h2(#sirius1.0.0). Changes in Sirius 1.0.0 (from Sirius 1.0.0M7)
h3. User-Visible Changes
diff --git a/plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.html b/plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.html
index 35265de895..24e256b2a6 100644
--- a/plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.html
+++ b/plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.html
@@ -669,10 +669,15 @@
</p>
<p>
<i>Selection</i>. The
- <em>selection</em> tool is the default one initially selected when you open a diagram. To select an element on a diagram while this tool is active, simply click on it. To select several elements at the same time, you can either draw a rectangle on the diagram (all the elements completely contained in the rectangle will get selected), or click on each element individually while keeping the
- <em>Ctrl</em> key pressed.When selecting elements which are already selected using this method, by clicking on them or drawing a rectangle around them, they are removed from the selection. You can combine both methods (de/selection by single click or by zone) to build complex selection incrementally by always keeping the
+ <em>selection</em> tool is the default one initially selected when you open a diagram. To select an element on a diagram while this tool is active, simply click on it. To select several elements at the same time, you can either draw a rectangle on the diagram, or click on each element individually while keeping the
+ <em>Ctrl</em> key pressed. When selecting elements which are already selected using this method, by clicking on them or drawing a rectangle around them, they are removed from the selection. You can combine both methods (de/selection by single click or by zone) to build complex selection incrementally by always keeping the
<em>Ctrl</em> key pressed.
+ <br/>The selection of several elements by drawing a rectangle on the diagram has 2 modes:
</p>
+ <ul>
+ <li>Selection from left to right: all the elements completely contained in the rectangle will get selected</li>
+ <li>Selection from right to left: all the elements that intersect the rectangle will get selected</li>
+ </ul>
<p>Selected elements have an outline and anchors drawn on their border. Note that when a selection contains multiple elements, exactly one of them has black selection anchors; the rest have white anchors. The element with the black anchors is called the primary selection, and some tools treat it differently than the others (for example alignment tools).</p>
<p>
<i>Zoom</i>. Next in the palette come two buttons to control the zoom level of the main diagram area. When the
diff --git a/plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.textile b/plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.textile
index 71d8853995..ff066111e4 100644
--- a/plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.textile
+++ b/plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.textile
@@ -429,7 +429,10 @@ A few general tools are available in standard on all Sirius diagrams. They appea
!images/palette_tools.png!
-__Selection__. The _selection_ tool is the default one initially selected when you open a diagram. To select an element on a diagram while this tool is active, simply click on it. To select several elements at the same time, you can either draw a rectangle on the diagram (all the elements completely contained in the rectangle will get selected), or click on each element individually while keeping the _Ctrl_ key pressed.When selecting elements which are already selected using this method, by clicking on them or drawing a rectangle around them, they are removed from the selection. You can combine both methods (de/selection by single click or by zone) to build complex selection incrementally by always keeping the _Ctrl_ key pressed.
+__Selection__. The _selection_ tool is the default one initially selected when you open a diagram. To select an element on a diagram while this tool is active, simply click on it. To select several elements at the same time, you can either draw a rectangle on the diagram, or click on each element individually while keeping the _Ctrl_ key pressed. When selecting elements which are already selected using this method, by clicking on them or drawing a rectangle around them, they are removed from the selection. You can combine both methods (de/selection by single click or by zone) to build complex selection incrementally by always keeping the _Ctrl_ key pressed.
+The selection of several elements by drawing a rectangle on the diagram has 2 modes:
+* Selection from left to right: all the elements completely contained in the rectangle will get selected
+* Selection from right to left: all the elements that intersect the rectangle will get selected
Selected elements have an outline and anchors drawn on their border. Note that when a selection contains multiple elements, exactly one of them has black selection anchors; the rest have white anchors. The element with the black anchors is called the primary selection, and some tools treat it differently than the others (for example alignment tools).

Back to the top