diff options
| author | Florian Barbin | 2016-03-30 14:28:23 +0000 |
|---|---|---|
| committer | Laurent Redor | 2016-04-25 16:15:02 +0000 |
| commit | 9f050e77882080dab460821481b549c1117c9d10 (patch) | |
| tree | 88761c8134434415d31f03f313b3f2ce94ff145f | |
| parent | b3953194b7606d240ece76eca8a31e18f0e112e3 (diff) | |
| download | org.eclipse.sirius-9f050e77882080dab460821481b549c1117c9d10.tar.gz org.eclipse.sirius-9f050e77882080dab460821481b549c1117c9d10.tar.xz org.eclipse.sirius-9f050e77882080dab460821481b549c1117c9d10.zip | |
[490444] Creates a specific Sirius CopyAppearancePropertiesAction
* Instead of using the first selected element as base style, this action
uses the last one.
* Updates the release note and the documentation
Bug: 490444
Change-Id: Icb06c4367a0bf4d768b8c4ca2771d6ee92b6be73
Signed-off-by: Florian Barbin <florian.barbin@obeo.fr>
11 files changed, 138 insertions, 6 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.ui/plugin.properties b/plugins/org.eclipse.sirius.diagram.ui/plugin.properties index 3196c836c9..9cfed95dd7 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/plugin.properties +++ b/plugins/org.eclipse.sirius.diagram.ui/plugin.properties @@ -1057,6 +1057,7 @@ SiriusClipboardGlobalActionHandler_pasteCommandLabel = Paste ... SiriusClipboardGlobalActionHandler_severalFoundPasteToolError = There are more than one paste description that match the target container: {1} ({2} and {3}). SiriusContainerDropPolicy_dropElementsCommandLabel = Drop Elements SiriusContainerDropPolicy_saveEditPartLayoutCommandLabel = Save layout for edit part +SiriusCopyAppearancePropertiesAction_tooltipMessage = Apply the applicable appearance properties of the last selected shape to the other selected shapes. SiriusCreationWizardCreationError=Creation Problems SiriusCreationWizardOpenEditorError=Error opening diagram editor SiriusCreationWizardPageExtensionError=File name should have {0} extension. diff --git a/plugins/org.eclipse.sirius.diagram.ui/plugin.xml b/plugins/org.eclipse.sirius.diagram.ui/plugin.xml index d77e871f36..36e05e527d 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/plugin.xml +++ b/plugins/org.eclipse.sirius.diagram.ui/plugin.xml @@ -153,6 +153,12 @@ menubarPath="/diagramMenu/sizeGroup" toolbarPath="/toolbarFormatGroup"> </partAction> + <partAction + global="false" + id="siriusCopyAppearancePropertiesAction" + menubarPath="/diagramMenu/copyAppearanceGroup" + toolbarPath="/toolbarCopyAppearanceGroup"> + </partAction> </partContribution> <popupContribution class="org.eclipse.sirius.diagram.ui.tools.internal.menu.DiagramEditorContextMenuProvider"> @@ -178,6 +184,10 @@ id="makeSameSizeBothAction" path="/formatMenu/sizeGroup"> </popupAction> + <popupAction + id="siriusCopyAppearancePropertiesAction" + path="/formatMenu/applyAppearanceGroup"> + </popupAction> </popupContribution> <popupContribution class="org.eclipse.sirius.diagram.ui.tools.internal.menu.DiagramEditorContextMenuProvider"> @@ -212,6 +222,17 @@ class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContributionItemProvider" checkPluginLoaded="false"> <Priority name="High"/> + + <partContribution + class="org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart"> + <partPredefinedItem + id="copyAppearancePropertiesAction" + menubarPath="/diagramMenu/copyAppearanceGroup" + removeFromMenubar="true" + removeFromToolbar="true" + toolbarPath="/toolbarCopyAppearanceGroup"> + </partPredefinedItem> + </partContribution> <popupContribution class="org.eclipse.sirius.diagram.ui.tools.internal.menu.DiagramEditorContextMenuProvider"> <popupStructuredContributionCriteria @@ -364,6 +385,11 @@ path="/formatMenu/routerMenu/routerGroup" remove="true"> </popupPredefinedItem> + <popupPredefinedItem + id="copyAppearancePropertiesAction" + path="/formatMenu/applyAppearanceGroup" + remove="true"> + </popupPredefinedItem> </popupContribution> </contributionItemProvider> diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/providers/SiriusContributionItemProvider.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/providers/SiriusContributionItemProvider.java index ab26cf5aea..a41645954c 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/providers/SiriusContributionItemProvider.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/providers/SiriusContributionItemProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2007, 2016 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 @@ -19,6 +19,7 @@ import org.eclipse.sirius.diagram.ui.tools.api.ui.actions.ActionIds; import org.eclipse.sirius.diagram.ui.tools.internal.actions.DeselectAllAction; import org.eclipse.sirius.diagram.ui.tools.internal.actions.SaveAsImageFileAction; import org.eclipse.sirius.diagram.ui.tools.internal.actions.SelectHiddenElementsAction; +import org.eclipse.sirius.diagram.ui.tools.internal.actions.SiriusCopyAppearancePropertiesAction; import org.eclipse.sirius.diagram.ui.tools.internal.actions.SizeBothAction; import org.eclipse.sirius.diagram.ui.tools.internal.actions.TabbarRouterAction; import org.eclipse.sirius.diagram.ui.tools.internal.actions.distribute.DistributeAction; @@ -79,6 +80,8 @@ public class SiriusContributionItemProvider extends AbstractContributionItemProv result = DistributeAction.createDistributeCentersVerticallyAction(workbenchPage, false); } else if (org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds.ACTION_MAKE_SAME_SIZE_BOTH.equals(actionId)) { result = new SizeBothAction(workbenchPage); + } else if (actionId.equals(ActionIds.ACTION_SIRIUS_COPY_APPEARANCE_PROPERTIES)) { + return new SiriusCopyAppearancePropertiesAction(workbenchPage); } else { result = super.createAction(actionId, partDescriptor); } diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/ui/actions/ActionIds.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/ui/actions/ActionIds.java index f16ea118cb..7eb06090e8 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/ui/actions/ActionIds.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/ui/actions/ActionIds.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2015 THALES GLOBAL SERVICES and others. + * Copyright (c) 2009, 2016 THALES GLOBAL SERVICES 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 @@ -93,4 +93,9 @@ public interface ActionIds { /** Action's id to distribute vertically with uniform gaps. */ String DISTRIBUTE_GAPS_VERTICALLY = RequestConstants.REQ_DISTRIBUTE + "GapsVertically"; //$NON-NLS-1$ + /** + * Action's id to the custom Sirius Copy Appearance Properties Action. + */ + String ACTION_SIRIUS_COPY_APPEARANCE_PROPERTIES = "siriusCopyAppearancePropertiesAction"; //$NON-NLS-1$ + } diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/actions/SiriusCopyAppearancePropertiesAction.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/actions/SiriusCopyAppearancePropertiesAction.java new file mode 100644 index 0000000000..c365549011 --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/actions/SiriusCopyAppearancePropertiesAction.java @@ -0,0 +1,86 @@ +/****************************************************************************** + * Copyright (c) 2002, 2016 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Obeo - Improvements and bug fixes + ****************************************************************************/ +package org.eclipse.sirius.diagram.ui.tools.internal.actions; + +import java.util.List; + +import org.eclipse.gef.Request; +import org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds; +import org.eclipse.gmf.runtime.diagram.ui.actions.DiagramAction; +import org.eclipse.gmf.runtime.diagram.ui.actions.internal.l10n.DiagramUIActionsMessages; +import org.eclipse.gmf.runtime.diagram.ui.actions.internal.l10n.DiagramUIActionsPluginImages; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.internal.requests.ApplyAppearancePropertiesRequest; +import org.eclipse.sirius.diagram.ui.provider.Messages; +import org.eclipse.ui.IWorkbenchPage; + +/** + * A copy of CopyAppearancePropertiesAction GMF action that uses the last + * selected element as base (instead of the first one) to copy the appearance + * properties. + * + * @author Florian Barbin + * + */ +@SuppressWarnings("restriction") +public class SiriusCopyAppearancePropertiesAction extends DiagramAction { + + /** + * Default constructor. + * + * @param workbenchPage + * the current workbench page. + */ + public SiriusCopyAppearancePropertiesAction(IWorkbenchPage workbenchPage) { + super(workbenchPage); + + setId(ActionIds.ACTION_COPY_APPEARANCE_PROPERTIES); + setText(DiagramUIActionsMessages.CopyAppearancePropertiesAction_text); + setToolTipText(Messages.SiriusCopyAppearancePropertiesAction_tooltipMessage); + + setImageDescriptor(DiagramUIActionsPluginImages.DESC_COPY_APPEARANCE); + setDisabledImageDescriptor(DiagramUIActionsPluginImages.DESC_COPY_APPEARANCE_DISABLED); + setHoverImageDescriptor(DiagramUIActionsPluginImages.DESC_COPY_APPEARANCE); + } + + @Override + protected boolean isSelectionListener() { + return true; + } + + @Override + protected Request createTargetRequest() { + return new ApplyAppearancePropertiesRequest(); + } + + @SuppressWarnings("rawtypes") + @Override + protected void updateTargetRequest() { + ApplyAppearancePropertiesRequest request = (ApplyAppearancePropertiesRequest) getTargetRequest(); + List set = super.createOperationSet(); + if (!set.isEmpty()) { + IGraphicalEditPart editPart = (IGraphicalEditPart) set.get(set.size() - 1); + request.setViewToCopyFrom(editPart.getNotationView()); + } + super.updateTargetRequest(); + } + + @SuppressWarnings("rawtypes") + @Override + protected List createOperationSet() { + List operationSet = super.createOperationSet(); + if (!operationSet.isEmpty()) + operationSet.remove(operationSet.size() - 1); + return operationSet; + } + +} diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/tabbar/contributions/TabbarContributionFactory.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/tabbar/contributions/TabbarContributionFactory.java index 13d1a5c00e..9610b3a9b4 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/tabbar/contributions/TabbarContributionFactory.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/tabbar/contributions/TabbarContributionFactory.java @@ -13,7 +13,6 @@ package org.eclipse.sirius.diagram.ui.tools.internal.editor.tabbar.contributions import org.eclipse.gef.ui.actions.ZoomComboContributionItem; import org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds; import org.eclipse.gmf.runtime.diagram.ui.actions.internal.AutoSizeAction; -import org.eclipse.gmf.runtime.diagram.ui.actions.internal.CopyAppearancePropertiesAction; import org.eclipse.gmf.runtime.diagram.ui.actions.internal.FontDialogAction; import org.eclipse.gmf.runtime.diagram.ui.actions.internal.FontStyleAction; import org.eclipse.gmf.runtime.diagram.ui.internal.l10n.DiagramUIPluginImages; @@ -34,6 +33,7 @@ import org.eclipse.sirius.diagram.ui.tools.api.image.DiagramImagesPath; import org.eclipse.sirius.diagram.ui.tools.internal.actions.SaveAsImageFileAction; import org.eclipse.sirius.diagram.ui.tools.internal.actions.SelectHiddenElementsAction; import org.eclipse.sirius.diagram.ui.tools.internal.actions.SelectPinnedElementsAction; +import org.eclipse.sirius.diagram.ui.tools.internal.actions.SiriusCopyAppearancePropertiesAction; import org.eclipse.sirius.diagram.ui.tools.internal.actions.SizeBothAction; import org.eclipse.sirius.diagram.ui.tools.internal.actions.delete.DeleteFromDiagramAction; import org.eclipse.sirius.diagram.ui.tools.internal.actions.delete.DeleteFromModelWithHookAction; @@ -70,6 +70,7 @@ import org.eclipse.ui.IWorkbenchPartSite; * * @author lfasani */ +@SuppressWarnings("restriction") public class TabbarContributionFactory { private static final String HIDE_ELEMENT_ID = "org.eclipse.sirius.diagram.ui.tabbar.hideelement"; //$NON-NLS-1$ @@ -593,7 +594,7 @@ public class TabbarContributionFactory { public IContributionItem createCopyAppearancePropertiesContribution(IDiagramWorkbenchPart part) { IWorkbenchPartSite site = part.getSite(); if (site != null) { - CopyAppearancePropertiesAction copyAppearancePropertiesAction = new CopyAppearancePropertiesAction(site.getPage()); + SiriusCopyAppearancePropertiesAction copyAppearancePropertiesAction = new SiriusCopyAppearancePropertiesAction(site.getPage()); return new ActionContributionItem(copyAppearancePropertiesAction); } return null; diff --git a/plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/provider/Messages.java b/plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/provider/Messages.java index fe740b9f5f..643ae79d87 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/provider/Messages.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/provider/Messages.java @@ -954,6 +954,9 @@ public final class Messages { public static String SiriusContainerDropPolicy_saveEditPartLayoutCommandLabel; @TranslatableMessage + public static String SiriusCopyAppearancePropertiesAction_tooltipMessage; + + @TranslatableMessage public static String SiriusCreationWizard_DiagramModelFilePageDescription; @TranslatableMessage diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html index 222fadde00..5c7c90127a 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html +++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html @@ -101,6 +101,7 @@ </p> <ul> <li><span class="label label-info">Modified</span> The export of diagram as image handles the gradient color for container background for BMP, JPG, PNG and SVG formats. Before, it only works for JPG format.</li> + <li><span class="label label-info">Modified</span> The “Copy Appearance Properties” action has been modified to use the last selected element as base style instead of the first one.</li> </ul> <h3 id="SpecifierVisibleChanges">Specifier-Visible Changes</h3> <ul> @@ -355,6 +356,10 @@ <code>getGradientPaintLeftToRight(Rectangle, Color, Color)</code> and <code>getGradientPaintTopToBottom(Rectangle, Color, Color)</code>. </li> + <li><span class="label label-success">Added</span> + <code>org.eclipse.sirius.diagram.ui.tools.api.ui.actions.ActionIds.ACTION_SIRIUS_COPY_APPEARANCE_PROPERTIES</code> has been added to identify the new + <em>Sirius Copy Appearence Properties</em> action. + </li> <li><span class="label label-info">Modified</span> <code>org.eclipse.sirius.diagram.ui.tools.api.figure.BundleImageFigure</code> now overrides the method <code>setBorder(Border border)</code>. It also provides the accessors for the new field diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile index 038336e571..825caaf769 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile +++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile @@ -15,6 +15,7 @@ h3. User-Visible Changes * <span class="label label-info">Modified</span> The wizard to ask the new representation name has been changed. These concerns the title of the wizard and the input label. Example with a new Entities diagram for EcoreTools: !images/representationNameWizardChange.png! * <span class="label label-info">Modified</span> The export of diagram as image handles the gradient color for container background for BMP, JPG, PNG and SVG formats. Before, it only works for JPG format. +* <span class="label label-info">Modified</span> The "Copy Appearance Properties" action has been modified to use the last selected element as base style instead of the first one. h3. Specifier-Visible Changes @@ -94,6 +95,7 @@ h4. Changes in @org.eclipse.sirius.diagram.ui@ * <span class="label label-success">Added</span> 2 methods are added in @org.eclipse.sirius.diagram.ui.tools.api.part.DiagramEditPartService@ to manage gradient color in export to PNG or SVG formats: @DiagramEditPartService.saveSVGToFile(IPath, SiriusDiagramSVGGenerator, IProgressMonitor)@ and @org.eclipse.sirius.diagram.ui.tools.api.part.DiagramEditPartService.saveToFile(IPath, SiriusDiagramSVGGenerator, ImageFileFormat, IProgressMonitor)@. These 2 methods are copy of parent methods with @SiriusDiagramSVGGenerator@ as parameter instead of a @DiagramSVGGenerator@. * <span class="label label-success">Added</span> The method @org.eclipse.sirius.ui.tools.api.color.VisualBindingManager.getGradientPaintFromValue(int, int, int, int, Color, Color)@ has been added to handle a cache for @java.awt.GradientPaint@ as it is the case for @org.eclipse.swt.graphics.Pattern@ with @getPatternFromValue()@. * <span class="label label-success">Added</span> Methods have been added in @org.eclipse.sirius.diagram.ui.tools.api.figure.GradientHelper@ to handle @java.awt.GradientPaint@ as @org.eclipse.swt.graphics.Pattern@: @getGradientPaintDiag(Rectangle, Color, Color)@, @getGradientPaintLeftToRight(Rectangle, Color, Color)@ and @getGradientPaintTopToBottom(Rectangle, Color, Color)@. +* <span class="label label-success">Added</span> @org.eclipse.sirius.diagram.ui.tools.api.ui.actions.ActionIds.ACTION_SIRIUS_COPY_APPEARANCE_PROPERTIES@ has been added to identify the new _Sirius Copy Appearence Properties_ action. * <span class="label label-info">Modified</span> @org.eclipse.sirius.diagram.ui.tools.api.figure.BundleImageFigure@ now overrides the method @setBorder(Border border)@. It also provides the accessors for the new field @mainBorderSize@. * <span class="label label-info">Modified</span> @org.eclipse.sirius.diagram.ui.tools.api.figure.BundledImageFigure@ now inherits directly from @SVGFigure@ instead of @AbstractCachedSVGFigure@. * <span class="label label-info">Modified</span> @org.eclipse.sirius.diagram.ui.tools.api.figure.SVGWorkspaceImageFigure@ now inherits directly from @SVGFigure@ instead of @AbstractCachedSVGFigure@. 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 d057e49762..9193856939 100644 --- a/plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.html +++ b/plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.html @@ -1196,7 +1196,7 @@ </p> <p> <img border="0" src="images/tabbar_apply_style.png"/> - <em>Apply Style</em>. Use this button to reproduce the visual style of an element onto others. Select first the element which has the visual style you want, then the others. When you click on this button, all the visual attributes from the first element which can are compatible with the other elements will be applied to them. + <em>Apply Style</em>. Use this button to reproduce the visual style of an element onto others. This action will apply the style of the last selected element to the others. When you click on this button, all the visual attributes from the last element which can are compatible with the other elements will be applied to them. </p> <p> <img border="0" src="images/tabbar_make_same_size.png"/> 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 8fc4e57bca..202d15c555 100644 --- a/plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.textile +++ b/plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.textile @@ -763,7 +763,7 @@ The tab-bar contains a different set of actions when at least one element is sel !images/tabbar_cancel_custom_style.png! _Cancel Custom Style_. As soon as you modify manually any of the graphical properties of an element, the element's style is marked as _customized_, and is not refreshed if its definition changes. The _Cancel Custom Style_ button resets all the style attributes of an element to its default values and un-marks it as customized. -!images/tabbar_apply_style.png! _Apply Style_. Use this button to reproduce the visual style of an element onto others. Select first the element which has the visual style you want, then the others. When you click on this button, all the visual attributes from the first element which can are compatible with the other elements will be applied to them. +!images/tabbar_apply_style.png! _Apply Style_. Use this button to reproduce the visual style of an element onto others. This action will apply the style of the last selected element to the others. When you click on this button, all the visual attributes from the last element which can are compatible with the other elements will be applied to them. !images/tabbar_make_same_size.png! _Make Same Size_. When multiple elements are selected, clicking on this tool will resize all of them to have the same size (both width and height). The element used for reference to decide the size to apply is the last selected. |
