Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLBaseItemSemanticEditPolicy.java')
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLBaseItemSemanticEditPolicy.java94
1 files changed, 48 insertions, 46 deletions
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLBaseItemSemanticEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLBaseItemSemanticEditPolicy.java
index ec1a76a1564..0387a764619 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLBaseItemSemanticEditPolicy.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLBaseItemSemanticEditPolicy.java
@@ -58,18 +58,21 @@ import org.eclipse.uml2.uml.MessageEnd;
@SuppressWarnings("all")
// disable warnings on generated code
public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
+
/**
* Extended request data key to hold editpart visual id.
*
* @generated
*/
public static final String VISUAL_ID_KEY = "visual_id"; //$NON-NLS-1$
+
/**
* Extended request data key to hold the edge view during a reconnect request.
*
* @generated
*/
public static final String GRAPHICAL_RECONNECTED_EDGE = "graphical_edge"; //$NON-NLS-1$
+
/**
* @generated
*/
@@ -94,10 +97,10 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
@Override
@SuppressWarnings("unchecked")
public Command getCommand(final Request request) {
- if (request instanceof ReconnectRequest) {
- final Object view = ((ReconnectRequest) request).getConnectionEditPart().getModel();
- if (view instanceof View) {
- final Integer id = new Integer(UMLVisualIDRegistry.getVisualID((View) view));
+ if(request instanceof ReconnectRequest) {
+ final Object view = ((ReconnectRequest)request).getConnectionEditPart().getModel();
+ if(view instanceof View) {
+ final Integer id = new Integer(UMLVisualIDRegistry.getVisualID((View)view));
request.getExtendedData().put(VISUAL_ID_KEY, id);
request.getExtendedData().put(GRAPHICAL_RECONNECTED_EDGE, view);
}
@@ -112,7 +115,7 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
*/
protected int getVisualID(final IEditCommandRequest request) {
final Object id = request.getParameter(VISUAL_ID_KEY);
- return id instanceof Integer ? ((Integer) id).intValue() : -1;
+ return id instanceof Integer ? ((Integer)id).intValue() : -1;
}
/**
@@ -123,8 +126,8 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
final IEditCommandRequest completedRequest = completeRequest(request);
Command semanticCommand = getSemanticCommandSwitch(completedRequest);
semanticCommand = getEditHelperCommand(completedRequest, semanticCommand);
- if (completedRequest instanceof DestroyRequest) {
- final DestroyRequest destroyRequest = (DestroyRequest) completedRequest;
+ if(completedRequest instanceof DestroyRequest) {
+ final DestroyRequest destroyRequest = (DestroyRequest)completedRequest;
return shouldProceed(destroyRequest) ? addDeleteViewCommand(semanticCommand, destroyRequest) : null;
}
return semanticCommand;
@@ -134,7 +137,7 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
* @generated
*/
protected Command addDeleteViewCommand(final Command mainCommand, final DestroyRequest completedRequest) {
- final Command deleteViewCommand = getGEFWrapper(new DeleteCommand(getEditingDomain(), (View) getHost().getModel()));
+ final Command deleteViewCommand = getGEFWrapper(new DeleteCommand(getEditingDomain(), (View)getHost().getModel()));
return mainCommand == null ? deleteViewCommand : mainCommand.chain(deleteViewCommand);
}
@@ -142,9 +145,8 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
* @generated
*/
private Command getEditHelperCommand(final IEditCommandRequest request, final Command editPolicyCommand) {
- if (editPolicyCommand != null) {
- final ICommand command = editPolicyCommand instanceof ICommandProxy ? ((ICommandProxy) editPolicyCommand).getICommand() : new CommandProxy(
- editPolicyCommand);
+ if(editPolicyCommand != null) {
+ final ICommand command = editPolicyCommand instanceof ICommandProxy ? ((ICommandProxy)editPolicyCommand).getICommand() : new CommandProxy(editPolicyCommand);
request.setParameter(GeneratedEditHelperBase.EDIT_POLICY_COMMAND, command);
}
final IElementType requestContextElementType = getContextElementType(request);
@@ -152,8 +154,8 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
ICommand command = requestContextElementType.getEditCommand(request);
request.setParameter(GeneratedEditHelperBase.EDIT_POLICY_COMMAND, null);
request.setParameter(GeneratedEditHelperBase.CONTEXT_ELEMENT_TYPE, null);
- if (command != null) {
- if (!(command instanceof CompositeTransactionalCommand)) {
+ if(command != null) {
+ if(!(command instanceof CompositeTransactionalCommand)) {
command = new CompositeTransactionalCommand(getEditingDomain(), command.getLabel()).compose(command);
}
return new ICommandProxy(command);
@@ -173,28 +175,28 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
* @generated
*/
protected Command getSemanticCommandSwitch(final IEditCommandRequest req) {
- if (req instanceof CreateRelationshipRequest) {
- return getCreateRelationshipCommand((CreateRelationshipRequest) req);
- } else if (req instanceof CreateElementRequest) {
- return getCreateCommand((CreateElementRequest) req);
- } else if (req instanceof ConfigureRequest) {
- return getConfigureCommand((ConfigureRequest) req);
- } else if (req instanceof DestroyElementRequest) {
- return getDestroyElementCommand((DestroyElementRequest) req);
- } else if (req instanceof DestroyReferenceRequest) {
- return getDestroyReferenceCommand((DestroyReferenceRequest) req);
- } else if (req instanceof DuplicateElementsRequest) {
- return getDuplicateCommand((DuplicateElementsRequest) req);
- } else if (req instanceof GetEditContextRequest) {
- return getEditContextCommand((GetEditContextRequest) req);
- } else if (req instanceof MoveRequest) {
- return getMoveCommand((MoveRequest) req);
- } else if (req instanceof ReorientReferenceRelationshipRequest) {
- return getReorientReferenceRelationshipCommand((ReorientReferenceRelationshipRequest) req);
- } else if (req instanceof ReorientRelationshipRequest) {
- return getReorientRelationshipCommand((ReorientRelationshipRequest) req);
- } else if (req instanceof SetRequest) {
- return getSetCommand((SetRequest) req);
+ if(req instanceof CreateRelationshipRequest) {
+ return getCreateRelationshipCommand((CreateRelationshipRequest)req);
+ } else if(req instanceof CreateElementRequest) {
+ return getCreateCommand((CreateElementRequest)req);
+ } else if(req instanceof ConfigureRequest) {
+ return getConfigureCommand((ConfigureRequest)req);
+ } else if(req instanceof DestroyElementRequest) {
+ return getDestroyElementCommand((DestroyElementRequest)req);
+ } else if(req instanceof DestroyReferenceRequest) {
+ return getDestroyReferenceCommand((DestroyReferenceRequest)req);
+ } else if(req instanceof DuplicateElementsRequest) {
+ return getDuplicateCommand((DuplicateElementsRequest)req);
+ } else if(req instanceof GetEditContextRequest) {
+ return getEditContextCommand((GetEditContextRequest)req);
+ } else if(req instanceof MoveRequest) {
+ return getMoveCommand((MoveRequest)req);
+ } else if(req instanceof ReorientReferenceRelationshipRequest) {
+ return getReorientReferenceRelationshipCommand((ReorientReferenceRelationshipRequest)req);
+ } else if(req instanceof ReorientRelationshipRequest) {
+ return getReorientRelationshipCommand((ReorientRelationshipRequest)req);
+ } else if(req instanceof SetRequest) {
+ return getSetCommand((SetRequest)req);
}
return null;
}
@@ -227,7 +229,7 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
*/
protected Command getExtendedTypeCreationCommand(final CreateElementRequest request, final IExtendedHintedElementType requestElementType) {
final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(request.getContainer());
- if (provider == null) {
+ if(provider == null) {
return UnexecutableCommand.INSTANCE;
}
// Retrieve create command from the Element Edit service
@@ -240,7 +242,7 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
*/
protected Command getExtendedStartCreateRelationshipCommand(final CreateElementRequest request, final IExtendedHintedElementType requestElementType) {
final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(requestElementType);
- if (provider == null) {
+ if(provider == null) {
return UnexecutableCommand.INSTANCE;
}
// Retrieve create command from the Element Edit service
@@ -253,7 +255,7 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
*/
protected Command getExtendedCompleteCreateRelationshipCommand(final CreateElementRequest request, final IExtendedHintedElementType requestElementType) {
final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(requestElementType);
- if (provider == null) {
+ if(provider == null) {
return UnexecutableCommand.INSTANCE;
}
// Retrieve create command from the Element Edit service
@@ -303,11 +305,11 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
protected Command getMoveCommand(final MoveRequest req) {
final EObject targetCEObject = req.getTargetContainer();
- if (targetCEObject != null) {
+ if(targetCEObject != null) {
final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(targetCEObject);
- if (provider != null) {
+ if(provider != null) {
final ICommand moveCommand = provider.getEditCommand(req);
- if (moveCommand != null) {
+ if(moveCommand != null) {
return new ICommandProxy(moveCommand);
}
}
@@ -345,7 +347,7 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
* @generated
*/
protected TransactionalEditingDomain getEditingDomain() {
- return ((IGraphicalEditPart) getHost()).getEditingDomain();
+ return ((IGraphicalEditPart)getHost()).getEditingDomain();
}
/**
@@ -355,9 +357,9 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
*/
protected void addDestroyShortcutsCommand(final ICompositeCommand cmd, final View view) {
assert view.getEAnnotation("Shortcut") == null; //$NON-NLS-1$
- for (final Iterator it = view.getDiagram().getChildren().iterator(); it.hasNext();) {
- final View nextView = (View) it.next();
- if (nextView.getEAnnotation("Shortcut") == null || !nextView.isSetElement() || nextView.getElement() != view.getElement()) { //$NON-NLS-1$
+ for(final Iterator it = view.getDiagram().getChildren().iterator(); it.hasNext();) {
+ final View nextView = (View)it.next();
+ if(nextView.getEAnnotation("Shortcut") == null || !nextView.isSetElement() || nextView.getElement() != view.getElement()) { //$NON-NLS-1$
continue;
}
cmd.add(new DeleteCommand(getEditingDomain(), nextView));
@@ -369,7 +371,7 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
*/
public static LinkConstraints getLinkConstraints() {
LinkConstraints cached = UMLDiagramEditorPlugin.getInstance().getLinkConstraints();
- if (cached == null) {
+ if(cached == null) {
UMLDiagramEditorPlugin.getInstance().setLinkConstraints(cached = new LinkConstraints());
}
return cached;

Back to the top