diff options
| author | Pierre Guilet | 2018-09-07 08:56:17 +0000 |
|---|---|---|
| committer | Pierre Guilet | 2018-09-17 07:42:51 +0000 |
| commit | 5f1e77d9139b091d8c142e228a6248ecc89af78f (patch) | |
| tree | ce5faa5ea5093dc91054999f2434994a3383d731 | |
| parent | a2565a68df9bd311d91c4d41c49d0ceaa7e8ed09 (diff) | |
| download | org.eclipse.sirius-5f1e77d9139b091d8c142e228a6248ecc89af78f.tar.gz org.eclipse.sirius-5f1e77d9139b091d8c142e228a6248ecc89af78f.tar.xz org.eclipse.sirius-5f1e77d9139b091d8c142e228a6248ecc89af78f.zip | |
[527109] Change edit mode dropdown menu style to checkbox
* Remove bad label used when clicking on layouting mode
* Replace show/hide mode by visibility mode in documentation
* Change tabbar dropdown button tooltip to "Change Diagram edition mode"
* Remove hide action on invisible elements
* Edit mode update is no more done on a command stack
Bug: 527109
Change-Id: I12e01578a2f185ed264806dec2fb43e2c5a8c2c0
Signed-off-by: Pierre Guilet <pierre.guilet@obeo.fr>
17 files changed, 356 insertions, 477 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.ui/plugin.properties b/plugins/org.eclipse.sirius.diagram.ui/plugin.properties index 1ff026cfb2..8e040245e4 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/plugin.properties +++ b/plugins/org.eclipse.sirius.diagram.ui/plugin.properties @@ -794,6 +794,8 @@ BracketBendpointEditPolicy_rotateBracketCommandLabel = Rotate bracket connection BundledImageEditPart_notBundleImageMsg = The element is not a BundledImage BundledImageShape_attributeAbsent = The org.eclipse.sirius.diagram.bundledImageShape extension of id ''{0}'' should have the {1} attribute with a value. CenterEditPartEdgesCommand_label = Center Edges +ChangeEditModeAction_ChangePropertyValueRequest_label=Change edit mode +ChangeEditModeAction_ChangeFailure=Edit mode could not be changed. ChangeBendpointsOfEdgesCommand_label = Adapt bendpoints of edges ChangeBendpointsOfEdgesCommand_mapGmfAnchorToDraw2dAnchorCommandLabel = Map GMF anchor to Draw2D anchor ChangeBendpointsOfEdgesCommand_mapGmfPointsToDraw2dPoints = Map GMF points to Draw2D points @@ -855,6 +857,7 @@ DefaultTabbarContributorProvider_contributionError = Cannot instantiate the ITab DefaultTabbarContributorProvider_contributionError_withId = Cannot instantiate the ITabbarContributor contribution in {0} extension DefaultModeAction_statusOn=Standard Mode DefaultModeAction_Label=Standard Mode +EditModeAction_Label=Change Diagram edition mode DeleteRelatedNoteAttachmentsTask_label = Delete Related GMF note attachments DeleteRelatedNotesTask_label = Delete Related GMF notes DeselectAllAction_label = Deselect All diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/editor/tabbar/AbstractTabbarContributor.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/editor/tabbar/AbstractTabbarContributor.java index 458c613a14..acfd6db12c 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/editor/tabbar/AbstractTabbarContributor.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/editor/tabbar/AbstractTabbarContributor.java @@ -13,12 +13,12 @@ package org.eclipse.sirius.diagram.ui.tools.api.editor.tabbar; import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart; import org.eclipse.jface.action.IContributionItem; import org.eclipse.jface.action.ToolBarManager; +import org.eclipse.sirius.diagram.DDiagram; import org.eclipse.sirius.diagram.ui.tools.internal.editor.tabbar.contributions.TabbarContributionFactory; /** - * Abstract implementation of {@link ITabbarContributor}. Inherit from this - * class allows creating one or several contribution items of the default Sirius - * tabbar. + * Abstract implementation of {@link ITabbarContributor}. Inherit from this class allows creating one or several + * contribution items of the default Sirius tabbar. * * @author Florian Barbin * @@ -28,9 +28,8 @@ public abstract class AbstractTabbarContributor implements ITabbarContributor { private TabbarContributionFactory contributorFactory = new TabbarContributionFactory(); /** - * Creates the Automatic Layout contribution item. Organized in a drop-down - * menu, this item is used to trigger an automatic layout of the elements on - * the diagram. + * Creates the Automatic Layout contribution item. Organized in a drop-down menu, this item is used to trigger an + * automatic layout of the elements on the diagram. * * @param part * the current IDiagramWorkbenchPart. @@ -51,9 +50,8 @@ public abstract class AbstractTabbarContributor implements ITabbarContributor { } /** - * Creates the Alignment contribution item. This menu contains several - * operations which can be used to align several graphical elements in - * various ways. + * Creates the Alignment contribution item. This menu contains several operations which can be used to align several + * graphical elements in various ways. * * @return the {@link IContributionItem}. */ @@ -104,16 +102,14 @@ public abstract class AbstractTabbarContributor implements ITabbarContributor { * * @param part * the current IDiagramWorkbenchPart. - * @return the {@link IContributionItem} or null if the workbench part is - * being initialized. + * @return the {@link IContributionItem} or null if the workbench part is being initialized. */ protected IContributionItem createSelectHiddenElementsContribution(IDiagramWorkbenchPart part) { return contributorFactory.createSelectHiddenElementsContribution(part); } /** - * Creates the Hide Element contribution item. This button hides all the - * selected elements from view. + * Creates the Hide Element contribution item. This button hides all the selected elements from view. * * @param part * the current IDiagramWorkbenchPart. @@ -124,8 +120,7 @@ public abstract class AbstractTabbarContributor implements ITabbarContributor { } /** - * Creates the Hide Element Label contribution item. This button hides the - * label of the selected elements. + * Creates the Hide Element Label contribution item. This button hides the label of the selected elements. * * @param part * the current IDiagramWorkbenchPart. @@ -136,9 +131,8 @@ public abstract class AbstractTabbarContributor implements ITabbarContributor { } /** - * Creates the Delete From Diagram contribution item. This action removes - * the selected graphical element from the diagram, but does not delete the - * corresponding semantic elements. + * Creates the Delete From Diagram contribution item. This action removes the selected graphical element from the + * diagram, but does not delete the corresponding semantic elements. * * @param part * the current IDiagramWorkbenchPart. @@ -149,13 +143,12 @@ public abstract class AbstractTabbarContributor implements ITabbarContributor { } /** - * Creates the Delete From Model contribution item. This action removes both - * the selected graphical element and the corresponding semantic elements. + * Creates the Delete From Model contribution item. This action removes both the selected graphical element and the + * corresponding semantic elements. * * @param part * the current IDiagramWorkbenchPart. - * @return the {@link IContributionItem} or null if the workbench part is - * being initialized. + * @return the {@link IContributionItem} or null if the workbench part is being initialized. */ protected IContributionItem createDeleteFromModelContribution(IDiagramWorkbenchPart part) { return contributorFactory.createDeleteFromModelContribution(part); @@ -166,16 +159,14 @@ public abstract class AbstractTabbarContributor implements ITabbarContributor { * * @param part * the current IDiagramWorkbenchPart. - * @return the {@link IContributionItem} or null if the workbench part is - * being initialized. + * @return the {@link IContributionItem} or null if the workbench part is being initialized. */ protected IContributionItem createSelectPinnedElementsContribution(IDiagramWorkbenchPart part) { return contributorFactory.createSelectPinnedElementsContribution(part); } /** - * Creates the Pin element contribution item. Mark all the selected elements - * as pinned. + * Creates the Pin element contribution item. Mark all the selected elements as pinned. * * @param part * the current IDiagramWorkbenchPart. @@ -186,8 +177,7 @@ public abstract class AbstractTabbarContributor implements ITabbarContributor { } /** - * Creates the Unpin element contribution item. Mark all the selected - * elements as un-pinned. + * Creates the Unpin element contribution item. Mark all the selected elements as un-pinned. * * @param part * the current IDiagramWorkbenchPart. @@ -204,8 +194,7 @@ public abstract class AbstractTabbarContributor implements ITabbarContributor { * * @param part * the current IDiagramWorkbenchPart. - * @return the {@link IContributionItem} or null if the workbench part is - * being initialized. + * @return the {@link IContributionItem} or null if the workbench part is being initialized. */ protected IContributionItem createZoomContribution(IDiagramWorkbenchPart part) { return contributorFactory.createZoomContribution(part); @@ -216,8 +205,7 @@ public abstract class AbstractTabbarContributor implements ITabbarContributor { * * @param part * the current IDiagramWorkbenchPart. - * @return the {@link IContributionItem} or null if the workbench part is - * being initialized. + * @return the {@link IContributionItem} or null if the workbench part is being initialized. */ protected IContributionItem createZoomInContribution(IDiagramWorkbenchPart part) { return contributorFactory.createZoomInContribution(part); @@ -228,8 +216,7 @@ public abstract class AbstractTabbarContributor implements ITabbarContributor { * * @param part * the current IDiagramWorkbenchPart. - * @return the {@link IContributionItem} or null if the workbench part is - * being initialized. + * @return the {@link IContributionItem} or null if the workbench part is being initialized. */ protected IContributionItem createZoomOutContribution(IDiagramWorkbenchPart part) { return contributorFactory.createZoomOutContribution(part); @@ -240,8 +227,7 @@ public abstract class AbstractTabbarContributor implements ITabbarContributor { * * @param part * the current IDiagramWorkbenchPart. - * @return the {@link IContributionItem} or null if the workbench part is - * being initialized. + * @return the {@link IContributionItem} or null if the workbench part is being initialized. */ protected IContributionItem createFontColorContribution(IDiagramWorkbenchPart part) { return contributorFactory.createFontColorContribution(part); @@ -252,8 +238,7 @@ public abstract class AbstractTabbarContributor implements ITabbarContributor { * * @param part * the current IDiagramWorkbenchPart. - * @return the {@link IContributionItem} or null if the workbench part is - * being initialized. + * @return the {@link IContributionItem} or null if the workbench part is being initialized. */ protected IContributionItem createBoldFontStyleContribution(IDiagramWorkbenchPart part) { return contributorFactory.createBoldFontStyleContribution(part); @@ -264,8 +249,7 @@ public abstract class AbstractTabbarContributor implements ITabbarContributor { * * @param part * the current IDiagramWorkbenchPart. - * @return the {@link IContributionItem} or null if the workbench part is - * being initialized. + * @return the {@link IContributionItem} or null if the workbench part is being initialized. */ protected IContributionItem createItalicFontStyleContribution(IDiagramWorkbenchPart part) { return contributorFactory.createItalicFontStyleContribution(part); @@ -276,8 +260,7 @@ public abstract class AbstractTabbarContributor implements ITabbarContributor { * * @param part * the current IDiagramWorkbenchPart. - * @return the {@link IContributionItem} or null if the workbench part is - * being initialized. + * @return the {@link IContributionItem} or null if the workbench part is being initialized. */ protected IContributionItem createFontDialogContribution(IDiagramWorkbenchPart part) { return contributorFactory.createFontDialogContribution(part); @@ -288,8 +271,7 @@ public abstract class AbstractTabbarContributor implements ITabbarContributor { * * @param part * the current IDiagramWorkbenchPart. - * @return the {@link IContributionItem} or null if the workbench part is - * being initialized. + * @return the {@link IContributionItem} or null if the workbench part is being initialized. */ protected IContributionItem createFillColorContribution(IDiagramWorkbenchPart part) { return contributorFactory.createFillColorContribution(part); @@ -300,32 +282,27 @@ public abstract class AbstractTabbarContributor implements ITabbarContributor { * * @param part * the current IDiagramWorkbenchPart. - * @return the {@link IContributionItem} or null if the workbench part is - * being initialized. + * @return the {@link IContributionItem} or null if the workbench part is being initialized. */ protected IContributionItem createLineColorPropertyContribution(IDiagramWorkbenchPart part) { return contributorFactory.createLineColorPropertyContribution(part); } /** - * Creates the Cancel Custom Style contribution item. The Cancel Custom - * Style button resets all the style attributes of an element to its default - * values and un-marks it as customized. + * Creates the Cancel Custom Style contribution item. The Cancel Custom Style button resets all the style attributes + * of an element to its default values and un-marks it as customized. * * @param part * the current IDiagramWorkbenchPart. - * @return the {@link IContributionItem} or null if the workbench part is - * being initialized. + * @return the {@link IContributionItem} or null if the workbench part is being initialized. */ protected IContributionItem createResetStylePropertyContribution(IDiagramWorkbenchPart part) { return contributorFactory.createResetStylePropertyContribution(part); } /** - * Creates the set style to workspace image contribution item. The Workspace - * image button can be used to replace the graphical representation of an - * element by an image that you can select from anywhere in your Eclipse - * workspace. + * Creates the set style to workspace image contribution item. The Workspace image button can be used to replace the + * graphical representation of an element by an image that you can select from anywhere in your Eclipse workspace. * * @param part * the current IDiagramWorkbenchPart. @@ -336,10 +313,8 @@ public abstract class AbstractTabbarContributor implements ITabbarContributor { } /** - * Creates the Distribute menu contribution item. This menu contains several - * actions which can be used to distribute the selected diagram elements - * horizontally/vertically with a same space between their centers or their - * bounds. + * Creates the Distribute menu contribution item. This menu contains several actions which can be used to distribute + * the selected diagram elements horizontally/vertically with a same space between their centers or their bounds. * * @return the {@link IContributionItem}. */ @@ -348,8 +323,8 @@ public abstract class AbstractTabbarContributor implements ITabbarContributor { } /** - * Creates the Export As Image contribution item.This button can be used to - * export the current diagram as an image file stored on disk. + * Creates the Export As Image contribution item.This button can be used to export the current diagram as an image + * file stored on disk. * * @return the {@link IContributionItem}. */ @@ -358,23 +333,27 @@ public abstract class AbstractTabbarContributor implements ITabbarContributor { } /** - * Creates the Layout Mode contribution item. This button enables a special - * "layout mode", in which some operations are prevented from having an - * effect on the semantic model. + * Creates the Mode Menu Manager contribution item. This drop down menu contains three actions: + * <ul> + * <li>Standard mode: Deactivate the layouting and visibility mode if they are activated.</li> + * <li>Visibility mode: this action shows diagram elements made invisible by user and allows to change the + * visibility status with double click on diagram elements.</li> + * <li>Layouting Mode: This button enables a special "layout mode", in which some operations are prevented from + * having an effect on the semantic model.</li> + * </ul> * * @param part * the current IDiagramWorkbenchPart. - * @return the {@link IContributionItem} or null if the workbench part is - * being initialized or if the diagram doesn't allow the layouting - * mode. + * @return the {@link IContributionItem} or null if the workbench part is being initialized or if the diagram + * doesn't allow the layouting mode. */ - protected IContributionItem createLayoutingModeContributionItem(IDiagramWorkbenchPart part) { - return contributorFactory.createLayoutingModeContributionItem(part); + protected IContributionItem createModeMenuManagerContributionItem(IDiagramWorkbenchPart part) { + return contributorFactory.createModesMenuManager((DDiagram) part.getDiagram().getElement()); } /** - * Creates the Router contribution item. This action allows changing the - * line style of edges (Rectilinear, Oblique, Tree) + * Creates the Router contribution item. This action allows changing the line style of edges (Rectilinear, Oblique, + * Tree) * * @return the {@link IContributionItem}. */ @@ -383,30 +362,25 @@ public abstract class AbstractTabbarContributor implements ITabbarContributor { } /** - * Creates the Apply Style contribution item. Use this button to reproduce - * the visual style of an element onto others. + * Creates the Apply Style contribution item. Use this button to reproduce the visual style of an element onto + * others. * * @param part * the current IDiagramWorkbenchPart. - * @return the {@link IContributionItem} or null if the workbench part is - * being initialized. + * @return the {@link IContributionItem} or null if the workbench part is being initialized. */ protected IContributionItem createCopyAppearancePropertiesContribution(IDiagramWorkbenchPart part) { return contributorFactory.createCopyAppearancePropertiesContribution(part); } /** - * Creates the copy format contribution item. This tool can be used to - * duplicate the format of some diagram elements from this diagram into - * another. + * Creates the copy format contribution item. This tool can be used to duplicate the format of some diagram elements + * from this diagram into another. * * @param part * the current IDiagramWorkbenchPart. - * @return the {@link IContributionItem} or null if the workbench part is - * being initialized. - * @deprecated since 4.1.0 Use - * {@link #createCopyFormatContribution(IDiagramWorkbenchPart)} - * instead. + * @return the {@link IContributionItem} or null if the workbench part is being initialized. + * @deprecated since 4.1.0 Use {@link #createCopyFormatContribution(IDiagramWorkbenchPart)} instead. */ @Deprecated protected IContributionItem createCopyLayoutContribution(IDiagramWorkbenchPart part) { @@ -414,14 +388,12 @@ public abstract class AbstractTabbarContributor implements ITabbarContributor { } /** - * Creates the copy format contribution item. This tool can be used to - * duplicate the format of some diagram elements from this diagram into - * another. + * Creates the copy format contribution item. This tool can be used to duplicate the format of some diagram elements + * from this diagram into another. * * @param part * the current IDiagramWorkbenchPart. - * @return the {@link IContributionItem} or null if the workbench part is - * being initialized. + * @return the {@link IContributionItem} or null if the workbench part is being initialized. */ protected IContributionItem createCopyFormatContribution(IDiagramWorkbenchPart part) { return contributorFactory.createCopyFormatContribution(part); @@ -432,11 +404,8 @@ public abstract class AbstractTabbarContributor implements ITabbarContributor { * * @param part * the current IDiagramWorkbenchPart. - * @return the {@link IContributionItem} or null if the workbench part is - * being initialized. - * @deprecated since 4.1.0 Use - * {@link #createPasteFormatContribution(IDiagramWorkbenchPart)} - * instead. + * @return the {@link IContributionItem} or null if the workbench part is being initialized. + * @deprecated since 4.1.0 Use {@link #createPasteFormatContribution(IDiagramWorkbenchPart)} instead. */ @Deprecated protected IContributionItem createPasteLayoutContribution(IDiagramWorkbenchPart part) { @@ -448,17 +417,15 @@ public abstract class AbstractTabbarContributor implements ITabbarContributor { * * @param part * the current IDiagramWorkbenchPart. - * @return the {@link IContributionItem} or null if the workbench part is - * being initialized. + * @return the {@link IContributionItem} or null if the workbench part is being initialized. */ protected IContributionItem createPasteFormatContribution(IDiagramWorkbenchPart part) { return contributorFactory.createPasteFormatContribution(part); } /** - * Creates the Refresh action contribution item. This operation, which can - * also be invoked with the F5 keyboard shortcut, will force an update of - * the diagram's content according to the latest version of the underlying + * Creates the Refresh action contribution item. This operation, which can also be invoked with the F5 keyboard + * shortcut, will force an update of the diagram's content according to the latest version of the underlying * semantic model. * * @return the {@link IContributionItem}. @@ -468,27 +435,23 @@ public abstract class AbstractTabbarContributor implements ITabbarContributor { } /** - * Creates the Make Same Size contribution item. When multiple elements are - * selected, clicking on this tool will resize all of them to have the same - * size (both width and height). + * Creates the Make Same Size contribution item. When multiple elements are selected, clicking on this tool will + * resize all of them to have the same size (both width and height). * * @param part * the current IDiagramWorkbenchPart. - * @return the {@link IContributionItem} or null if the workbench part is - * being initialized. + * @return the {@link IContributionItem} or null if the workbench part is being initialized. */ protected IContributionItem createSizeBothContribution(IDiagramWorkbenchPart part) { return contributorFactory.createSizeBothContribution(part); } /** - * Creates the Auto-Size contribution item. This button marks the selected - * elements as auto-sized. + * Creates the Auto-Size contribution item. This button marks the selected elements as auto-sized. * * @param part * the current IDiagramWorkbenchPart. - * @return the {@link IContributionItem} or null if the workbench part is - * being initialized. + * @return the {@link IContributionItem} or null if the workbench part is being initialized. */ protected IContributionItem createAutoSizeContribution(IDiagramWorkbenchPart part) { return contributorFactory.createAutoSizeContribution(part); diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/tabbar/LayoutingModeSwitchingAction.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/tabbar/LayoutingModeSwitchingAction.java index d0ab2402d1..cf2ebddcb5 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/tabbar/LayoutingModeSwitchingAction.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/tabbar/LayoutingModeSwitchingAction.java @@ -10,31 +10,31 @@ *******************************************************************************/ package org.eclipse.sirius.diagram.ui.tools.internal.editor.tabbar; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IAdaptable; +import java.util.Collections; + import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.emf.transaction.RollbackException; import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.emf.transaction.util.TransactionUtil; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.UnexecutableCommand; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.diagram.ui.actions.DiagramAction; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; +import org.eclipse.emf.transaction.impl.TransactionImpl; +import org.eclipse.gmf.runtime.diagram.ui.actions.CheckedPropertyAction; import org.eclipse.jface.action.IStatusLineManager; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.sirius.common.ui.tools.api.util.EclipseUIUtil; import org.eclipse.sirius.diagram.DDiagram; +import org.eclipse.sirius.diagram.DiagramPlugin; import org.eclipse.sirius.diagram.business.api.diagramtype.DiagramTypeDescriptorRegistry; import org.eclipse.sirius.diagram.business.api.diagramtype.IDiagramTypeDescriptor; import org.eclipse.sirius.diagram.ui.provider.DiagramUIPlugin; import org.eclipse.sirius.diagram.ui.provider.Messages; +import org.eclipse.sirius.diagram.ui.tools.api.editor.DDiagramEditor; import org.eclipse.sirius.diagram.ui.tools.api.image.DiagramImagesPath; import org.eclipse.sirius.diagram.ui.tools.api.ui.actions.ActionIds; +import org.eclipse.sirius.diagram.ui.tools.internal.editor.tabbar.contributions.ModesMenuManager; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IEditorSite; -import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.part.EditorActionBarContributor; /** @@ -43,7 +43,7 @@ import org.eclipse.ui.part.EditorActionBarContributor; * @author <a href="mailto:alex.lagarde@obeo.fr">Alex Lagarde</a> * */ -public class LayoutingModeSwitchingAction extends DiagramAction { +public class LayoutingModeSwitchingAction extends CheckedPropertyAction { /** * Icon used in the tabbar to allow end-user to activate layouting mode. It is also used in the editor's status line @@ -57,19 +57,68 @@ public class LayoutingModeSwitchingAction extends DiagramAction { private DDiagram ddiagram; /** + * The {@link DDiagramEditor} containing the tabbar containing this action. + */ + private DDiagramEditor editor; + + /** + * The {@link ModesMenuManager} handling this action. + */ + private ModesMenuManager modesMenuManager; + + /** * Default constructor. - * - * @param iWorkbenchPart + * + * @param page * The workbench part associated with this action + * @param editor + * The {@link DDiagramEditor} containing the tabbar containing this action. * @param editorDiagram * the {@link DDiagram} on witch the layouting mode should be switched + * @param modesMenuManager + * The {@link ModesMenuManager} handling this action. */ - public LayoutingModeSwitchingAction(IWorkbenchPart iWorkbenchPart, DDiagram editorDiagram) { - super(iWorkbenchPart); + public LayoutingModeSwitchingAction(IWorkbenchPage page, DDiagramEditor editor, DDiagram editorDiagram, ModesMenuManager modesMenuManager) { + super(page, ActionIds.SWITCH_LAYOUTING_MODE, Messages.ChangeEditModeAction_ChangePropertyValueRequest_label, ActionIds.SWITCH_LAYOUTING_MODE); + setWorkbenchPart(page.getActivePart()); setId(ActionIds.SWITCH_LAYOUTING_MODE); this.ddiagram = editorDiagram; setImageDescriptor(ACTIVATE_LAYOUTING_MODE_IMAGE_DESCRIPTOR); setTextAndStatusAccordingToLayoutingMode(); + setToolTipText(Messages.EditModeAction_Label); + this.editor = editor; + this.modesMenuManager = modesMenuManager; + } + + @Override + protected boolean calculateChecked() { + return ddiagram != null && ddiagram.isIsInLayoutingMode(); + } + + @Override + protected void doRun(IProgressMonitor progressMonitor) { + TransactionalEditingDomain editingDomain = (TransactionalEditingDomain) editor.getEditingDomain(); + if (editingDomain != null) { + + // We don't use a command stack because we don't want the mode update to be undone + TransactionImpl t = new TransactionImpl(editingDomain, false, Collections.EMPTY_MAP); + try { + t.start(); + this.ddiagram.setIsInLayoutingMode(true); + this.ddiagram.setIsInShowingMode(false); + t.commit(); + } catch (RollbackException | InterruptedException e) { + DiagramPlugin.getDefault().getLog().log(new Status(IStatus.WARNING, DiagramPlugin.ID, Messages.ChangeEditModeAction_ChangeFailure, e)); + } + + } + modesMenuManager.refresh(); + setTextAndStatusAccordingToLayoutingMode(); + } + + @Override + protected boolean calculateEnabled() { + return ddiagram != null && editor != null; } /** @@ -115,7 +164,7 @@ public class LayoutingModeSwitchingAction extends DiagramAction { */ @Override public int getStyle() { - return AS_UNSPECIFIED; + return AS_CHECK_BOX; } /** @@ -133,45 +182,13 @@ public class LayoutingModeSwitchingAction extends DiagramAction { * * {@inheritDoc} * - * @see org.eclipse.gmf.runtime.diagram.ui.actions.DiagramAction#getCommand() - */ - @Override - protected Command getCommand() { - Command returnedCommand = UnexecutableCommand.INSTANCE; - TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(ddiagram); - if (editingDomain != null) { - setTextAndStatusAccordingToLayoutingMode(); - String commandLabel = ddiagram.isIsInShowingMode() ? Messages.SetShowingModeCommandAndUpdateActionImage_deactivateLabel : Messages.SetShowingModeCommandAndUpdateActionImage_activateLabel; - returnedCommand = new ICommandProxy(new SetShowingModeCommand(TransactionUtil.getEditingDomain(ddiagram), ddiagram, commandLabel, false)) - .chain(new ICommandProxy(new SetLayoutingModeCommand(editingDomain, ddiagram, true) { - - @Override - protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - CommandResult doExecuteWithResult = super.doExecuteWithResult(monitor, info); - if (IStatus.OK == doExecuteWithResult.getStatus().getCode()) { - setTextAndStatusAccordingToLayoutingMode(); - } - return doExecuteWithResult; - - } - - })); - if (ddiagram.isIsInLayoutingMode()) { - setText(Messages.SetLayoutingModeCommandAndUpdateActionImage_deactivateLabel); - } - } - return returnedCommand; - } - - /** - * - * {@inheritDoc} - * * @see org.eclipse.gmf.runtime.diagram.ui.actions.DiagramAction#dispose() */ @Override public void dispose() { ddiagram = null; + modesMenuManager = null; + editor = null; super.dispose(); } @@ -204,15 +221,4 @@ public class LayoutingModeSwitchingAction extends DiagramAction { return diagramAllowsLayoutingMode; } - /** - * - * {@inheritDoc} - * - * @see org.eclipse.gmf.runtime.diagram.ui.actions.DiagramAction#createTargetRequest() - */ - @Override - protected Request createTargetRequest() { - return null; - } - } diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/tabbar/SetLayoutingModeCommand.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/tabbar/SetLayoutingModeCommand.java deleted file mode 100644 index 4d14dfd331..0000000000 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/tabbar/SetLayoutingModeCommand.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.diagram.ui.tools.internal.editor.tabbar; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; -import org.eclipse.sirius.diagram.DDiagram; -import org.eclipse.sirius.diagram.ui.provider.Messages; - -/** - * A command that changes the LayoutingMode of the given {@link DDiagram} and updates the image assocatied to the - * Action. - * - * @author <a href="mailto:alex.lagarde@obeo.fr">Alex Lagarde</a> - * - */ -public class SetLayoutingModeCommand extends AbstractTransactionalCommand { - - /** - * The {@link DDiagram} on witch the layouting mode should be switched. - */ - private DDiagram diagram; - - /** - * Indicates whether the Layouting Mode should be enabled. - */ - private boolean layoutingModeShouldBeEnabled; - - /** - * Constructor. - * - * @param editingDomain - * the editing domain - * @param diagram - * the {@link DDiagram} on witch the layouting mode should be switched - * @param layoutingModeShouldBeEnabled - * indicates whether the layouting mode should be enabled or disabled - */ - public SetLayoutingModeCommand(TransactionalEditingDomain editingDomain, DDiagram diagram, boolean layoutingModeShouldBeEnabled) { - super(editingDomain, Messages.SetLayoutingModeCommandAndUpdateActionImage_activateLabel, null); - this.diagram = diagram; - this.layoutingModeShouldBeEnabled = layoutingModeShouldBeEnabled; - } - - /** - * - * {@inheritDoc} - * - * @see org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand#doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor, - * org.eclipse.core.runtime.IAdaptable) - */ - @Override - protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - CommandResult commandResult = CommandResult.newOKCommandResult(); - if (LayoutingModeSwitchingAction.diagramAllowsLayoutingMode(diagram)) { - this.diagram.setIsInLayoutingMode(layoutingModeShouldBeEnabled); - } - return commandResult; - } -} diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/tabbar/SetShowingModeCommand.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/tabbar/SetShowingModeCommand.java deleted file mode 100644 index fa4d04ad04..0000000000 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/tabbar/SetShowingModeCommand.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.diagram.ui.tools.internal.editor.tabbar; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; -import org.eclipse.sirius.diagram.DDiagram; - -/** - * Command switching the status of the feature {@link DDiagram#isIsInShowingMode()}. - * - * @author <a href="mailto:pierre.guilet@obeo.fr">Pierre Guilet</a> - * - */ -public class SetShowingModeCommand extends AbstractTransactionalCommand { - - private DDiagram diagram; - - private boolean activate; - - /** - * Init the command. - * - * @param domain - * the {@link TransactionalEditingDomain} to use. - * @param diagram - * the {@link DDiagram} to use. - * @param label - * the label to use. - * @param activate - * true if the mode should be activated. False if it should be disabled. - */ - public SetShowingModeCommand(TransactionalEditingDomain domain, DDiagram diagram, String label, boolean activate) { - super(domain, label, null); - this.diagram = diagram; - this.activate = activate; - } - - @Override - protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - diagram.setIsInShowingMode(activate); - return CommandResult.newOKCommandResult(); - } - -} diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/tabbar/ShowingModeSwitchingAction.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/tabbar/VisibilityModeSwitchingAction.java index 410412c649..0cd6837d3a 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/tabbar/ShowingModeSwitchingAction.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/tabbar/VisibilityModeSwitchingAction.java @@ -10,29 +10,29 @@ *******************************************************************************/ package org.eclipse.sirius.diagram.ui.tools.internal.editor.tabbar; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IAdaptable; +import java.util.Collections; + import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.emf.transaction.RollbackException; import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.emf.transaction.util.TransactionUtil; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.UnexecutableCommand; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.diagram.ui.actions.DiagramAction; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; +import org.eclipse.emf.transaction.impl.TransactionImpl; +import org.eclipse.gmf.runtime.diagram.ui.actions.CheckedPropertyAction; import org.eclipse.jface.action.IStatusLineManager; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.sirius.common.ui.tools.api.util.EclipseUIUtil; import org.eclipse.sirius.diagram.DDiagram; +import org.eclipse.sirius.diagram.DiagramPlugin; import org.eclipse.sirius.diagram.ui.provider.DiagramUIPlugin; import org.eclipse.sirius.diagram.ui.provider.Messages; +import org.eclipse.sirius.diagram.ui.tools.api.editor.DDiagramEditor; import org.eclipse.sirius.diagram.ui.tools.api.image.DiagramImagesPath; import org.eclipse.sirius.diagram.ui.tools.api.ui.actions.ActionIds; +import org.eclipse.sirius.diagram.ui.tools.internal.editor.tabbar.contributions.ModesMenuManager; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IEditorSite; -import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.part.EditorActionBarContributor; /** @@ -41,7 +41,7 @@ import org.eclipse.ui.part.EditorActionBarContributor; * @author <a href="mailto:pierre.guilet@obeo.fr">Pierre Guilet</a> * */ -public class ShowingModeSwitchingAction extends DiagramAction { +public class VisibilityModeSwitchingAction extends CheckedPropertyAction { /** * Icon used in the tabbar to allow end-user to activate the showing mode. It is also used in the editor's status @@ -55,21 +55,40 @@ public class ShowingModeSwitchingAction extends DiagramAction { private DDiagram ddiagram; /** + * The {@link DDiagramEditor} containing the tabbar containing this action. + */ + private DDiagramEditor editor; + + /** + * The {@link ModesMenuManager} handling this action. + */ + private ModesMenuManager modesMenuManager; + + /** * Default constructor. - * - * @param iWorkbenchPart + * + * @param page * The workbench part associated with this action + * + * @param editor + * The {@link DDiagramEditor} containing the tabbar containing this action. * @param editorDiagram * the {@link DDiagram} on witch the showing mode should be switched + * @param modesMenuManager + * The {@link ModesMenuManager} handling this action. */ - public ShowingModeSwitchingAction(IWorkbenchPart iWorkbenchPart, DDiagram editorDiagram) { - super(iWorkbenchPart); + public VisibilityModeSwitchingAction(IWorkbenchPage page, DDiagramEditor editor, DDiagram editorDiagram, ModesMenuManager modesMenuManager) { + super(page, ActionIds.SWITCH_SHOWING_MODE, Messages.ChangeEditModeAction_ChangePropertyValueRequest_label, ActionIds.SWITCH_SHOWING_MODE); + setWorkbenchPart(page.getActivePart()); setId(ActionIds.SWITCH_SHOWING_MODE); + setToolTipText(Messages.EditModeAction_Label); this.ddiagram = editorDiagram; if (ddiagram != null) { setImageDescriptor(ACTIVATE_SHOW_HIDE_MODE_IMAGE_DESCRIPTOR); setTextAndStatusAccordingToShowingMode(); } + this.editor = editor; + this.modesMenuManager = modesMenuManager; } /** @@ -109,7 +128,7 @@ public class ShowingModeSwitchingAction extends DiagramAction { @Override public int getStyle() { - return AS_UNSPECIFIED; + return AS_CHECK_BOX; } @Override @@ -118,51 +137,42 @@ public class ShowingModeSwitchingAction extends DiagramAction { } @Override - protected Command getCommand() { - Command returnedCommand = UnexecutableCommand.INSTANCE; - returnedCommand = switchShowingModeCommand(ddiagram); - - return returnedCommand; + protected boolean calculateEnabled() { + return ddiagram != null && editor != null; } - /** - * Returns a command that deactivate the showing mode of the given {@link DDiagram}. - * - * @param diagram - * the {@link DDiagram} on witch the showing mode should be switched - * @return a command that deactivate the showing mode of the given {@link DDiagram} - */ - private Command switchShowingModeCommand(DDiagram diagram) { - Command returnedCommand = UnexecutableCommand.INSTANCE; - TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(diagram); + @Override + protected void doRun(IProgressMonitor progressMonitor) { + TransactionalEditingDomain editingDomain = (TransactionalEditingDomain) editor.getEditingDomain(); if (editingDomain != null) { - String commandLabel = diagram.isIsInShowingMode() ? Messages.SetShowingModeCommandAndUpdateActionImage_deactivateLabel : Messages.SetShowingModeCommandAndUpdateActionImage_activateLabel; - returnedCommand = new ICommandProxy(new SetLayoutingModeCommand(TransactionUtil.getEditingDomain(ddiagram), ddiagram, false)) - .chain(new ICommandProxy(new SetShowingModeCommand(editingDomain, diagram, commandLabel, true) { - - @Override - protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - CommandResult doExecuteWithResult = super.doExecuteWithResult(monitor, info); - if (IStatus.OK == doExecuteWithResult.getStatus().getCode()) { - setTextAndStatusAccordingToShowingMode(); - } - return doExecuteWithResult; - } - - })); + + // We don't use a command stack because we don't want the mode update to be undone + TransactionImpl t = new TransactionImpl(editingDomain, false, Collections.EMPTY_MAP); + try { + t.start(); + this.ddiagram.setIsInLayoutingMode(false); + this.ddiagram.setIsInShowingMode(true); + t.commit(); + } catch (RollbackException | InterruptedException e) { + DiagramPlugin.getDefault().getLog().log(new Status(IStatus.WARNING, DiagramPlugin.ID, Messages.ChangeEditModeAction_ChangeFailure, e)); + } + } - return returnedCommand; + modesMenuManager.refresh(); + setTextAndStatusAccordingToShowingMode(); } @Override - public void dispose() { - ddiagram = null; - super.dispose(); + protected boolean calculateChecked() { + return ddiagram != null && ddiagram.isIsInShowingMode(); } @Override - protected Request createTargetRequest() { - return null; + public void dispose() { + ddiagram = null; + modesMenuManager = null; + editor = null; + super.dispose(); } } diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/tabbar/contributions/ModesMenuManager.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/tabbar/contributions/ModesMenuManager.java index 4690efaef3..f4b81ed2c1 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/tabbar/contributions/ModesMenuManager.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/tabbar/contributions/ModesMenuManager.java @@ -28,7 +28,7 @@ import org.eclipse.sirius.diagram.ui.tools.api.editor.DDiagramEditor; import org.eclipse.sirius.diagram.ui.tools.api.image.DiagramImagesPath; import org.eclipse.sirius.diagram.ui.tools.api.ui.actions.ActionIds; import org.eclipse.sirius.diagram.ui.tools.internal.editor.tabbar.LayoutingModeSwitchingAction; -import org.eclipse.sirius.diagram.ui.tools.internal.editor.tabbar.ShowingModeSwitchingAction; +import org.eclipse.sirius.diagram.ui.tools.internal.editor.tabbar.VisibilityModeSwitchingAction; import org.eclipse.ui.IWorkbenchPage; /** @@ -45,7 +45,7 @@ public class ModesMenuManager extends ActionMenuManager { */ private static class StandardModeMenuAction extends Action { StandardModeMenuAction() { - setText(Messages.DefaultModeAction_Label); + setText(Messages.EditModeAction_Label); ImageDescriptor imageDesc = DiagramUIPlugin.Implementation.getBundledImageDescriptor(DiagramImagesPath.DEFAULT_MODE); setImageDescriptor(imageDesc); setHoverImageDescriptor(imageDesc); @@ -53,6 +53,21 @@ public class ModesMenuManager extends ActionMenuManager { } /** + * Action to activate standard edit mode. + */ + private StandardModeAction standardModeAction; + + /** + * Action to activate layouting edit mode. + */ + private LayoutingModeSwitchingAction layoutingModeSwitchingAction; + + /** + * Action to activate visibility edit mode. + */ + private VisibilityModeSwitchingAction visibilityModeSwitchingAction; + + /** * Creates a new instance of the menu manager. * * @param page @@ -120,10 +135,22 @@ public class ModesMenuManager extends ActionMenuManager { @Override public void dispose() { + standardModeAction = null; + layoutingModeSwitchingAction = null; + visibilityModeSwitchingAction = null; removeAll(); super.dispose(); } + /** + * Refresh icon of all actions. + */ + public void refresh() { + standardModeAction.refresh(); + visibilityModeSwitchingAction.refresh(); + layoutingModeSwitchingAction.refresh(); + } + @Override public void setVisible(boolean visible) { super.setVisible(visible); @@ -134,24 +161,32 @@ public class ModesMenuManager extends ActionMenuManager { if (page != null && page.getActivePart() instanceof DDiagramEditor) { final DDiagramEditor editor = (DDiagramEditor) page.getActivePart(); DDiagram editorDiagram = (DDiagram) editor.getRepresentation(); - add(new StandardModeAction(page.getActivePart(), editorDiagram)); - add(new ShowingModeSwitchingAction(page.getActivePart(), editorDiagram)); + standardModeAction = new StandardModeAction(page, editor, editorDiagram, this); + visibilityModeSwitchingAction = new VisibilityModeSwitchingAction(page, editor, editorDiagram, this); + add(standardModeAction); + add(visibilityModeSwitchingAction); if (LayoutingModeSwitchingAction.diagramAllowsLayoutingMode(editorDiagram)) { - add(new LayoutingModeSwitchingAction(page.getActivePart(), editorDiagram)); + layoutingModeSwitchingAction = new LayoutingModeSwitchingAction(page, editor, editorDiagram, this); + add(layoutingModeSwitchingAction); } - if (editorDiagram != null && editorDiagram.isIsInLayoutingMode()) { + if (editorDiagram != null && editorDiagram.isIsInLayoutingMode() && layoutingModeSwitchingAction != null) { setDefaultAction(ActionIds.SWITCH_LAYOUTING_MODE); + layoutingModeSwitchingAction.setChecked(true); } else if (editorDiagram != null && editorDiagram.isIsInShowingMode()) { setDefaultAction(ActionIds.SWITCH_SHOWING_MODE); + visibilityModeSwitchingAction.setChecked(true); } else { setDefaultAction(ActionIds.DEFAULT_MODE); + standardModeAction.setChecked(true); } - } } else if (!isEmpty() && !visible) { remove(ActionIds.SWITCH_LAYOUTING_MODE); remove(ActionIds.SWITCH_SHOWING_MODE); remove(ActionIds.DEFAULT_MODE); + standardModeAction = null; + layoutingModeSwitchingAction = null; + visibilityModeSwitchingAction = null; } } } diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/tabbar/contributions/StandardModeAction.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/tabbar/contributions/StandardModeAction.java index 719dfe020a..efe11f1dfd 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/tabbar/contributions/StandardModeAction.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/tabbar/contributions/StandardModeAction.java @@ -10,30 +10,28 @@ *******************************************************************************/ package org.eclipse.sirius.diagram.ui.tools.internal.editor.tabbar.contributions; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IAdaptable; +import java.util.Collections; + import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; -import org.eclipse.emf.transaction.util.TransactionUtil; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.UnexecutableCommand; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.diagram.ui.actions.DiagramAction; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; +import org.eclipse.core.runtime.Status; +import org.eclipse.emf.transaction.RollbackException; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.emf.transaction.impl.TransactionImpl; +import org.eclipse.gmf.runtime.diagram.ui.actions.CheckedPropertyAction; import org.eclipse.jface.action.IStatusLineManager; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.sirius.common.ui.tools.api.util.EclipseUIUtil; import org.eclipse.sirius.diagram.DDiagram; +import org.eclipse.sirius.diagram.DiagramPlugin; import org.eclipse.sirius.diagram.ui.provider.DiagramUIPlugin; import org.eclipse.sirius.diagram.ui.provider.Messages; +import org.eclipse.sirius.diagram.ui.tools.api.editor.DDiagramEditor; import org.eclipse.sirius.diagram.ui.tools.api.image.DiagramImagesPath; import org.eclipse.sirius.diagram.ui.tools.api.ui.actions.ActionIds; -import org.eclipse.sirius.diagram.ui.tools.internal.editor.tabbar.SetLayoutingModeCommand; -import org.eclipse.sirius.diagram.ui.tools.internal.editor.tabbar.SetShowingModeCommand; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IEditorSite; -import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.part.EditorActionBarContributor; /** @@ -42,7 +40,7 @@ import org.eclipse.ui.part.EditorActionBarContributor; * @author <a href="mailto:pierre.guilet@obeo.fr">Pierre Guilet</a> * */ -public class StandardModeAction extends DiagramAction { +public class StandardModeAction extends CheckedPropertyAction { /** * Icon used in the tabbar to allow end-user to activate the showing mode. It is also used in the editor's status @@ -56,21 +54,71 @@ public class StandardModeAction extends DiagramAction { private DDiagram ddiagram; /** + * The {@link DDiagramEditor} containing the tabbar containing this action. + */ + private DDiagramEditor editor; + + /** + * The {@link ModesMenuManager} handling this action. + */ + private ModesMenuManager modesMenuManager; + + /** * Default constructor. + * + * @param page + * The {@link ModesMenuManager} handling this action. * - * @param iWorkbenchPart + * @param editor * The workbench part associated with this action * @param editorDiagram * the {@link DDiagram} on witch the showing mode should be switched + * @param modesMenuManager + * The {@link ModesMenuManager} handling this action. */ - public StandardModeAction(IWorkbenchPart iWorkbenchPart, DDiagram editorDiagram) { - super(iWorkbenchPart); + public StandardModeAction(IWorkbenchPage page, DDiagramEditor editor, DDiagram editorDiagram, ModesMenuManager modesMenuManager) { + super(page, ActionIds.DEFAULT_MODE, Messages.ChangeEditModeAction_ChangePropertyValueRequest_label, ActionIds.DEFAULT_MODE); + setWorkbenchPart(page.getActivePart()); setId(ActionIds.DEFAULT_MODE); + setToolTipText(Messages.EditModeAction_Label); this.ddiagram = editorDiagram; if (ddiagram != null) { setImageDescriptor(DEFAULT_MODE_IMAGE_DESCRIPTOR); setTextAndStatusAccordingToDefaultMode(); } + this.editor = editor; + this.modesMenuManager = modesMenuManager; + } + + @Override + protected boolean calculateChecked() { + return ddiagram != null && !ddiagram.isIsInShowingMode() && !ddiagram.isIsInLayoutingMode(); + } + + @Override + protected void doRun(IProgressMonitor progressMonitor) { + TransactionalEditingDomain editingDomain = (TransactionalEditingDomain) editor.getEditingDomain(); + if (editingDomain != null) { + + // We don't use a command stack because we don't want the mode update to be undone + TransactionImpl t = new TransactionImpl(editingDomain, false, Collections.EMPTY_MAP); + try { + t.start(); + this.ddiagram.setIsInLayoutingMode(false); + this.ddiagram.setIsInShowingMode(false); + t.commit(); + } catch (RollbackException | InterruptedException e) { + DiagramPlugin.getDefault().getLog().log(new Status(IStatus.WARNING, DiagramPlugin.ID, Messages.ChangeEditModeAction_ChangeFailure, e)); + } + + } + modesMenuManager.refresh(); + setTextAndStatusAccordingToDefaultMode(); + } + + @Override + protected boolean calculateEnabled() { + return ddiagram != null && editor != null; } /** @@ -111,7 +159,7 @@ public class StandardModeAction extends DiagramAction { */ @Override public int getStyle() { - return AS_UNSPECIFIED; + return AS_CHECK_BOX; } /** @@ -129,50 +177,14 @@ public class StandardModeAction extends DiagramAction { * * {@inheritDoc} * - * @see org.eclipse.gmf.runtime.diagram.ui.actions.DiagramAction#getCommand() - */ - @Override - protected Command getCommand() { - Command returnedCommand = UnexecutableCommand.INSTANCE; - if (getWorkbenchPart() != null) { - String commandLabel = ddiagram.isIsInShowingMode() ? Messages.SetShowingModeCommandAndUpdateActionImage_deactivateLabel : Messages.SetShowingModeCommandAndUpdateActionImage_activateLabel; - returnedCommand = new ICommandProxy(new SetShowingModeCommand(TransactionUtil.getEditingDomain(ddiagram), ddiagram, commandLabel, false)) - .chain(new ICommandProxy(new SetLayoutingModeCommand(TransactionUtil.getEditingDomain(ddiagram), ddiagram, false) { - - @Override - protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - CommandResult doExecuteWithResult = super.doExecuteWithResult(monitor, info); - if (IStatus.OK == doExecuteWithResult.getStatus().getCode()) { - setTextAndStatusAccordingToDefaultMode(); - } - return doExecuteWithResult; - } - })); - } - return returnedCommand; - } - - /** - * - * {@inheritDoc} - * * @see org.eclipse.gmf.runtime.diagram.ui.actions.DiagramAction#dispose() */ @Override public void dispose() { ddiagram = null; + modesMenuManager = null; + editor = null; super.dispose(); } - /** - * - * {@inheritDoc} - * - * @see org.eclipse.gmf.runtime.diagram.ui.actions.DiagramAction#createTargetRequest() - */ - @Override - protected Request createTargetRequest() { - return null; - } - } 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 2152e13d25..f4e8676637 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 @@ -46,8 +46,6 @@ import org.eclipse.sirius.diagram.ui.tools.internal.actions.style.SetStyleToWork import org.eclipse.sirius.diagram.ui.tools.internal.actions.visibility.HideDDiagramElementAction; import org.eclipse.sirius.diagram.ui.tools.internal.editor.tabbar.FiltersContributionItem; import org.eclipse.sirius.diagram.ui.tools.internal.editor.tabbar.LayersContribution; -import org.eclipse.sirius.diagram.ui.tools.internal.editor.tabbar.LayoutingModeSwitchingAction; -import org.eclipse.sirius.diagram.ui.tools.internal.editor.tabbar.ShowingModeSwitchingAction; import org.eclipse.sirius.diagram.ui.tools.internal.editor.tabbar.actions.DiagramActionContributionItem; import org.eclipse.sirius.diagram.ui.tools.internal.editor.tabbar.actions.HideDDiagramElementLabelActionContributionItem; import org.eclipse.sirius.diagram.ui.tools.internal.editor.tabbar.actions.TabbarAlignMenuManager; @@ -525,28 +523,6 @@ public class TabbarContributionFactory { } /** - * Creates the Layout Mode contribution item. This button enables a special "layout mode", in which some operations - * are prevented from having an effect on the semantic model. - * - * @param part - * the current IDiagramWorkbenchPart. - * @return the {@link IContributionItem} or null if the workbench part is being initialized or if the diagram - * doesn't allow the layouting mode. - */ - public IContributionItem createLayoutingModeContributionItem(IDiagramWorkbenchPart part) { - IWorkbenchPartSite site = part.getSite(); - if (site != null && part instanceof DDiagramEditor) { - final DDiagramEditor editor = (DDiagramEditor) part; - DDiagram editorDiagram = (DDiagram) editor.getRepresentation(); - if (LayoutingModeSwitchingAction.diagramAllowsLayoutingMode(editorDiagram)) { - LayoutingModeSwitchingAction layoutingModeSwitchingAction = new LayoutingModeSwitchingAction(part, editorDiagram); - return new TabbarActionContributionItem(layoutingModeSwitchingAction); - } - } - return null; - } - - /** * Creates the {@link ModesMenuManager} allowing to choose a diagram editor edit mode. * * @param editorDiagram @@ -561,29 +537,6 @@ public class TabbarContributionFactory { } /** - * Creates the Showing Mode contribution item. This button enables a special "showing mode" in which invisible - * diagram elements are temporarily revealed to allow user to easily make them visible. - * - * @param part - * the current IDiagramWorkbenchPart. - * @param manager - * the toolbar manager - * @return the {@link IContributionItem} or null if the workbench part is being initialized. - */ - public IContributionItem createShowingModeContributionItem(IDiagramWorkbenchPart part, ToolBarManager manager) { - IWorkbenchPartSite site = part.getSite(); - if (site != null && part instanceof DDiagramEditor) { - final DDiagramEditor editor = (DDiagramEditor) part; - DDiagram editorDiagram = (DDiagram) editor.getRepresentation(); - ShowingModeSwitchingAction showingModeSwitchingAction = new ShowingModeSwitchingAction(part, editorDiagram); - TabbarActionContributionItem tabbarActionContributionItem = new TabbarActionContributionItem(showingModeSwitchingAction); - - return tabbarActionContributionItem; - } - return null; - } - - /** * Creates the Router contribution item. This action allows changing the line style of edges (Rectilinear, Oblique, * Tree) * diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/testers/CanHideElementTester.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/testers/CanHideElementTester.java index a6e4384b3b..dd2c26b5e3 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/testers/CanHideElementTester.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/testers/CanHideElementTester.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012 THALES GLOBAL SERVICES. + * Copyright (c) 2012, 2018 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 @@ -30,9 +30,10 @@ public class CanHideElementTester extends PropertyTester { /** * {@inheritDoc} * - * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, - * java.lang.String, java.lang.Object[], java.lang.Object) + * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], + * java.lang.Object) */ + @Override public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { boolean result = false; @@ -59,6 +60,7 @@ public class CanHideElementTester extends PropertyTester { } else { DDiagram parentDiagram = diagramElement.getParentDiagram(); result = parentDiagram != null ? HideDDiagramElementAction.allowsHideReveal(parentDiagram).apply(diagramElement) : false; + result = result && !parentDiagram.isIsInShowingMode(); } return result; } @@ -66,8 +68,7 @@ public class CanHideElementTester extends PropertyTester { /** * @param selectedElements * The current selection - * @return true if all selected elements is kind of IDiagramElementEditPart - * and has label hidden. + * @return true if all selected elements is kind of IDiagramElementEditPart and has label hidden. */ private boolean testStructuredSelection(IStructuredSelection selectedElements) { boolean result = true; 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 7be66665dc..ccd3bfef71 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 @@ -1554,6 +1554,9 @@ public final class Messages { public static String DefaultModeAction_Label; @TranslatableMessage + public static String EditModeAction_Label; + + @TranslatableMessage public static String DoubleClickEditPolicy_confirmDialogAsking; @TranslatableMessage @@ -1561,8 +1564,14 @@ public final class Messages { @TranslatableMessage public static String DDiagramEditorImpl_updateToolFailure; - // CHECKSTYLE:ON + @TranslatableMessage + public static String ChangeEditModeAction_ChangePropertyValueRequest_label; + + @TranslatableMessage + public static String ChangeEditModeAction_ChangeFailure; + + // CHECKSTYLE:ON private Messages() { // Prevents instanciation. } diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html index f05a0b06fa..dc1f72f048 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html +++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html @@ -90,7 +90,19 @@ <li><span class="label label-success">Added</span> The preference <code>org.eclipse.sirius.ui.business.api.preferences.SiriusUIPreferencesKeys.PREF_DISPLAY_VSM_USER_FIXED_COLOR_IN_PALETTE</code> has been added and can be managed in Preferences/Sirius/Sirius Diagram/Appearance/Display viewpoint colors. It allows to display, in the color palette, the user fixed color(defined in the activated viewpoints) in addition to standard colors. The color palette is available in Appearance tab of the Properties view. </li> + <li><span class="label label-success">Added</span> A new visibility diagram edit + <a href="user/diagrams/Diagrams.html#edit_modes">mode</a> is available. It allows to see diagram elements hidden manually with some transparency. In this mode the visibility can be changed by a double click on the target diagram element. + </li> </ul> + <p> + <img border="0" src="user/diagrams/images/show_hide_mode_example.png"/> + </p> + <ul> + <li><span class="label label-success">Added</span> A new dropdown menu gathering the layouting, visibility and standard mode is now available in the tabbar of diagram editors to activate the chosen edit mode. The standard mode corresponds to a diagram editor without the layouting and visibility mode activated.</li> + </ul> + <p> + <img border="0" src="user/diagrams/images/show_hide_mode_tabbar_activate.png"/> + </p> <h3 id="SpecifierVisibleChanges">Specifier-Visible Changes</h3> <ul> <li><span class="label label-success">Added</span> diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile index eca8ea4430..735b5cc077 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile +++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile @@ -15,6 +15,10 @@ h3. User-Visible Changes * <span class="label label-success">Added</span> A new preference has been added in the Sirius preference panel. It allows Sirius to ask the user if he wants to save session resources after an automatic migration. If the new preference is ticked, the pop-up will only appear for session opening caused by a direct action of the user (i.e. opening a diagram or unfolding the resources in the model explorer). * <span class="label label-success">Added</span> On sequence diagrams, it is now possible to add vertical blank spaces on standard edition mode by dragging the mouse anywhere in the canvas with the Ctrl+Shift keys pressed. This "feature:":user/sequences/Sequence%20Diagrams.html#insert_vertical_blank_space was here since version 6.0.0 but was only accessible through the ruler. * <span class="label label-success">Added</span> The preference @org.eclipse.sirius.ui.business.api.preferences.SiriusUIPreferencesKeys.PREF_DISPLAY_VSM_USER_FIXED_COLOR_IN_PALETTE@ has been added and can be managed in Preferences/Sirius/Sirius Diagram/Appearance/Display viewpoint colors. It allows to display, in the color palette, the user fixed color(defined in the activated viewpoints) in addition to standard colors. The color palette is available in Appearance tab of the Properties view. +* <span class="label label-success">Added</span> A new visibility diagram edit "mode":user/diagrams/Diagrams.html#edit_modes is available. It allows to see diagram elements hidden manually with some transparency. In this mode the visibility can be changed by a double click on the target diagram element. +!user/diagrams/images/show_hide_mode_example.png! +* <span class="label label-success">Added</span> A new dropdown menu gathering the layouting, visibility and standard mode is now available in the tabbar of diagram editors to activate the chosen edit mode. The standard mode corresponds to a diagram editor without the layouting and visibility mode activated. +!user/diagrams/images/show_hide_mode_tabbar_activate.png! h3. Specifier-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 d346b3bbcc..d482590f3a 100644 --- a/plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.html +++ b/plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.html @@ -158,7 +158,7 @@ </ol> </li> <li> - <a href="#Editmodes">Edit modes</a> + <a href="#edit_modes">Edit modes</a> <ol style="list-style: disc;"> <li> <a href="#Standardmode">Standard mode</a> @@ -167,7 +167,7 @@ <a href="#Layoutingmodearrangeyourdiagramswithoutmodifyingsemanticmodels">Layouting mode: arrange your diagrams without modifying semantic models</a> </li> <li> - <a href="#Showhidemodechangediagramelementvisibilitywithoutmodifyingsemanticmodels">Show/hide mode: change diagram element visibility without modifying semantic models</a> + <a href="#Visibilitymodechangediagramelementvisibilitywithoutmodifyingsemanticmodels">Visibility mode: change diagram element visibility without modifying semantic models</a> </li> </ol> </li> @@ -1021,7 +1021,7 @@ <p> <img border="0" src="images/diagram_editor_pin_toolbar_activated.png"/> </p> - <h3 id="Editmodes">Edit modes</h3> + <h3 id="edit_modes">Edit modes</h3> <p>Different diagram edit modes are available. Each mode focus on a specific way of editing diagrams. Modes are accessible from a dropdown menu in the tabbar when no diagram element is selected: <br/> <img border="0" src="images/editModesDropdown.png"/> @@ -1067,7 +1067,7 @@ <p>When a diagram is closed, the <em>Layouting mode</em> is automatically disabled. </p> - <h4 id="Showhidemodechangediagramelementvisibilitywithoutmodifyingsemanticmodels">Show/hide mode: change diagram element visibility without modifying semantic models</h4> + <h4 id="Visibilitymodechangediagramelementvisibilitywithoutmodifyingsemanticmodels">Visibility mode: change diagram element visibility without modifying semantic models</h4> <p>This mode allows to visualize all diagram elements either visible or invisible because of a filter or a previous hiding action execution on the element. Invisible elements will be shown with transparency:</p> <p> <img border="0" src="images/show_hide_mode_example.png"/> @@ -1092,10 +1092,10 @@ <li>moving the extremity of an edge to adjust its connection point (to the source or target element) is possible, but will never trigger a reconnection operation.</li> </ul> <p>Note that other operations which can change the semantic model are still possible. Only the operations listed above, which are easy to misuse, are disabled/modified. - <strong>Show/Hide mode is not a “read-only” mode and does not guarantee that the semantic model is not modified when it is enabled.</strong> + <strong>Visibility mode is not a “read-only” mode and does not guarantee that the semantic model is not modified when it is enabled.</strong> </p> <p> - <strong>Show/Hide mode</strong> can be activated on a diagram through the tabbar (when there is no selected element) : + <strong>Visibility mode</strong> can be activated on a diagram through the tabbar (when there is no selected element) : </p> <p> <img border="0" src="images/show_hide_mode_tabbar_activate.png"/> @@ -1104,7 +1104,7 @@ <em>Standard mode</em>. </p> <p>When a diagram is closed, the - <em>Show/Hide mode</em> is automatically disabled. + <em>Visibility mode</em> is automatically disabled. </p> <h3 id="synchronized_diagram">Synchronized/Unsynchronized diagram</h3> <p>The contextual menu on the background of the diagram provides an action to toggle between 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 7b03002239..7e698a4c1f 100644 --- a/plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.textile +++ b/plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.textile @@ -611,7 +611,7 @@ To see more easily if one or more graphical elements are pinned, the icon in the !images/diagram_editor_pin_toolbar_activated.png! -h3. Edit modes +h3(#edit_modes). Edit modes Different diagram edit modes are available. Each mode focus on a specific way of editing diagrams. Modes are accessible from a dropdown menu in the tabbar when no diagram element is selected: !images/editModesDropdown.png! @@ -647,7 +647,7 @@ In this example, as _Layouting mode_ is activated, reconnecting the Edge from _A When a diagram is closed, the _Layouting mode_ is automatically disabled. -h4. Show/hide mode: change diagram element visibility without modifying semantic models +h4. Visibility mode: change diagram element visibility without modifying semantic models This mode allows to visualize all diagram elements either visible or invisible because of a filter or a previous hiding action execution on the element. Invisible elements will be shown with transparency: @@ -667,15 +667,15 @@ So when this mode is enabled, the following operations are changed: * direct edit is disabled on all elements; * moving elements by dragging them can be used to change their position, but will never trigger a drag and drop operation; * moving the extremity of an edge to adjust its connection point (to the source or target element) is possible, but will never trigger a reconnection operation. -Note that other operations which can change the semantic model are still possible. Only the operations listed above, which are easy to misuse, are disabled/modified. *Show/Hide mode is not a "read-only" mode and does not guarantee that the semantic model is not modified when it is enabled.* +Note that other operations which can change the semantic model are still possible. Only the operations listed above, which are easy to misuse, are disabled/modified. *Visibility mode is not a "read-only" mode and does not guarantee that the semantic model is not modified when it is enabled.* -*Show/Hide mode* can be activated on a diagram through the tabbar (when there is no selected element) : +*Visibility mode* can be activated on a diagram through the tabbar (when there is no selected element) : !images/show_hide_mode_tabbar_activate.png! To deactivate the mode you just have to select the _Standard mode_. -When a diagram is closed, the _Show/Hide mode_ is automatically disabled. +When a diagram is closed, the _Visibility mode_ is automatically disabled. h3(#synchronized_diagram). Synchronized/Unsynchronized diagram diff --git a/plugins/org.eclipse.sirius.doc/doc/user/diagrams/images/show_hide_mode_tabbar_activate.png b/plugins/org.eclipse.sirius.doc/doc/user/diagrams/images/show_hide_mode_tabbar_activate.png Binary files differindex 1c72621214..9e35a5018b 100644 --- a/plugins/org.eclipse.sirius.doc/doc/user/diagrams/images/show_hide_mode_tabbar_activate.png +++ b/plugins/org.eclipse.sirius.doc/doc/user/diagrams/images/show_hide_mode_tabbar_activate.png diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/tabbar/TabbarContributorSample.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/tabbar/TabbarContributorSample.java index f391e8e776..776f72a6ba 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/tabbar/TabbarContributorSample.java +++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/tabbar/TabbarContributorSample.java @@ -82,7 +82,7 @@ public class TabbarContributorSample extends AbstractTabbarContributor { diagramContributionItems.add(createPasteFormatContribution(part)); diagramContributionItems.add(createRefreshContribution()); diagramContributionItems.add(createSaveAsImageContributionItem()); - diagramContributionItems.add(createLayoutingModeContributionItem(part)); + diagramContributionItems.add(createModeMenuManagerContributionItem(part)); diagramContributionItems.add(createCopyAppearancePropertiesContribution(part)); diagramContributionItems.add(createCopyFormatContribution(part)); } @@ -112,7 +112,7 @@ public class TabbarContributorSample extends AbstractTabbarContributor { diagramElementContributionItems.add(createSetStyleToWorkspaceImageContribution(part)); diagramElementContributionItems.add(createSaveAsImageContributionItem()); diagramElementContributionItems.add(createDistributeContribution()); - diagramElementContributionItems.add(createLayoutingModeContributionItem(part)); + diagramElementContributionItems.add(createModeMenuManagerContributionItem(part)); diagramElementContributionItems.add(createRouterContribution()); diagramElementContributionItems.add(createCopyAppearancePropertiesContribution(part)); diagramElementContributionItems.add(createCopyFormatContribution(part)); |
