org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest Java Examples

The following examples show how to use org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest. 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: SequenceFlowCreateCommand.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
	if (!canExecute()) {
		throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
	}

	SequenceFlow newElement = ProcessFactory.eINSTANCE.createSequenceFlow();
	getContainer().getConnections().add(newElement);
	newElement.setSource(getSource());
	newElement.setTarget(getTarget());
	ElementInitializers.getInstance().init_SequenceFlow_4001(newElement);
	doConfigure(newElement, monitor, info);
	((CreateElementRequest) getRequest()).setNewElement(newElement);
	return CommandResult.newOKCommandResult(newElement);

}
 
Example #2
Source File: BoundarySignalEvent2CreateCommand.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 #3
Source File: ThrowLinkEvent2CreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
	ThrowLinkEvent newElement = ProcessFactory.eINSTANCE.createThrowLinkEvent();

	Container owner = (Container) getElementToEdit();
	owner.getElements().add(newElement);

	ElementInitializers.getInstance().init_ThrowLinkEvent_3018(newElement);

	doConfigure(newElement, monitor, info);

	((CreateElementRequest) getRequest()).setNewElement(newElement);
	return CommandResult.newOKCommandResult(newElement);
}
 
Example #4
Source File: Event2CreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void doConfigure(Event 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 #5
Source File: ServiceTask2CreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void doConfigure(ServiceTask 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: InclusiveGatewayCreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void doConfigure(InclusiveGateway 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: ProcBuilder.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void addPool(String id, final String name, final String version, final Point location, final Dimension size) throws ProcBuilderException {

    if (diagramPart == null) {
        throw new ProcBuilderException("Impossible to add Pool outside a diagram");
    }

    id = NamingUtils.convertToId(id);
    final ViewAndElementDescriptor viewDescriptor = new ViewAndElementDescriptor(new CreateElementRequestAdapter(new CreateElementRequest(
            ProcessElementTypes.Pool_2007)), Node.class,
            ((IHintedType) ProcessElementTypes.Pool_2007).getSemanticHint(), diagramPart.getDiagramPreferencesHint());
    final CreateViewAndElementRequest createRequest = createCreationRequest(
            location, size, viewDescriptor);
    diagramPart.getDiagramEditDomain().getDiagramCommandStack().execute(diagramPart.getCommand(createRequest));

    final Node newNode = (Node) viewDescriptor.getAdapter(Node.class);
    final Pool pool = (Pool) newNode.getElement();
    commandStack.append(SetCommand.create(editingDomain, pool, ProcessPackage.eINSTANCE.getElement_Name(), name));
    commandStack.append(SetCommand.create(editingDomain, pool, ProcessPackage.eINSTANCE.getAbstractProcess_Version(), version));

    if (size != null) {
        commandStack.append(SetCommand.create(editingDomain, newNode.getLayoutConstraint(), NotationPackage.eINSTANCE.getSize_Width(), size.width));
        commandStack.append(SetCommand.create(editingDomain, newNode.getLayoutConstraint(), NotationPackage.eINSTANCE.getSize_Height(), size.height));
    }
    commandStack.append(SetCommand.create(editingDomain, newNode.getStyle(NotationPackage.eINSTANCE.getLineStyle()),
            NotationPackage.eINSTANCE.getLineStyle_LineColor(), FigureUtilities.colorToInteger(ColorConstants.lightGray)));

    processIds.put(pool, id);
    processes.put(id, pool);
    currentContainer = pool;
    currentStep = pool;
    currentElement = pool;
    currentView = newNode;
    execute();
}
 
Example #8
Source File: StartErrorEventCreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* FIXME: replace with setElementToEdit()
* @generated
*/
protected EObject getElementToEdit() {
	EObject container = ((CreateElementRequest) getRequest()).getContainer();
	if (container instanceof View) {
		container = ((View) container).getElement();
	}
	return container;
}
 
Example #9
Source File: IntermediateThrowMessageEventCreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* FIXME: replace with setElementToEdit()
* @generated
*/
protected EObject getElementToEdit() {
	EObject container = ((CreateElementRequest) getRequest()).getContainer();
	if (container instanceof View) {
		container = ((View) container).getElement();
	}
	return container;
}
 
Example #10
Source File: ReceiveTask2CreateCommand.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 #11
Source File: ServiceTaskCreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void doConfigure(ServiceTask 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: ActivityCreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void doConfigure(Activity 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: IntermediateErrorCatchEvent6CreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* FIXME: replace with setElementToEdit()
* @generated
*/
protected EObject getElementToEdit() {
	EObject container = ((CreateElementRequest) getRequest()).getContainer();
	if (container instanceof View) {
		container = ((View) container).getElement();
	}
	return container;
}
 
Example #14
Source File: ParameterCreateCommand.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
* FIXME: replace with setElementToEdit()
* @generated
*/
protected EObject getElementToEdit() {
	EObject container = ((CreateElementRequest) getRequest()).getContainer();
	if (container instanceof View) {
		container = ((View) container).getElement();
	}
	return container;
}
 
Example #15
Source File: BoundaryMessageEvent2CreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
	BoundaryMessageEvent newElement = ProcessFactory.eINSTANCE.createBoundaryMessageEvent();

	Activity owner = (Activity) getElementToEdit();
	owner.getBoundaryIntermediateEvents().add(newElement);

	ElementInitializers.getInstance().init_BoundaryMessageEvent_3036(newElement);

	doConfigure(newElement, monitor, info);

	((CreateElementRequest) getRequest()).setNewElement(newElement);
	return CommandResult.newOKCommandResult(newElement);
}
 
Example #16
Source File: TaskCreateCommand.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
* @generated
*/
protected void doConfigure(Task 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: StartErrorEventCreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
	StartErrorEvent newElement = ProcessFactory.eINSTANCE.createStartErrorEvent();

	Container owner = (Container) getElementToEdit();
	owner.getElements().add(newElement);

	ElementInitializers.getInstance().init_StartErrorEvent_2033(newElement);

	doConfigure(newElement, monitor, info);

	((CreateElementRequest) getRequest()).setNewElement(newElement);
	return CommandResult.newOKCommandResult(newElement);
}
 
Example #18
Source File: IntermediateThrowSignalEvent2CreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* FIXME: replace with setElementToEdit()
* @generated
*/
protected EObject getElementToEdit() {
	EObject container = ((CreateElementRequest) getRequest()).getContainer();
	if (container instanceof View) {
		container = ((View) container).getElement();
	}
	return container;
}
 
Example #19
Source File: CallActivityCreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* FIXME: replace with setElementToEdit()
* @generated
*/
protected EObject getElementToEdit() {
	EObject container = ((CreateElementRequest) getRequest()).getContainer();
	if (container instanceof View) {
		container = ((View) container).getElement();
	}
	return container;
}
 
Example #20
Source File: StartMessageEventCreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
	StartMessageEvent newElement = ProcessFactory.eINSTANCE.createStartMessageEvent();

	Container owner = (Container) getElementToEdit();
	owner.getElements().add(newElement);

	ElementInitializers.getInstance().init_StartMessageEvent_2010(newElement);

	doConfigure(newElement, monitor, info);

	((CreateElementRequest) getRequest()).setNewElement(newElement);
	return CommandResult.newOKCommandResult(newElement);
}
 
Example #21
Source File: StartEvent2CreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* FIXME: replace with setElementToEdit()
* @generated
*/
protected EObject getElementToEdit() {
	EObject container = ((CreateElementRequest) getRequest()).getContainer();
	if (container instanceof View) {
		container = ((View) container).getElement();
	}
	return container;
}
 
Example #22
Source File: CsvSourceCreateCommand.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
* FIXME: replace with setElementToEdit()
* @generated
*/
protected EObject getElementToEdit() {
	EObject container = ((CreateElementRequest) getRequest()).getContainer();
	if (container instanceof View) {
		container = ((View) container).getElement();
	}
	return container;
}
 
Example #23
Source File: LanguageLanguageParametersCompartmentItemSemanticEditPolicy.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
* @generated
*/
protected Command getCreateCommand(CreateElementRequest req) {
	if (CrossflowElementTypes.Parameter_3002 == req.getElementType()) {
		return getGEFWrapper(new ParameterCreateCommand(req));
	}
	return super.getCreateCommand(req);
}
 
Example #24
Source File: ServiceTaskCreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
	ServiceTask newElement = ProcessFactory.eINSTANCE.createServiceTask();

	Container owner = (Container) getElementToEdit();
	owner.getElements().add(newElement);

	ElementInitializers.getInstance().init_ServiceTask_2027(newElement);

	doConfigure(newElement, monitor, info);

	((CreateElementRequest) getRequest()).setNewElement(newElement);
	return CommandResult.newOKCommandResult(newElement);
}
 
Example #25
Source File: EndMessageEvent2CreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void doConfigure(EndMessageEvent 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 #26
Source File: TextAnnotation2CreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* FIXME: replace with setElementToEdit()
* @generated
*/
protected EObject getElementToEdit() {
	EObject container = ((CreateElementRequest) getRequest()).getContainer();
	if (container instanceof View) {
		container = ((View) container).getElement();
	}
	return container;
}
 
Example #27
Source File: IntermediateErrorCatchEvent5CreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
	IntermediateErrorCatchEvent newElement = ProcessFactory.eINSTANCE.createIntermediateErrorCatchEvent();

	Activity owner = (Activity) getElementToEdit();
	owner.getBoundaryIntermediateEvents().add(newElement);

	ElementInitializers.getInstance().init_IntermediateErrorCatchEvent_3033(newElement);

	doConfigure(newElement, monitor, info);

	((CreateElementRequest) getRequest()).setNewElement(newElement);
	return CommandResult.newOKCommandResult(newElement);
}
 
Example #28
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 #29
Source File: PoolCreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* FIXME: replace with setElementToEdit()
* @generated
*/
protected EObject getElementToEdit() {
	EObject container = ((CreateElementRequest) getRequest()).getContainer();
	if (container instanceof View) {
		container = ((View) container).getElement();
	}
	return container;
}
 
Example #30
Source File: IntermediateCatchMessageEventCreateCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* FIXME: replace with setElementToEdit()
* @generated
*/
protected EObject getElementToEdit() {
	EObject container = ((CreateElementRequest) getRequest()).getContainer();
	if (container instanceof View) {
		container = ((View) container).getElement();
	}
	return container;
}