Bug 502175 - [SysML 1.4] [Parametric] Problem when creating a
constraintProperty
- rename should only be present when creating an element
(not refactoring because the naming should be provided
at the end by the core)
Change-Id: Ic2ab2ddf2c5c4e8d9dd381ec15e9278c09ace6ef
Signed-off-by: Benoit Maggi <benoit.maggi@cea.fr>
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.common/src/org/eclipse/papyrus/sysml14/diagram/common/advices/ActorPartGraphicalEditHelperAdvice.java b/diagram/org.eclipse.papyrus.sysml14.diagram.common/src/org/eclipse/papyrus/sysml14/diagram/common/advices/ActorPartGraphicalEditHelperAdvice.java
index d3f1e4a..31b8ec1 100644
--- a/diagram/org.eclipse.papyrus.sysml14.diagram.common/src/org/eclipse/papyrus/sysml14/diagram/common/advices/ActorPartGraphicalEditHelperAdvice.java
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.common/src/org/eclipse/papyrus/sysml14/diagram/common/advices/ActorPartGraphicalEditHelperAdvice.java
@@ -84,8 +84,10 @@
// Create the configure command that will set the constraint property type
ICommand setTypeCommand = new ConfigurePartCommand(request,partType,typeCreationCommand) ;
configureCommand = CompositeCommand.compose(configureCommand, setTypeCommand);
- RenamePostCreationCommand renamePostCreationCommand = new RenamePostCreationCommand(request, newTypeName, typeCreationCommand);
- configureCommand = CompositeCommand.compose(configureCommand, renamePostCreationCommand);
+ if (typeCreationCommand != null && typeCreationCommand.canExecute()) {
+ RenamePostCreationCommand renamePostCreationCommand = new RenamePostCreationCommand(request, newTypeName, typeCreationCommand);
+ configureCommand = CompositeCommand.compose(configureCommand, renamePostCreationCommand);
+ }
} else {
throw new OperationCanceledException("Actor part creation cancelled by user"); //$NON-NLS-1$
}
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.common/src/org/eclipse/papyrus/sysml14/diagram/common/advices/ConstraintPropertyGraphicalEditHelperAdvice.java b/diagram/org.eclipse.papyrus.sysml14.diagram.common/src/org/eclipse/papyrus/sysml14/diagram/common/advices/ConstraintPropertyGraphicalEditHelperAdvice.java
index 7103ead..0e1a6ce 100644
--- a/diagram/org.eclipse.papyrus.sysml14.diagram.common/src/org/eclipse/papyrus/sysml14/diagram/common/advices/ConstraintPropertyGraphicalEditHelperAdvice.java
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.common/src/org/eclipse/papyrus/sysml14/diagram/common/advices/ConstraintPropertyGraphicalEditHelperAdvice.java
@@ -84,8 +84,10 @@
// Create the configure command that will set the constraint property type
ICommand setTypeCommand = new ConfigurePartCommand(request,partType,typeCreationCommand) ;
configureCommand = CompositeCommand.compose(configureCommand, setTypeCommand);
- RenamePostCreationCommand renamePostCreationCommand = new RenamePostCreationCommand(request, newTypeName, typeCreationCommand);
- configureCommand = CompositeCommand.compose(configureCommand, renamePostCreationCommand);
+ if (typeCreationCommand != null && typeCreationCommand.canExecute()) {
+ RenamePostCreationCommand renamePostCreationCommand = new RenamePostCreationCommand(request, newTypeName, typeCreationCommand);
+ configureCommand = CompositeCommand.compose(configureCommand, renamePostCreationCommand);
+ }
} else {
throw new OperationCanceledException("Constraint Property creation cancelled by user"); //$NON-NLS-1$
}
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.common/src/org/eclipse/papyrus/sysml14/diagram/common/advices/CreateOrSelectBlockPropertyTypeEditHelperAdvice.java b/diagram/org.eclipse.papyrus.sysml14.diagram.common/src/org/eclipse/papyrus/sysml14/diagram/common/advices/CreateOrSelectBlockPropertyTypeEditHelperAdvice.java
index 9906b83..843c623 100644
--- a/diagram/org.eclipse.papyrus.sysml14.diagram.common/src/org/eclipse/papyrus/sysml14/diagram/common/advices/CreateOrSelectBlockPropertyTypeEditHelperAdvice.java
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.common/src/org/eclipse/papyrus/sysml14/diagram/common/advices/CreateOrSelectBlockPropertyTypeEditHelperAdvice.java
@@ -83,8 +83,10 @@
// Create the configure command that will set the constraint property type
ICommand setTypeCommand = new ConfigurePartCommand(request,partType,typeCreationCommand) ;
configureCommand = CompositeCommand.compose(configureCommand, setTypeCommand);
- RenamePostCreationCommand renamePostCreationCommand = new RenamePostCreationCommand(request, newTypeName, typeCreationCommand);
- configureCommand = CompositeCommand.compose(configureCommand, renamePostCreationCommand);
+ if (typeCreationCommand != null && typeCreationCommand.canExecute()) {
+ RenamePostCreationCommand renamePostCreationCommand = new RenamePostCreationCommand(request, newTypeName, typeCreationCommand);
+ configureCommand = CompositeCommand.compose(configureCommand, renamePostCreationCommand);
+ }
} else {
throw new OperationCanceledException("Creation cancelled by user"); //$NON-NLS-1$
}
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.common/src/org/eclipse/papyrus/sysml14/diagram/common/advices/ValueEditHelperAdvice.java b/diagram/org.eclipse.papyrus.sysml14.diagram.common/src/org/eclipse/papyrus/sysml14/diagram/common/advices/ValueEditHelperAdvice.java
index c6d4001..0e0a441 100644
--- a/diagram/org.eclipse.papyrus.sysml14.diagram.common/src/org/eclipse/papyrus/sysml14/diagram/common/advices/ValueEditHelperAdvice.java
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.common/src/org/eclipse/papyrus/sysml14/diagram/common/advices/ValueEditHelperAdvice.java
@@ -84,8 +84,10 @@
// Create the configure command that will set the constraint property type
ICommand setTypeCommand = new ConfigurePartCommand(request,partType,typeCreationCommand) ;
configureCommand = CompositeCommand.compose(configureCommand, setTypeCommand);
- RenamePostCreationCommand renamePostCreationCommand = new RenamePostCreationCommand(request, newTypeName, typeCreationCommand);
- configureCommand = CompositeCommand.compose(configureCommand, renamePostCreationCommand);
+ if (typeCreationCommand != null && typeCreationCommand.canExecute()) {
+ RenamePostCreationCommand renamePostCreationCommand = new RenamePostCreationCommand(request, newTypeName, typeCreationCommand);
+ configureCommand = CompositeCommand.compose(configureCommand, renamePostCreationCommand);
+ }
} else {
throw new OperationCanceledException("Value creation cancelled by user"); //$NON-NLS-1$
}