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()));
}
}
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;
}
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;
}
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));
}
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);
}
}
Aggregations