diff options
author | Gabriel Pascual | 2014-11-12 15:46:22 +0000 |
---|---|---|
committer | Remi Schnekenburger | 2014-12-08 09:31:46 +0000 |
commit | b84d4aabdc6d391b043f08cf9476663fda48f33d (patch) | |
tree | 8fc9188475487c051ed9e2c55fdaabd75fe52d1b | |
parent | f07b7c724fbdbd793f3ed9e345d9e9782ac2f221 (diff) | |
download | org.eclipse.papyrus-b84d4aabdc6d391b043f08cf9476663fda48f33d.tar.gz org.eclipse.papyrus-b84d4aabdc6d391b043f08cf9476663fda48f33d.tar.xz org.eclipse.papyrus-b84d4aabdc6d391b043f08cf9476663fda48f33d.zip |
436947: [Submodel] Usability improvements for submodels
https://bugs.eclipse.org/bugs/show_bug.cgi?id=436947
- Modify menu labels
- Modify dialog message and title for UML Prodile Control participant.
Change-Id: I4c9bc5e3e8ea3b13fd7827a18e189dac45beaf8d
Signed-off-by: Gabriel Pascual <gabriel.pascual@all4tec.net>
4 files changed, 237 insertions, 204 deletions
diff --git a/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/Messages.java b/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/Messages.java index f8cd37c29ff..1ad335f47b8 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/Messages.java +++ b/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/Messages.java @@ -1,49 +1,66 @@ -/*****************************************************************************
- * Copyright (c) 2011 Atos Origin.
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.controlmode.profile;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * This class handles messages internationalization.
- *
- * @author vhemery
- */
-public class Messages extends NLS {
-
- private static final String BUNDLE_NAME = "org.eclipse.papyrus.uml.controlmode.profile.messages"; //$NON-NLS-1$
-
- /** Message for switching the loading strategy when controlled package is not loaded */
- public static String switch_loading_strategy;
-
- /** Error message when controlled package is read-only */
- public static String error_readonly;
-
- /** Error message when an error occurs during validation */
- public static String error_during_validation;
-
- /** Error message when trying to delete a duplicated profile application */
- public static String warning_cannot_delete_duplicated;
-
- /** Error message when trying to delete a duplicated profile application */
- public static String warning_cannot_delete_duplicated_alt;
-
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
+/***************************************************************************** + * Copyright (c) 2011, 2014 Atos Origin, CEA LIST and etc. + * + * + * 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: + * Atos Origin - Initial API and implementation + * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Bug 436947 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.controlmode.profile; + +import org.eclipse.osgi.util.NLS; + +/** + * This class handles messages internationalization. + * + * @author vhemery + */ +public class Messages extends NLS { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "org.eclipse.papyrus.uml.controlmode.profile.messages"; //$NON-NLS-1$ + + /** Message for switching the loading strategy when controlled package is not loaded. */ + public static String switch_loading_strategy; + + /** Error message when controlled package is read-only. */ + public static String error_readonly; + + /** Error message when an error occurs during validation. */ + public static String error_during_validation; + + /** Message for control mode dialog. */ + public static String UMLProfileControlParticipant_controlmode_dialog_message; + + /** Title for control mode dialog. */ + public static String UMLProfileControlParticipant_controlmode_dialog_title; + + public static String UMLProfileControlParticipant_Post_Control_Command_Label; + + public static String UMLProfileControlParticipant_Post_Uncontrol_Command_Label; + + public static String UMLProfileControlParticipant_Pre_Uncontrol_Command_Label; + + /** Error message when trying to delete a duplicated profile application. */ + public static String warning_cannot_delete_duplicated; + + /** Error message when trying to delete a duplicated profile application. */ + public static String warning_cannot_delete_duplicated_alt; + + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + /** + * Instantiates a new messages. + */ + private Messages() { + } +} diff --git a/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/UMLProfileControlParticipant.java b/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/UMLProfileControlParticipant.java index 8ee71236a41..60575193484 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/UMLProfileControlParticipant.java +++ b/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/UMLProfileControlParticipant.java @@ -1,148 +1,159 @@ -/*****************************************************************************
- * Copyright (c) 2013 Atos.
- *
- *
- * 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:
- * Arthur Daussy (Atos) arthur.daussy@atos.net - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.controlmode.profile;
-
-import java.util.Collections;
-
-import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.papyrus.infra.services.controlmode.ControlModeRequest;
-import org.eclipse.papyrus.infra.services.controlmode.commands.AskUserCommand;
-import org.eclipse.papyrus.infra.services.controlmode.participants.IControlCommandParticipant;
-import org.eclipse.papyrus.infra.services.controlmode.participants.IUncontrolCommandParticipant;
-import org.eclipse.papyrus.uml.controlmode.profile.commands.CopyProfileApplicationCommand;
-import org.eclipse.papyrus.uml.controlmode.profile.commands.MoveProfileApplicationCommand;
-import org.eclipse.papyrus.uml.controlmode.profile.commands.MoveStereotypeApplicationToControlResource;
-import org.eclipse.papyrus.uml.controlmode.profile.commands.RemoveDuplicationProfileApplicationCommand;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Package;
-
-/**
- * Participant to control command handling Uml element.
- * Handle Profile applications on package
- * Handle Stereotype Application on Package
- *
- * @author adaussy
- *
- */
-public class UMLProfileControlParticipant implements IControlCommandParticipant, IUncontrolCommandParticipant {
-
- /**
- * Return the command to copy profile application
- *
- * @param request
- * @return
- */
- protected IUndoableOperation getCopyProfileApplication(final ControlModeRequest request) {
- return new CopyProfileApplicationCommand(request);
- }
-
- public String getID() {
- return "org.eclipse.papyrus.uml.controlmode.profile.UMLProfileControlParticipant";
- }
-
- private String getPreControlCommandMessage(Element objectToControl) {
- return "This element is not a package. Due to UML restrictions, the newly created model fragment is not allowed to be modified in the standalone mode";//
- }
-
- /**
- * Get the command to move stereotype application
- *
- * @param request
- * @return
- */
- protected IUndoableOperation getMoveStereotypeCommand(final ControlModeRequest request) {
- return new MoveStereotypeApplicationToControlResource(Collections.singletonList(WorkspaceSynchronizer.getFile(request.getTargetObject().eResource())), request);
- }
-
- public ICommand getPostControlCommand(ControlModeRequest request) {
- CompositeCommand cc = new CompositeCommand("Composite command for control command [UML Part]");
- // Move stereotype application
- if (request.getTargetObject() instanceof Package) {
- cc.compose(getMoveProfileAppliationCommand(request));
- }
- // Move stereotype application
- cc.compose(getMoveStereotypeCommand(request));
- // Copy profile application
- if (request.getTargetObject() instanceof Package) {
- cc.compose(getCopyProfileApplication(request));
- }
- return cc;
- }
-
- public ICommand getPostUncontrolCommand(ControlModeRequest request) {
- CompositeCommand cc = new CompositeCommand("Composite command for uncontrol command [UML Part]");
-
- if (cc.isEmpty()) {
- return null;
- }
- return cc;
- }
-
- /**
- * Get the command to move profile applicaiton
- *
- * @param request
- * @return
- */
- protected ICommand getMoveProfileAppliationCommand(ControlModeRequest request) {
- return new MoveProfileApplicationCommand(request);
- }
-
- /**
- * Get the command to remove profile application
- *
- * @param request
- * @return
- */
- protected ICommand getRemoveProfileApplication(final ControlModeRequest request) {
- return new RemoveDuplicationProfileApplicationCommand(request);
- }
-
- public ICommand getPreControlCommand(ControlModeRequest request) {
- Element elem = (Element) request.getTargetObject();
- if (request.isUIAction() && !(elem instanceof org.eclipse.uml2.uml.Package)) {
- return new AskUserCommand(request.getEditingDomain(), getPreControlCommandMessage(elem), getPreControlCommandDialogTitle(elem), true, "org.eclipse.papyrus.controlmode.umlprofiles.participants.UMLProfileParticipant.openstandalonemodeldialog");
- }
- return null;
- }
-
- public ICommand getPreUncontrolCommand(ControlModeRequest request) {
- CompositeCommand cc = new CompositeCommand("Composite command for pre uncontrol command [UML Part]");
- // Copy profile application
- if (request.getTargetObject() instanceof Package) {
- cc.compose(getRemoveProfileApplication(request));
- }
- cc.compose(getMoveStereotypeCommand(request));
- return cc;
- }
-
- public int getPriority() {
- return 100;
- }
-
- protected String getPreControlCommandDialogTitle(Element elem) {
- return "Warning: The element is not a Package";
- }
-
- public boolean provideControlCommand(ControlModeRequest request) {
- return request.getTargetObject() instanceof Element;
- }
-
- public boolean provideUnControlCommand(ControlModeRequest request) {
- return request.getTargetObject() instanceof Element;
- }
-}
+/***************************************************************************** + * Copyright (c) 2013, 2014 Atos, CEA LIST and etc.. + * + * + * 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: + * Arthur Daussy (Atos) arthur.daussy@atos.net - Initial API and implementation + * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Bug 436947 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.controlmode.profile; + +import java.util.Collections; + +import org.eclipse.core.commands.operations.IUndoableOperation; +import org.eclipse.emf.workspace.util.WorkspaceSynchronizer; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.papyrus.infra.services.controlmode.ControlModeRequest; +import org.eclipse.papyrus.infra.services.controlmode.commands.AskUserCommand; +import org.eclipse.papyrus.infra.services.controlmode.participants.IControlCommandParticipant; +import org.eclipse.papyrus.infra.services.controlmode.participants.IUncontrolCommandParticipant; +import org.eclipse.papyrus.uml.controlmode.profile.commands.CopyProfileApplicationCommand; +import org.eclipse.papyrus.uml.controlmode.profile.commands.MoveProfileApplicationCommand; +import org.eclipse.papyrus.uml.controlmode.profile.commands.MoveStereotypeApplicationToControlResource; +import org.eclipse.papyrus.uml.controlmode.profile.commands.RemoveDuplicationProfileApplicationCommand; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.Package; + +/** + * Participant to control command handling Uml element. + * Handle Profile applications on package + * Handle Stereotype Application on Package + * + * @author adaussy + * + */ +public class UMLProfileControlParticipant implements IControlCommandParticipant, IUncontrolCommandParticipant { + + + /** The Constant PRE_UNCONTROL_COMMAND_LABEL. */ + private static final String PRE_UNCONTROL_COMMAND_LABEL = Messages.UMLProfileControlParticipant_Pre_Uncontrol_Command_Label; + + /** The Constant POST_UNCONTROL_COMMAND_LABEL. */ + private static final String POST_UNCONTROL_COMMAND_LABEL = Messages.UMLProfileControlParticipant_Post_Uncontrol_Command_Label; + + /** The Constant POST_CONTROL_COMMAND_LABEL. */ + private static final String POST_CONTROL_COMMAND_LABEL = Messages.UMLProfileControlParticipant_Post_Control_Command_Label; + + /** + * Return the command to copy profile application + * + * @param request + * @return + */ + protected IUndoableOperation getCopyProfileApplication(final ControlModeRequest request) { + return new CopyProfileApplicationCommand(request); + } + + public String getID() { + return "org.eclipse.papyrus.uml.controlmode.profile.UMLProfileControlParticipant"; //$NON-NLS-1$ + } + + private String getPreControlCommandMessage(Element objectToControl) { + return Messages.UMLProfileControlParticipant_controlmode_dialog_message; + } + + /** + * Get the command to move stereotype application + * + * @param request + * @return + */ + protected IUndoableOperation getMoveStereotypeCommand(final ControlModeRequest request) { + return new MoveStereotypeApplicationToControlResource(Collections.singletonList(WorkspaceSynchronizer.getFile(request.getTargetObject().eResource())), request); + } + + public ICommand getPostControlCommand(ControlModeRequest request) { + CompositeCommand cc = new CompositeCommand(POST_CONTROL_COMMAND_LABEL); + // Move stereotype application + if (request.getTargetObject() instanceof Package) { + cc.compose(getMoveProfileAppliationCommand(request)); + } + // Move stereotype application + cc.compose(getMoveStereotypeCommand(request)); + // Copy profile application + if (request.getTargetObject() instanceof Package) { + cc.compose(getCopyProfileApplication(request)); + } + return cc; + } + + public ICommand getPostUncontrolCommand(ControlModeRequest request) { + CompositeCommand cc = new CompositeCommand(POST_UNCONTROL_COMMAND_LABEL); + + if (cc.isEmpty()) { + return null; + } + return cc; + } + + /** + * Get the command to move profile applicaiton + * + * @param request + * @return + */ + protected ICommand getMoveProfileAppliationCommand(ControlModeRequest request) { + return new MoveProfileApplicationCommand(request); + } + + /** + * Get the command to remove profile application + * + * @param request + * @return + */ + protected ICommand getRemoveProfileApplication(final ControlModeRequest request) { + return new RemoveDuplicationProfileApplicationCommand(request); + } + + public ICommand getPreControlCommand(ControlModeRequest request) { + Element elem = (Element) request.getTargetObject(); + if (request.isUIAction() && !(elem instanceof org.eclipse.uml2.uml.Package)) { + return new AskUserCommand(request.getEditingDomain(), getPreControlCommandMessage(elem), getPreControlCommandDialogTitle(elem), true, "org.eclipse.papyrus.controlmode.umlprofiles.participants.UMLProfileParticipant.openstandalonemodeldialog"); //$NON-NLS-1$ + } + return null; + } + + public ICommand getPreUncontrolCommand(ControlModeRequest request) { + CompositeCommand cc = new CompositeCommand(PRE_UNCONTROL_COMMAND_LABEL); + // Copy profile application + if (request.getTargetObject() instanceof Package) { + cc.compose(getRemoveProfileApplication(request)); + } + cc.compose(getMoveStereotypeCommand(request)); + return cc; + } + + public int getPriority() { + return 100; + } + + protected String getPreControlCommandDialogTitle(Element elem) { + return Messages.UMLProfileControlParticipant_controlmode_dialog_title; + } + + public boolean provideControlCommand(ControlModeRequest request) { + return request.getTargetObject() instanceof Element; + } + + public boolean provideUnControlCommand(ControlModeRequest request) { + return request.getTargetObject() instanceof Element; + } +} diff --git a/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/messages.properties b/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/messages.properties index be9e8936ff9..ca1885c7ef6 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/messages.properties +++ b/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/messages.properties @@ -1,5 +1,10 @@ -switch_loading_strategy=<form>The following controlled packages are not loaded :{0}In order to change profile application, will you switch to the default loading strategy ? Otherwise, the operation will be canceled.</form>
-error_readonly=<form>The following packages are in a read-only resource :{0}You can not change profile application without updating them. Please ensure the containing resource is writeable before trying again.</form>
-error_during_validation=An unexpected exception occurred during profile application duplication check.
-warning_cannot_delete_duplicated=The profile application on {0} has not be deleted since it has been copied from {1} during controlling. Delete this one's instead.
-warning_cannot_delete_duplicated_alt=The profile application on {0} has not be deleted since it has been copied from a package in main resource during controlling. Delete this one's instead.
+switch_loading_strategy=<form>The following controlled packages are not loaded :{0}In order to change profile application, will you switch to the default loading strategy ? Otherwise, the operation will be canceled.</form> +error_readonly=<form>The following packages are in a read-only resource :{0}You can not change profile application without updating them. Please ensure the containing resource is writeable before trying again.</form> +error_during_validation=An unexpected exception occurred during profile application duplication check. +UMLProfileControlParticipant_controlmode_dialog_message=This selected element is not a UML Package. Due to a UML restrictions the newly created model fragment is not directly modifiable. You can only edit the fragment via the parent model. +UMLProfileControlParticipant_controlmode_dialog_title=Warning: Selected element is not a UML Package +UMLProfileControlParticipant_Post_Control_Command_Label=Composite command for control command [UML Part] +UMLProfileControlParticipant_Post_Uncontrol_Command_Label=Composite command for uncontrol command [UML Part] +UMLProfileControlParticipant_Pre_Uncontrol_Command_Label=Composite command for pre uncontrol command [UML Part] +warning_cannot_delete_duplicated=The profile application on {0} has not be deleted since it has been copied from {1} during controlling. Delete this one's instead. +warning_cannot_delete_duplicated_alt=The profile application on {0} has not be deleted since it has been copied from a package in main resource during controlling. Delete this one's instead. diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/plugin.xml b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/plugin.xml index 5fb47fd1cfc..885d1e096f9 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/plugin.xml +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/plugin.xml @@ -542,7 +542,7 @@ TODO: PAPYRUS EMF-FACET update uiCustom Here <command commandId="org.eclipse.papyrus.infra.services.controlmode.createsubmodel" icon="icons/CreateSubModel_16.png" - label="Create submodel unit" + label="Create Submodel" style="push" tooltip="Move this submodel into its own resource (file)"> <visibleWhen @@ -560,7 +560,7 @@ TODO: PAPYRUS EMF-FACET update uiCustom Here <command commandId="org.eclipse.papyrus.infra.services.controlmode.reintegratesubmodel" icon="icons/ReintegrateSubModel_16.png" - label="Reintegrate submodel unit into parent model" + label="Reintegrate Submodel" style="push" tooltip="Reintegrate this submodel into the resource (file) of the parent model"> <visibleWhen |