Search in sources :

Example 6 with ICommand

use of org.eclipse.gmf.runtime.common.core.command.ICommand in project Palladio-Editors-Sirius by PalladioSimulator.

the class AddLatencyAndThroughputRecordingCommand method doExecute.

@Override
protected void doExecute() {
    // Throughput
    PCMRandomVariable rv = CoreFactory.eINSTANCE.createPCMRandomVariable();
    rv.setSpecification("");
    StochasticExpressionEditDialog dialog = new StochasticExpressionEditDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), TypeEnum.ANY, rv);
    dialog.open();
    rv.setSpecification(dialog.getResultText());
    ICommand cmd = new MySetValueCommand(new SetRequest(communicationLinkResourceSpecification, ResourceenvironmentPackage.eINSTANCE.getCommunicationLinkResourceSpecification_Throughput_CommunicationLinkResourceSpecification(), rv));
    cmd.setLabel("Throughput");
    // Latency
    rv = CoreFactory.eINSTANCE.createPCMRandomVariable();
    rv.setSpecification("");
    dialog = new StochasticExpressionEditDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), TypeEnum.ANY, rv);
    dialog.open();
    rv.setSpecification(dialog.getResultText());
    cmd = new SetValueCommand(new SetRequest(communicationLinkResourceSpecification, ResourceenvironmentPackage.eINSTANCE.getCommunicationLinkResourceSpecification_Latency_CommunicationLinkResourceSpecification(), rv));
}
Also used : SetRequest(org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest) SetValueCommand(org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand) ICommand(org.eclipse.gmf.runtime.common.core.command.ICommand) StochasticExpressionEditDialog(org.palladiosimulator.editors.commons.dialogs.stoex.StochasticExpressionEditDialog) PCMRandomVariable(org.palladiosimulator.pcm.core.PCMRandomVariable)

Example 7 with ICommand

use of org.eclipse.gmf.runtime.common.core.command.ICommand in project tdi-studio-se by Talend.

the class BusinessStructuralFeatureParser method getParseCommand.

/**
     * @generated
     */
public ICommand getParseCommand(IAdaptable adapter, Object[] values) {
    EObject element = (EObject) adapter.getAdapter(EObject.class);
    if (element == null) {
        return UnexecutableCommand.INSTANCE;
    }
    TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(element);
    if (editingDomain == null) {
        return UnexecutableCommand.INSTANCE;
    }
    Object value = values.length == 1 ? values[0] : null;
    ICommand command = getModificationCommand(element, feature, value);
    return new CompositeTransactionalCommand(editingDomain, command.getLabel(), Collections.singletonList(command));
}
Also used : TransactionalEditingDomain(org.eclipse.emf.transaction.TransactionalEditingDomain) CompositeTransactionalCommand(org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand) ICommand(org.eclipse.gmf.runtime.common.core.command.ICommand) EObject(org.eclipse.emf.ecore.EObject) EObject(org.eclipse.emf.ecore.EObject)

Aggregations

ICommand (org.eclipse.gmf.runtime.common.core.command.ICommand)7 EObject (org.eclipse.emf.ecore.EObject)3 Command (org.eclipse.gef.commands.Command)3 ArrayList (java.util.ArrayList)2 TransactionalEditingDomain (org.eclipse.emf.transaction.TransactionalEditingDomain)2 ICommandProxy (org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy)2 CompositeTransactionalCommand (org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand)2 Collection (java.util.Collection)1 Iterator (java.util.Iterator)1 List (java.util.List)1 ExecutionException (org.eclipse.core.commands.ExecutionException)1 PointList (org.eclipse.draw2d.geometry.PointList)1 EditPart (org.eclipse.gef.EditPart)1 CommandStack (org.eclipse.gef.commands.CommandStack)1 UnexecutableCommand (org.eclipse.gef.commands.UnexecutableCommand)1 AbstractEditPart (org.eclipse.gef.editparts.AbstractEditPart)1 CompositeCommand (org.eclipse.gmf.runtime.common.core.command.CompositeCommand)1 DeleteCommand (org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand)1 CommandProxy (org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy)1 DiagramEditPart (org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart)1