From c4bd7da5e40a44e8adc2bb01d063794bcd7faf41 Mon Sep 17 00:00:00 2001 From: Benoit Maggi Date: Wed, 30 Nov 2016 14:38:52 +0100 Subject: 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 Signed-off-by: Vincent Lorenzo --- .../model/ComponentDiagram.gmfgen | 8 ++++-- .../diagram/component/edit/parts/PortEditPart.java | 2 ++ .../model/compositediagram.gmfgen | 4 +++ .../diagram/composite/edit/parts/PortEditPart.java | 2 ++ .../plugin.xml | 18 ++++++------- .../diagram/menu/actions/ShowHideLabelsAction.java | 30 +++++++++++++--------- 6 files changed, 41 insertions(+), 23 deletions(-) (limited to 'plugins/uml') diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/model/ComponentDiagram.gmfgen b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/model/ComponentDiagram.gmfgen index 28f5829025d..28bb0764afb 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/model/ComponentDiagram.gmfgen +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/model/ComponentDiagram.gmfgen @@ -82,6 +82,10 @@ xsi:type="gmfgen:CustomBehaviour" key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE" editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.component.custom.edit.policies.CustomDiagramDragDropEditPolicy"/> + + figureQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel"> - + + @@ -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"> @@ -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"> @@ -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"> @@ -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"> @@ -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"> @@ -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"> @@ -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"> @@ -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"> 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; * * */ +@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 getConnections() { List connections = new ArrayList(); 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 getInitialSelection() { List selection = new ArrayList(); -- cgit v1.2.3