Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOnder GURCAN2016-01-05 14:40:57 +0000
committerOnder Gurcan2016-01-06 12:49:30 +0000
commit9ea592c056e4782a66b38f9941d3797af2dfb956 (patch)
tree8155ed069e442cde7b16e57372fa15e65037d458 /plugins/infra/services/org.eclipse.papyrus.infra.services.edit
parentfc06e2bba73aa5f351575fc33e5d1d9c30fda6ba (diff)
downloadorg.eclipse.papyrus-9ea592c056e4782a66b38f9941d3797af2dfb956.tar.gz
org.eclipse.papyrus-9ea592c056e4782a66b38f9941d3797af2dfb956.tar.xz
org.eclipse.papyrus-9ea592c056e4782a66b38f9941d3797af2dfb956.zip
Bug 485215 - Not possible to make cancellable EditionDialog via
Change-Id: I38e7945ba08f05d84711e8d8037831f26ea0f50f Signed-off-by: Onder GURCAN <onder.gurcan@cea.fr>
Diffstat (limited to 'plugins/infra/services/org.eclipse.papyrus.infra.services.edit')
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.edit/src/org/eclipse/papyrus/infra/services/edit/utils/ElementTypeUtils.java32
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.edit/src/org/eclipse/papyrus/infra/services/edit/utils/RequestParameterConstants.java5
2 files changed, 37 insertions, 0 deletions
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.edit/src/org/eclipse/papyrus/infra/services/edit/utils/ElementTypeUtils.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.edit/src/org/eclipse/papyrus/infra/services/edit/utils/ElementTypeUtils.java
index 469b0fe6007..07f40d2f92b 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.edit/src/org/eclipse/papyrus/infra/services/edit/utils/ElementTypeUtils.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.edit/src/org/eclipse/papyrus/infra/services/edit/utils/ElementTypeUtils.java
@@ -98,6 +98,26 @@ public class ElementTypeUtils {
return true; // Default
}
+
+ /**
+ * return a boolean about the cancellability of a diagram for edition of an Element
+ *
+ * @param request
+ * an edition request
+ * @return true if the request do not contain information about cancellability
+ */
+ public static boolean dialogCancellable(IEditCommandRequest request) {
+ Object value = request.getParameter(RequestParameterConstants.DIALOG_CANCELLABLE);
+
+ if (value instanceof Boolean) {
+ return (Boolean) value;
+ } else if (value instanceof String) {
+ Boolean booleanObject = Boolean.valueOf((String) value);
+ return booleanObject.booleanValue();
+ }
+
+ return false; // Default
+ }
/**
* Configure a request to specify whether the GUI should be used or not.
@@ -110,5 +130,17 @@ public class ElementTypeUtils {
public static void setUseGUI(IEditCommandRequest request, boolean useGUI) {
request.setParameter(RequestParameterConstants.USE_GUI, useGUI);
}
+
+ /**
+ * Configure a request to specify whether the editdialog should be cancellable or not.
+ *
+ * If set to false, dialogs shouldn't be cancellable during the execution of the associated command(s)
+ *
+ * @param request
+ * @param dialogCancellable
+ */
+ public static void setDialogCancellable(IEditCommandRequest request, boolean dialogCancellable) {
+ request.setParameter(RequestParameterConstants.DIALOG_CANCELLABLE, dialogCancellable);
+ }
} \ No newline at end of file
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.edit/src/org/eclipse/papyrus/infra/services/edit/utils/RequestParameterConstants.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.edit/src/org/eclipse/papyrus/infra/services/edit/utils/RequestParameterConstants.java
index d54e724c9c6..b5429f9cff4 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.edit/src/org/eclipse/papyrus/infra/services/edit/utils/RequestParameterConstants.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.edit/src/org/eclipse/papyrus/infra/services/edit/utils/RequestParameterConstants.java
@@ -146,6 +146,11 @@ public interface RequestParameterConstants {
* Constant used to indicate where the action is done.
*/
public static final String TYPE_MOVING = "TYPE_MOVING"; //$NON-NLS-1$
+
+ /**
+ * this constant is used to precise if it is needed to make the editdialog cancellable or not
+ */
+ public static String DIALOG_CANCELLABLE = "DIALOG_CANCELLABLE"; //$NON-NLS-1$
//
// Nested types

Back to the top