use of edu.uah.rsesc.aadlsimulator.xtext.inputConstraint.ScalarExpression in project AGREE by loonwerks.
the class InputConstraintDialog method addNegateMenuItem.
private void addNegateMenuItem(final Menu menu, final Reference ref) {
final MenuItem menuItem = new MenuItem(menu, SWT.CHECK);
menuItem.setSelection(ref.get() instanceof NegativeExpression);
menuItem.setText("Negate");
menuItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
final boolean checked = ((MenuItem) e.widget).getSelection();
if (checked) {
final NegativeExpression negExpr = (NegativeExpression) InputConstraintFactory.eINSTANCE.create(InputConstraintPackage.eINSTANCE.getNegativeExpression());
negExpr.setValue((ScalarExpression) ref.get());
ref.set(negExpr);
} else {
ref.set(((NegativeExpression) ref.get()).getValue());
}
dlg.refreshContraint();
}
});
}
use of edu.uah.rsesc.aadlsimulator.xtext.inputConstraint.ScalarExpression in project AGREE by loonwerks.
the class InputConstraintDialog method addScalarExpressionsMenuItems.
private void addScalarExpressionsMenuItems(final Menu menu, boolean showBoolean, final Reference ref) {
if (ref.get() instanceof ScalarExpression && !(ref.get() instanceof BooleanLiteral)) {
addNegateMenuItem(menu, ref);
}
addTextExpressionMenuItem(menu, ref, "Integer...", ResultType.INTEGER, "0");
addTextExpressionMenuItem(menu, ref, "Real...", ResultType.REAL, "0.0");
if (showBoolean) {
final Menu booleanMenu = new Menu(menu);
final MenuItem booleanMenuItem = new MenuItem(menu, SWT.CASCADE);
booleanMenuItem.setText("Boolean");
booleanMenuItem.setMenu(booleanMenu);
addBooleanLiteralMenuItem(booleanMenu, ref, true);
addBooleanLiteralMenuItem(booleanMenu, ref, false);
}
addReferenceMenuItems(menu, ref);
addNewEClassMenuItem(menu, ref, "Random Integer", icp.getRandomIntegerExpression());
addNewEClassMenuItem(menu, ref, "Random Real", icp.getRandomRealExpression());
addNewEClassMenuItem(menu, ref, "Random Element", icp.getRandomElementExpression());
addPreviousValueMenuItem(menu, ref);
}
use of edu.uah.rsesc.aadlsimulator.xtext.inputConstraint.ScalarExpression in project AGREE by loonwerks.
the class BinaryExpressionImpl method basicSetRight.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetRight(ScalarExpression newRight, NotificationChain msgs) {
ScalarExpression oldRight = right;
right = newRight;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, InputConstraintPackage.BINARY_EXPRESSION__RIGHT, oldRight, newRight);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of edu.uah.rsesc.aadlsimulator.xtext.inputConstraint.ScalarExpression in project AGREE by loonwerks.
the class BinaryExpressionImpl method basicSetLeft.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetLeft(ScalarExpression newLeft, NotificationChain msgs) {
ScalarExpression oldLeft = left;
left = newLeft;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, InputConstraintPackage.BINARY_EXPRESSION__LEFT, oldLeft, newLeft);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of edu.uah.rsesc.aadlsimulator.xtext.inputConstraint.ScalarExpression in project AGREE by loonwerks.
the class NegativeExpressionImpl method basicSetValue.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetValue(ScalarExpression newValue, NotificationChain msgs) {
ScalarExpression oldValue = value;
value = newValue;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, InputConstraintPackage.NEGATIVE_EXPRESSION__VALUE, oldValue, newValue);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
Aggregations