diff options
author | Benoit Maggi | 2016-11-30 13:38:52 +0000 |
---|---|---|
committer | Benoit Maggi | 2017-09-04 09:43:06 +0000 |
commit | c4bd7da5e40a44e8adc2bb01d063794bcd7faf41 (patch) | |
tree | 301144c0544bcbf951459f8b6d8c6a9d1d525c9a /plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu | |
parent | 1d9f6cd454865f0b73aa285e1dd5368096dbeb88 (diff) | |
download | org.eclipse.papyrus-c4bd7da5e40a44e8adc2bb01d063794bcd7faf41.tar.gz org.eclipse.papyrus-c4bd7da5e40a44e8adc2bb01d063794bcd7faf41.tar.xz org.eclipse.papyrus-c4bd7da5e40a44e8adc2bb01d063794bcd7faf41.zip |
Bug 506074 - [Composite structure diagram] Menus All/No/Manage connector
labels available if port is selected in diagram
- re install the policy
- the 3 menus are available
Change-Id: Ib77cb335c8155e1c8da4d5c1cdfb2c94edf7e995
Signed-off-by: Benoit Maggi <benoit.maggi@cea.fr>
Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu')
2 files changed, 27 insertions, 21 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/plugin.xml index 33843ee2b33..f5322b31ed9 100755 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/plugin.xml @@ -680,7 +680,7 @@ commandId="org.eclipse.papyrus.uml.diagram.menu.commands.link.label.show.all" icon="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui.actions/icons/elcl16/showconnector.gif" id="org.eclipse.papyrus.menu.showhide.toolbar.all.connector.label" - label="&All Connector Labels" + label="Show All Labels" style="push" tooltip="Display all labels on the selected connectors"> </command> @@ -688,7 +688,7 @@ commandId="org.eclipse.papyrus.uml.diagram.menu.commands.link.label.hide.all" icon="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui.actions/icons/elcl16/hideconnector.gif" id="org.eclipse.papyrus.menu.showhide.toolbar.no.connector.label" - label="N&o Connector Labels" + label="Hide All Labels" style="push" tooltip="Hide all labels on the selected Connections"> </command> @@ -696,7 +696,7 @@ commandId="org.eclipse.papyrus.uml.diagram.menu.commands.link.label.manager" icon="icons/manage_connector_label.gif" id="org.eclipse.papyrus.menu.showhide.toolbar.manage.connector.label" - label="&Manage Connector Labels" + label="Show/Hide Labels" style="push" tooltip="Manage the labels to display for the selected connections"> </command> @@ -1405,7 +1405,7 @@ commandId="org.eclipse.papyrus.uml.diagram.menu.commands.link.label.show.all" icon="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui.actions/icons/elcl16/showconnector.gif" id="org.eclipse.papyrus.uml.diagram.ui.menu.filtersMenu.all.connector.label" - label="&All Connector Labels" + label="Show All Labels" style="push" tooltip="Display all labels on the selected connectors"> </command> @@ -1413,7 +1413,7 @@ commandId="org.eclipse.papyrus.uml.diagram.menu.commands.link.label.hide.all" icon="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui.actions/icons/elcl16/hideconnector.gif" id="org.eclipse.papyrus.uml.diagram.ui.menu.filtersMenu.no.connector.label" - label="N&o Connector Labels" + label="Hide All Labels" style="push" tooltip="Hide all labels on the selected Connections"> </command> @@ -1421,7 +1421,7 @@ commandId="org.eclipse.papyrus.uml.diagram.menu.commands.link.label.manager" icon="icons/manage_connector_label.gif" id="org.eclipse.papyrus.uml.diagram.ui.menu.filtersMenu.manage.connector.label" - label="&Manage Connector Labels" + label="Show/Hide Labels" style="push" tooltip="Manage the labels to display for the selected connections"> </command> @@ -2162,7 +2162,7 @@ commandId="org.eclipse.papyrus.uml.diagram.menu.commands.link.label.show.all" icon="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui.actions/icons/elcl16/showconnector.gif" id="org.eclipse.papyrus.uml.diagram.ui.popupmenu.filters.all.connector.label" - label="&All Connector Labels" + label="Show All Labels" style="push" tooltip="Display all labels on the selected connectors"> </command> @@ -2170,7 +2170,7 @@ commandId="org.eclipse.papyrus.uml.diagram.menu.commands.link.label.hide.all" icon="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui.actions/icons/elcl16/hideconnector.gif" id="org.eclipse.papyrus.uml.diagram.ui.popupmenu.filters.no.connector.label" - label="N&o Connector Labels" + label="Hide All Labels" style="push" tooltip="Hide all labels on the selected Connections"> </command> @@ -2178,7 +2178,7 @@ commandId="org.eclipse.papyrus.uml.diagram.menu.commands.link.label.manager" icon="icons/manage_connector_label.gif" id="org.eclipse.papyrus.uml.diagram.ui.popupmenu.filters.manage.connector.label" - label="&Manage Connector Labels" + label="Show/Hide Labels" style="push" tooltip="Manage the labels to display for the selected connections"> </command> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/ShowHideLabelsAction.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/ShowHideLabelsAction.java index 2f9adc30aa1..fe489382a19 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/ShowHideLabelsAction.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/ShowHideLabelsAction.java @@ -10,7 +10,8 @@ * Contributors: * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation * Sebastien Gabel (Esterel Technologies) - Fix access to the diagram edit part when called outside of the diagram - * Vincent Lorenzo (CEA LIST) - Bug 520807 + * Vincent Lorenzo (CEA LIST) - Bug 520807, 506074 + * Benoit Maggi (CEA LIST) - Bug 506074 *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.menu.actions; @@ -22,6 +23,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import org.eclipse.emf.ecore.EObject; import org.eclipse.gef.ConnectionEditPart; import org.eclipse.gef.EditPart; import org.eclipse.gef.commands.Command; @@ -64,6 +66,7 @@ import org.eclipse.papyrus.uml.diagram.menu.messages.Messages; * </ul> * */ +@SuppressWarnings("restriction") public class ShowHideLabelsAction extends AbstractGraphicalParametricAction { /** @@ -162,8 +165,9 @@ public class ShowHideLabelsAction extends AbstractGraphicalParametricAction { * Returns the selected connections for the actions * * @return - * the selected connections for the actions + * the selected connections for the actions */ + @SuppressWarnings("unchecked") protected List<ConnectionEditPart> getConnections() { List<ConnectionEditPart> connections = new ArrayList<ConnectionEditPart>(); for (IGraphicalEditPart current : getSelection()) { @@ -266,7 +270,7 @@ public class ShowHideLabelsAction extends AbstractGraphicalParametricAction { * Returns the command for this action * * @return - * the command for this action + * the command for this action */ protected Command getActionCommand() { CompoundCommand cmd = new CompoundCommand("Manage Conection Labels "); //$NON-NLS-1$ @@ -300,14 +304,16 @@ public class ShowHideLabelsAction extends AbstractGraphicalParametricAction { // do nothing } else { ShowHideLabelsRequest request = new ShowHideLabelsRequest(newStatus, view); - // EditPart ep = DiagramEditPartsUtil.getEditPartFromView(view, getConnections().get(0)); - EditPart ep = DiagramEditPartsUtil.getEditPartFromView(view, getSelection().get(0)); - - // EditPart ep = DiagramEditPartsUtil.getEditPartFromView(view, diagramEP); - // Command command = ep.getParent().getCommand(request); - Command command = ep.getParent().getCommand(request); - if (command != null) { - cmd.add(command); + EObject parentView = view.eContainer(); + EditPart parentEditPart = null; + if (parentView instanceof View && ((View)parentView).getElement()==view.getElement()) { + parentEditPart = DiagramEditPartsUtil.getEditPartFromView((View) parentView, getSelection().get(0)); + } + if (null != parentEditPart) { + Command command = parentEditPart.getCommand(request); + if (command != null) { + cmd.add(command); + } } } } @@ -321,7 +327,7 @@ public class ShowHideLabelsAction extends AbstractGraphicalParametricAction { * Returns the initial selection * * @return - * the initial selection : the view that are currently displayed + * the initial selection : the view that are currently displayed */ public List<View> getInitialSelection() { List<View> selection = new ArrayList<View>(); |