Search in sources :

Example 1 with RandomVariable

use of de.uka.ipd.sdq.stoex.RandomVariable 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 RandomVariable

use of de.uka.ipd.sdq.stoex.RandomVariable in project Palladio-Editors-Sirius by PalladioSimulator.

the class OpenExternalStoexEditor method execute.

@Override
public void execute(final Collection<? extends EObject> arg0, final Map<String, Object> arg1) {
    if (arg0.size() != 1) {
        throw new IllegalArgumentException("Multiselection not supported");
    }
    final var element = arg0.iterator().next();
    final var typedElement = this.getTypedElement(element);
    final var action = (String) arg1.get(this.actionParameterType);
    final RandomVariable randVar = this.editStoexAction(action, typedElement);
    if (randVar.getSpecification() == null) {
        this.dialogEmptyRandomVariable(randVar);
    } else {
        this.dialogNotEmptyRandomVariable(randVar);
    }
}
Also used : RandomVariable(de.uka.ipd.sdq.stoex.RandomVariable)

Aggregations

RandomVariable (de.uka.ipd.sdq.stoex.RandomVariable)2 PCMStoExPrettyPrintVisitor (de.uka.ipd.sdq.pcm.stochasticexpressions.PCMStoExPrettyPrintVisitor)1 StochasticExpressionEditDialog (org.palladiosimulator.editors.commons.dialogs.stoex.StochasticExpressionEditDialog)1