Java Code Examples for org.eclipse.gef.RequestConstants#REQ_RECONNECT_TARGET
The following examples show how to use
org.eclipse.gef.RequestConstants#REQ_RECONNECT_TARGET .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InsertElementOnSequenceFlowCommand.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override protected CommandResult doUndoWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException { if (setBendpointsCmdForOriginalEdge != null) { setBendpointsCmdForOriginalEdge.undo(monitor, info); } if (createConnectionCommand != null) { createConnectionCommand.undo(monitor, info); } if (targetEditPart instanceof ConnectionEditPart && originalTargetEditPart != null) { final ReconnectRequest reconnect = new ReconnectRequest(RequestConstants.REQ_RECONNECT_TARGET); reconnect.setConnectionEditPart((ConnectionEditPart) targetEditPart); reconnect.setTargetEditPart(originalTargetEditPart); final CompoundCommand reconnectCommand = (CompoundCommand) originalTargetEditPart.getCommand(reconnect); final CompoundCommand ccc = (CompoundCommand) reconnectCommand.getChildren()[1]; for (final Object proxy : ccc.getChildren()) { if (proxy instanceof ICommandProxy) { ((ICommandProxy) proxy).getICommand().execute(monitor, info); } } } if (correctOffset && correctOffsetCmd != null && correctOffsetCmd.canUndo()) { correctOffsetCmd.undo(monitor, info); } if (creationCommand != null && creationCommand.canUndo()) { creationCommand.undo(); creationCommand.dispose(); } return CommandResult.newOKCommandResult(); }
Example 2
Source File: InsertElementOnSequenceFlowCommand.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
@Override protected CommandResult doExecuteWithResult( final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException { if (targetEditPart instanceof ConnectionEditPart) { final ConnectionEditPart targetConnectionEditPart = (ConnectionEditPart) targetEditPart; for (final Iterator i = objects.iterator(); i.hasNext();) { final Object object = i.next(); if (object instanceof ViewAndElementDescriptor) { final ViewAndElementDescriptor descriptor = (ViewAndElementDescriptor) object; final ShapeEditPart editPart = (ShapeEditPart) epRegistry.get(descriptor.getAdapter(View.class)); final Bounds b = (Bounds) ((Node) editPart.getNotationView()).getLayoutConstraint(); correctOffsetCmd = new SetBoundsCommand(editPart.getEditingDomain(), "", descriptor, new Point(b.getX() - 25, b.getY() - 25)); final ReconnectRequest reconnect = new ReconnectRequest(RequestConstants.REQ_RECONNECT_TARGET); reconnect.setConnectionEditPart(targetConnectionEditPart); reconnect.setTargetEditPart(editPart); final CompoundCommand reconnectCommand = (CompoundCommand) editPart.getCommand(reconnect); final CreateConnectionViewAndElementRequest connectionRequest = new CreateConnectionViewAndElementRequest( BonitaConnectionTypes.getElementType("org.bonitasoft.studio.diagram.SequenceFlow_4001"), ((IHintedType) BonitaConnectionTypes.getElementType("org.bonitasoft.studio.diagram.SequenceFlow_4001")).getSemanticHint(), new PreferencesHint("org.bonitasoft.studio.diagram")); originalTargetEditPart = targetConnectionEditPart.getTarget(); createConnectionCommand = new DeferredCreateConnectionViewAndElementCommand(connectionRequest, descriptor, originalTargetEditPart, editPart.getViewer()); if (correctOffset) { correctOffsetCmd.execute(monitor, info); } final CompoundCommand ccc = (CompoundCommand) reconnectCommand.getChildren()[1]; for (final Object proxy : ccc.getChildren()) { if (proxy instanceof ICommandProxy) { final ICommand iCommand = ((ICommandProxy) proxy).getICommand(); if (iCommand.canExecute()) { iCommand.execute(monitor, info); } } } createConnectionCommand.execute(monitor, info); if (connectionRequest != null) { final ConnectionViewAndElementDescriptor connectionDescriptor = (ConnectionViewAndElementDescriptor) connectionRequest.getNewObject(); final Connector edge = (Connector) connectionDescriptor.getAdapter(Edge.class); final org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart connectionEP = (org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart) editPart .getViewer().getEditPartRegistry().get(edge); if (connectionEP != null) { final TransactionalEditingDomain editingDomain = connectionEP.getEditingDomain(); setBendpointsCmdForNewEdge = createSetBendpointsCommand(monitor, info, edge, editingDomain); setBendpointsCmdForNewEdge.execute(monitor, info); setBendpointsCmdForOriginalEdge = createSetBendpointsCommand(monitor, info, (Connector) targetEditPart.getNotationView(), editingDomain); setBendpointsCmdForOriginalEdge.execute(monitor, info); } } } } } correctBoundsToAvoidCollisions(monitor, info); return CommandResult.newOKCommandResult(); }