Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Redor2017-09-07 16:35:16 +0000
committerLaurent Redor2017-09-11 15:10:34 +0000
commita5ec902ef53717bf1cebe9d4beb9a7f80b4dc783 (patch)
treeaeae3fe2399e915ac2b01f8d5d44c07ae97ad9bd
parent800d5cb892245801ff00f8423e3c248d67c123cd (diff)
downloadorg.eclipse.sirius-a5ec902ef53717bf1cebe9d4beb9a7f80b4dc783.tar.gz
org.eclipse.sirius-a5ec902ef53717bf1cebe9d4beb9a7f80b4dc783.tar.xz
org.eclipse.sirius-a5ec902ef53717bf1cebe9d4beb9a7f80b4dc783.zip
[522007] Activate Show label even if selection contains invalid elements
* Change plugin.xml to make the contextual menu visible if at least one element is OK in the selection. This is the case for diagram selection or for selected elements in the tree of Outline view. * Change the action RevealOutlineLabelsAction to not launch a command for invalid element Bug: 522007 Change-Id: Ib8877d363593ec244d1dea4101d27d2e48dfe252 Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/plugin.xml12
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/actions/visibility/RevealOutlineLabelsAction.java23
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/Release_Notes.html3
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile1
4 files changed, 19 insertions, 20 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.ui/plugin.xml b/plugins/org.eclipse.sirius.diagram.ui/plugin.xml
index a082461f0c..becd9836c2 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/plugin.xml
+++ b/plugins/org.eclipse.sirius.diagram.ui/plugin.xml
@@ -1243,15 +1243,7 @@
checkEnabled="false">
<with
variable="activeMenuSelection">
- <iterate
- operator="and">
- <instanceof
- value="org.eclipse.sirius.diagram.ui.edit.api.part.IDiagramElementEditPart">
- </instanceof>
- <test
- property="org.eclipse.sirius.diagram.ui.isLabelHidden">
- </test>
- </iterate>
+ <reference definitionId="isLabelHidden" />
</with>
</visibleWhen>
</command>
@@ -1742,7 +1734,7 @@
<test property="org.eclipse.sirius.diagram.ui.diagramHasHiddenElements" />
</definition>
<definition id="isLabelHidden">
- <iterate operator="and">
+ <iterate operator="or">
<and>
<reference
definitionId="isInstanceOfIDiagramElementEditPart">
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/actions/visibility/RevealOutlineLabelsAction.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/actions/visibility/RevealOutlineLabelsAction.java
index 2d6793dc90..de91ea7ae4 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/actions/visibility/RevealOutlineLabelsAction.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/actions/visibility/RevealOutlineLabelsAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 THALES GLOBAL SERVICES.
+ * Copyright (c) 2010, 2017 THALES GLOBAL SERVICES.
* 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
@@ -17,6 +17,7 @@ import org.eclipse.emf.transaction.util.TransactionUtil;
import org.eclipse.gef.RootEditPart;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.sirius.diagram.DDiagramElement;
+import org.eclipse.sirius.diagram.business.api.query.DDiagramElementQuery;
import org.eclipse.sirius.diagram.tools.api.command.IDiagramCommandFactory;
import org.eclipse.sirius.diagram.tools.api.command.IDiagramCommandFactoryProvider;
import org.eclipse.sirius.diagram.ui.business.api.provider.AbstractDDiagramElementLabelItemProvider;
@@ -108,18 +109,20 @@ public class RevealOutlineLabelsAction extends AbstractRevealElementsAction<Obje
private void runRevealCommand(final RootEditPart root, final DDiagramEditor editor, final DDiagramElement vpe) {
- final Object adapter = editor.getAdapter(IDiagramCommandFactoryProvider.class);
- final IDiagramCommandFactoryProvider cmdFactoryProvider = (IDiagramCommandFactoryProvider) adapter;
- final TransactionalEditingDomain transactionalEditingDomain = TransactionUtil.getEditingDomain(editor.getEditingDomain().getResourceSet());
- final IDiagramCommandFactory emfCommandFactory = cmdFactoryProvider.getCommandFactory(transactionalEditingDomain);
+ if (vpe != null && new DDiagramElementQuery(vpe).isLabelHidden()) {
+ final Object adapter = editor.getAdapter(IDiagramCommandFactoryProvider.class);
+ final IDiagramCommandFactoryProvider cmdFactoryProvider = (IDiagramCommandFactoryProvider) adapter;
+ final TransactionalEditingDomain transactionalEditingDomain = TransactionUtil.getEditingDomain(editor.getEditingDomain().getResourceSet());
+ final IDiagramCommandFactory emfCommandFactory = cmdFactoryProvider.getCommandFactory(transactionalEditingDomain);
- final Command cmd = emfCommandFactory.buildRevealLabelCommand(vpe);
+ final Command cmd = emfCommandFactory.buildRevealLabelCommand(vpe);
- final TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(vpe);
+ final TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(vpe);
- CompoundCommand allInOne = new CompoundCommand(cmd.getLabel());
- allInOne.append(cmd);
+ CompoundCommand allInOne = new CompoundCommand(cmd.getLabel());
+ allInOne.append(cmd);
- domain.getCommandStack().execute(allInOne);
+ domain.getCommandStack().execute(allInOne);
+ }
}
}
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
index 145a5f33ab..a7a6fbb6a0 100644
--- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
+++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
@@ -149,6 +149,9 @@
<em>Operand</em>, and if necessary the
<em>Combined Fragment</em>, is resized too.
</li>
+ <li><span class="label label-info">Modified</span> In a diagram, the action
+ <em>Show/Hide label</em> is now visible even if the selection contains invalid elements (ie elements without label). The action is applied only on valid elements of the selection.
+ </li>
</ul>
<h3 id="SpecifierVisibleChanges">Specifier-Visible Changes</h3>
<ul>
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
index a8d7fef9a4..b6d2aae95a 100644
--- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
+++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
@@ -22,6 +22,7 @@ h3. User-Visible Changes
!./images/borderNodesWithSnapToGrid.png!
* <span class="label label-info">Modified</span> In a sequence diagram, it is now possible to resize the combined fragment when the first or the last operand is selected (increase the size of the first operand to the top, or increase the size of the last operand to the bottom). Before, it was necessary to select the combined fragment itself to resize it.
* <span class="label label-info">Modified</span> In a sequence diagram, it is now possible to resize an _Execution_ contained in an _Operand_ without previously resize its _Operand_ if more space is needed. The _Operand_, and if necessary the _Combined Fragment_, is resized too.
+* <span class="label label-info">Modified</span> In a diagram, the action _Show/Hide label_ is now visible even if the selection contains invalid elements (ie elements without label). The action is applied only on valid elements of the selection.
h3. Specifier-Visible Changes

Back to the top