Java Code Examples for org.eclipse.gmf.runtime.common.core.command.ICommand#canExecute()

The following examples show how to use org.eclipse.gmf.runtime.common.core.command.ICommand#canExecute() . 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: CsvSourceCreateCommand.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
* @generated
*/
protected void doConfigure(CsvSource newElement, IProgressMonitor monitor, IAdaptable info)
		throws ExecutionException {
	IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
	ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
	configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
	configureRequest.addParameters(getRequest().getParameters());
	ICommand configureCommand = elementType.getEditCommand(configureRequest);
	if (configureCommand != null && configureCommand.canExecute()) {
		configureCommand.execute(monitor, info);
	}
}
 
Example 2
Source File: ANDGateway2CreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void doConfigure(ANDGateway newElement, IProgressMonitor monitor, IAdaptable info)
		throws ExecutionException {
	IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
	ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
	configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
	configureRequest.addParameters(getRequest().getParameters());
	ICommand configureCommand = elementType.getEditCommand(configureRequest);
	if (configureCommand != null && configureCommand.canExecute()) {
		configureCommand.execute(monitor, info);
	}
}
 
Example 3
Source File: BoundaryMessageEventCreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void doConfigure(BoundaryMessageEvent newElement, IProgressMonitor monitor, IAdaptable info)
		throws ExecutionException {
	IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
	ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
	configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
	configureRequest.addParameters(getRequest().getParameters());
	ICommand configureCommand = elementType.getEditCommand(configureRequest);
	if (configureCommand != null && configureCommand.canExecute()) {
		configureCommand.execute(monitor, info);
	}
}
 
Example 4
Source File: TextAnnotationAttachmentCreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void doConfigure(TextAnnotationAttachment newElement, IProgressMonitor monitor, IAdaptable info)
		throws ExecutionException {
	IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
	ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
	configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
	configureRequest.addParameters(getRequest().getParameters());
	configureRequest.setParameter(CreateRelationshipRequest.SOURCE, getSource());
	configureRequest.setParameter(CreateRelationshipRequest.TARGET, getTarget());
	ICommand configureCommand = elementType.getEditCommand(configureRequest);
	if (configureCommand != null && configureCommand.canExecute()) {
		configureCommand.execute(monitor, info);
	}
}
 
Example 5
Source File: XORGatewayCreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void doConfigure(XORGateway newElement, IProgressMonitor monitor, IAdaptable info)
		throws ExecutionException {
	IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
	ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
	configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
	configureRequest.addParameters(getRequest().getParameters());
	ICommand configureCommand = elementType.getEditCommand(configureRequest);
	if (configureCommand != null && configureCommand.canExecute()) {
		configureCommand.execute(monitor, info);
	}
}
 
Example 6
Source File: EndTerminatedEvent2CreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void doConfigure(EndTerminatedEvent newElement, IProgressMonitor monitor, IAdaptable info)
		throws ExecutionException {
	IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
	ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
	configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
	configureRequest.addParameters(getRequest().getParameters());
	ICommand configureCommand = elementType.getEditCommand(configureRequest);
	if (configureCommand != null && configureCommand.canExecute()) {
		configureCommand.execute(monitor, info);
	}
}
 
Example 7
Source File: StartTimerEventCreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void doConfigure(StartTimerEvent newElement, IProgressMonitor monitor, IAdaptable info)
		throws ExecutionException {
	IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
	ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
	configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
	configureRequest.addParameters(getRequest().getParameters());
	ICommand configureCommand = elementType.getEditCommand(configureRequest);
	if (configureCommand != null && configureCommand.canExecute()) {
		configureCommand.execute(monitor, info);
	}
}
 
Example 8
Source File: ReceiveTaskCreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void doConfigure(ReceiveTask newElement, IProgressMonitor monitor, IAdaptable info)
		throws ExecutionException {
	IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
	ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
	configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
	configureRequest.addParameters(getRequest().getParameters());
	ICommand configureCommand = elementType.getEditCommand(configureRequest);
	if (configureCommand != null && configureCommand.canExecute()) {
		configureCommand.execute(monitor, info);
	}
}
 
Example 9
Source File: XORGateway2CreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void doConfigure(XORGateway newElement, IProgressMonitor monitor, IAdaptable info)
		throws ExecutionException {
	IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
	ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
	configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
	configureRequest.addParameters(getRequest().getParameters());
	ICommand configureCommand = elementType.getEditCommand(configureRequest);
	if (configureCommand != null && configureCommand.canExecute()) {
		configureCommand.execute(monitor, info);
	}
}
 
Example 10
Source File: ScriptTask2CreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void doConfigure(ScriptTask newElement, IProgressMonitor monitor, IAdaptable info)
		throws ExecutionException {
	IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
	ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
	configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
	configureRequest.addParameters(getRequest().getParameters());
	ICommand configureCommand = elementType.getEditCommand(configureRequest);
	if (configureCommand != null && configureCommand.canExecute()) {
		configureCommand.execute(monitor, info);
	}
}
 
Example 11
Source File: StartEventCreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void doConfigure(StartEvent newElement, IProgressMonitor monitor, IAdaptable info)
		throws ExecutionException {
	IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
	ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
	configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
	configureRequest.addParameters(getRequest().getParameters());
	ICommand configureCommand = elementType.getEditCommand(configureRequest);
	if (configureCommand != null && configureCommand.canExecute()) {
		configureCommand.execute(monitor, info);
	}
}
 
Example 12
Source File: EndSignalEvent2CreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void doConfigure(EndSignalEvent newElement, IProgressMonitor monitor, IAdaptable info)
		throws ExecutionException {
	IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
	ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
	configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
	configureRequest.addParameters(getRequest().getParameters());
	ICommand configureCommand = elementType.getEditCommand(configureRequest);
	if (configureCommand != null && configureCommand.canExecute()) {
		configureCommand.execute(monitor, info);
	}
}
 
Example 13
Source File: BoundarySignalEventCreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void doConfigure(BoundarySignalEvent newElement, IProgressMonitor monitor, IAdaptable info)
		throws ExecutionException {
	IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
	ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
	configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
	configureRequest.addParameters(getRequest().getParameters());
	ICommand configureCommand = elementType.getEditCommand(configureRequest);
	if (configureCommand != null && configureCommand.canExecute()) {
		configureCommand.execute(monitor, info);
	}
}
 
Example 14
Source File: StartSignalEventCreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void doConfigure(StartSignalEvent newElement, IProgressMonitor monitor, IAdaptable info)
		throws ExecutionException {
	IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
	ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
	configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
	configureRequest.addParameters(getRequest().getParameters());
	ICommand configureCommand = elementType.getEditCommand(configureRequest);
	if (configureCommand != null && configureCommand.canExecute()) {
		configureCommand.execute(monitor, info);
	}
}
 
Example 15
Source File: IntermediateCatchMessageEventCreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void doConfigure(IntermediateCatchMessageEvent newElement, IProgressMonitor monitor, IAdaptable info)
		throws ExecutionException {
	IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
	ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
	configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
	configureRequest.addParameters(getRequest().getParameters());
	ICommand configureCommand = elementType.getEditCommand(configureRequest);
	if (configureCommand != null && configureCommand.canExecute()) {
		configureCommand.execute(monitor, info);
	}
}
 
Example 16
Source File: IntermediateErrorCatchEvent4CreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void doConfigure(IntermediateErrorCatchEvent newElement, IProgressMonitor monitor, IAdaptable info)
		throws ExecutionException {
	IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
	ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
	configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
	configureRequest.addParameters(getRequest().getParameters());
	ICommand configureCommand = elementType.getEditCommand(configureRequest);
	if (configureCommand != null && configureCommand.canExecute()) {
		configureCommand.execute(monitor, info);
	}
}
 
Example 17
Source File: SinkCreateCommand.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
* @generated
*/
protected void doConfigure(Sink newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
	IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
	ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
	configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
	configureRequest.addParameters(getRequest().getParameters());
	ICommand configureCommand = elementType.getEditCommand(configureRequest);
	if (configureCommand != null && configureCommand.canExecute()) {
		configureCommand.execute(monitor, info);
	}
}
 
Example 18
Source File: IntermediateCatchTimerEvent2CreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void doConfigure(IntermediateCatchTimerEvent newElement, IProgressMonitor monitor, IAdaptable info)
		throws ExecutionException {
	IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
	ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
	configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
	configureRequest.addParameters(getRequest().getParameters());
	ICommand configureCommand = elementType.getEditCommand(configureRequest);
	if (configureCommand != null && configureCommand.canExecute()) {
		configureCommand.execute(monitor, info);
	}
}
 
Example 19
Source File: SubProcessEvent2CreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void doConfigure(SubProcessEvent newElement, IProgressMonitor monitor, IAdaptable info)
		throws ExecutionException {
	IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
	ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
	configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
	configureRequest.addParameters(getRequest().getParameters());
	ICommand configureCommand = elementType.getEditCommand(configureRequest);
	if (configureCommand != null && configureCommand.canExecute()) {
		configureCommand.execute(monitor, info);
	}
}
 
Example 20
Source File: InsertElementOnSequenceFlowCommand.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@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();
}