Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvlorenzo2013-10-29 08:27:11 -0400
committervlorenzo2013-10-29 08:35:28 -0400
commit11219b27ab7d7ea66185f66cf0d3e0b86b66ddff (patch)
tree888de8918cf391c28a4953aa1b0f2da12a433521 /plugins
parent04caaa84af4bf014068fc95504fb37f3b00744be (diff)
downloadorg.eclipse.papyrus-11219b27ab7d7ea66185f66cf0d3e0b86b66ddff.tar.gz
org.eclipse.papyrus-11219b27ab7d7ea66185f66cf0d3e0b86b66ddff.tar.xz
org.eclipse.papyrus-11219b27ab7d7ea66185f66cf0d3e0b86b66ddff.zip
418586: [Connector] [UML] [SysML] [CompositeStructureDiagram] Problems
with UML/SysML Connector https://bugs.eclipse.org/bugs/show_bug.cgi?id=418586 Modify the advice helper to be able to set the role of a connector end to null!
Diffstat (limited to 'plugins')
-rw-r--r--plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/advice/ConnectorEditHelperAdvice.java17
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/command/ConnectorReorientCommand.java6
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/command/ConnectorReorientSemanticCommand.java3
3 files changed, 19 insertions, 7 deletions
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/advice/ConnectorEditHelperAdvice.java b/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/advice/ConnectorEditHelperAdvice.java
index e77dd0d7568..14fd4fe1c5c 100644
--- a/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/advice/ConnectorEditHelperAdvice.java
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/advice/ConnectorEditHelperAdvice.java
@@ -78,7 +78,10 @@ public class ConnectorEditHelperAdvice extends AbstractEditHelperAdvice {
int reorientDirection = request.getDirection();
Edge reorientedEdgeView = RequestParameterUtils.getReconnectedEdge(request);
View newEndView = RequestParameterUtils.getReconnectedEndView(request);
- View oppositeEndView = (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) ? reorientedEdgeView.getTarget() : reorientedEdgeView.getSource();
+ View oppositeEndView = null;
+ if(reorientedEdgeView != null) {
+ oppositeEndView = (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) ? reorientedEdgeView.getTarget() : reorientedEdgeView.getSource();
+ }
List<Property> newNestedPath = null;
if(reorientedEdgeView != null && newEndView != null) {
//we are working with a 'graphical' reconnect request
@@ -99,11 +102,13 @@ public class ConnectorEditHelperAdvice extends AbstractEditHelperAdvice {
} else if(reorientDirection == ReorientReferenceRelationshipRequest.REORIENT_TARGET) {
oldEndView = current.getTarget();
}
- final List<Property> oldNestedPath = utils.getNestedPropertyPath(oldEndView, oppositeEndView);
- if(!newNestedPath.equals(oldNestedPath)) {
- final DestroyElementRequest destroyRequest = new DestroyElementRequest(request.getEditingDomain(), current, false);
- final IElementEditService commandProvider = ElementEditServiceUtils.getCommandProvider(current);
- compositeCommand.add(commandProvider.getEditCommand(destroyRequest));
+ if(oppositeEndView != null) {
+ final List<Property> oldNestedPath = utils.getNestedPropertyPath(oldEndView, oppositeEndView);
+ if(!newNestedPath.equals(oldNestedPath)) {
+ final DestroyElementRequest destroyRequest = new DestroyElementRequest(request.getEditingDomain(), current, false);
+ final IElementEditService commandProvider = ElementEditServiceUtils.getCommandProvider(current);
+ compositeCommand.add(commandProvider.getEditCommand(destroyRequest));
+ }
}
}
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/command/ConnectorReorientCommand.java b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/command/ConnectorReorientCommand.java
index 47fcabd0b7a..96a464caf0d 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/command/ConnectorReorientCommand.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/command/ConnectorReorientCommand.java
@@ -77,7 +77,11 @@ public class ConnectorReorientCommand extends ConnectorReorientSemanticCommand {
super.initFields();
reorientedEdgeView = RequestParameterUtils.getReconnectedEdge(getRequest());
newEndView = RequestParameterUtils.getReconnectedEndView(getRequest());
- oppositeEndView = (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) ? reorientedEdgeView.getTarget() : reorientedEdgeView.getSource();
+ if(this.reorientedEdgeView != null) {
+ oppositeEndView = (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) ? reorientedEdgeView.getTarget() : reorientedEdgeView.getSource();
+ } else {
+ oppositeEndView = null;
+ }
setNewPartWithPort(getNewPartWithPort());
setOppositePartWithPort(getOppositePartWithPort());
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/command/ConnectorReorientSemanticCommand.java b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/command/ConnectorReorientSemanticCommand.java
index f7887f3568e..1fa6881f9ee 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/command/ConnectorReorientSemanticCommand.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/command/ConnectorReorientSemanticCommand.java
@@ -136,6 +136,9 @@ public class ConnectorReorientSemanticCommand extends EditElementCommand {
* <code>true</code> if the newRole can be used as role for connector
*/
private boolean canReorient(final EObject newRole, final EObject oppositeRole) {
+ if(newRole==null){
+ return true;//we allow to reinitialize the role
+ }
//the new role must be a connectable element
if(!(newRole instanceof ConnectableElement)) {
return false;

Back to the top