Search in sources :

Example 1 with StochasticExpressionEditDialog

use of org.palladiosimulator.editors.commons.dialogs.stoex.StochasticExpressionEditDialog in project Palladio-Editors-Sirius by PalladioSimulator.

the class SetRandomVariable method execute.

@Override
public void execute(Collection<? extends EObject> selections, Map<String, Object> parameters) {
    RandomVariable randomVariable = getRandomVariable((EObject) parameters.get("element"));
    StochasticExpressionEditDialog dialog = new StochasticExpressionEditDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), getExpectedType());
    dialog.setInitialExpression(randomVariable);
    dialog.open();
    if (dialog.getReturnCode() == Dialog.OK) {
        randomVariable.setSpecification(dialog.getResultText());
        randomVariable.setSpecification(new PCMStoExPrettyPrintVisitor().prettyPrint(dialog.getResult()));
    }
}
Also used : PCMStoExPrettyPrintVisitor(de.uka.ipd.sdq.pcm.stochasticexpressions.PCMStoExPrettyPrintVisitor) RandomVariable(de.uka.ipd.sdq.stoex.RandomVariable) StochasticExpressionEditDialog(org.palladiosimulator.editors.commons.dialogs.stoex.StochasticExpressionEditDialog)

Example 2 with StochasticExpressionEditDialog

use of org.palladiosimulator.editors.commons.dialogs.stoex.StochasticExpressionEditDialog in project Palladio-Editors-Sirius by PalladioSimulator.

the class AddHDDProcessingResourceSpecification method getWriteProcessingRate.

private PCMRandomVariable getWriteProcessingRate() {
    final PCMRandomVariable pcmRandomVariable = CoreFactory.eINSTANCE.createPCMRandomVariable();
    pcmRandomVariable.setSpecification("");
    final StochasticExpressionEditDialog dialog = new StochasticExpressionEditDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), TypeEnum.DOUBLE, pcmRandomVariable);
    dialog.setDisplayTitle(SET_WRITE_PROCESSING_RATE);
    dialog.open();
    if (dialog.getResult() == null) {
        return null;
    }
    pcmRandomVariable.setSpecification(dialog.getResultText());
    return pcmRandomVariable;
}
Also used : StochasticExpressionEditDialog(org.palladiosimulator.editors.commons.dialogs.stoex.StochasticExpressionEditDialog) PCMRandomVariable(org.palladiosimulator.pcm.core.PCMRandomVariable)

Example 3 with StochasticExpressionEditDialog

use of org.palladiosimulator.editors.commons.dialogs.stoex.StochasticExpressionEditDialog in project Palladio-Editors-Sirius by PalladioSimulator.

the class AddProcessingResourceSpecification method getProcessingRate.

private PCMRandomVariable getProcessingRate() {
    final PCMRandomVariable pcmRandomVariable = CoreFactory.eINSTANCE.createPCMRandomVariable();
    pcmRandomVariable.setSpecification("");
    final StochasticExpressionEditDialog dialog = new StochasticExpressionEditDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), TypeEnum.DOUBLE, pcmRandomVariable);
    dialog.setDisplayTitle(SET_PROCESSING_RATE);
    dialog.open();
    if (dialog.getResult() == null) {
        return null;
    }
    pcmRandomVariable.setSpecification(dialog.getResultText());
    return pcmRandomVariable;
}
Also used : StochasticExpressionEditDialog(org.palladiosimulator.editors.commons.dialogs.stoex.StochasticExpressionEditDialog) PCMRandomVariable(org.palladiosimulator.pcm.core.PCMRandomVariable)

Example 4 with StochasticExpressionEditDialog

use of org.palladiosimulator.editors.commons.dialogs.stoex.StochasticExpressionEditDialog 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 5 with StochasticExpressionEditDialog

use of org.palladiosimulator.editors.commons.dialogs.stoex.StochasticExpressionEditDialog in project Palladio-Editors-Sirius by PalladioSimulator.

the class OpenExternalStoexEditor method dialogEmptyRandomVariable.

private void dialogEmptyRandomVariable(final RandomVariable randVar) {
    final var copyRand = EcoreUtil.copy(randVar);
    copyRand.setSpecification("0");
    final StochasticExpressionEditDialog dialog = this.createDialog(copyRand);
    if (dialog.getReturnCode() == Window.OK) {
        final String result = dialog.getResultText();
        randVar.setSpecification(result);
    }
}
Also used : StochasticExpressionEditDialog(org.palladiosimulator.editors.commons.dialogs.stoex.StochasticExpressionEditDialog)

Aggregations

StochasticExpressionEditDialog (org.palladiosimulator.editors.commons.dialogs.stoex.StochasticExpressionEditDialog)9 PCMRandomVariable (org.palladiosimulator.pcm.core.PCMRandomVariable)5 PCMStoExPrettyPrintVisitor (de.uka.ipd.sdq.pcm.stochasticexpressions.PCMStoExPrettyPrintVisitor)1 RandomVariable (de.uka.ipd.sdq.stoex.RandomVariable)1 ICommand (org.eclipse.gmf.runtime.common.core.command.ICommand)1 SetValueCommand (org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand)1 SetRequest (org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest)1