use of org.yakindu.base.types.PrimitiveType in project statecharts by Yakindu.
the class ExecutionContextLabelProvider method updateValueCell.
private void updateValueCell(ViewerCell cell) {
Object element = cell.getElement();
if (element instanceof ReferenceSlot) {
ReferenceSlot refSlot = (ReferenceSlot) element;
String label = "";
if (refSlot.getReference() != null) {
String refFqn = refSlot.getReference().getFqName();
Object refValue = refSlot.getReference().getValue();
label = refValue != null ? refFqn + " = " + refValue : refFqn;
}
cell.setText(label);
} else if (element instanceof ExecutionSlot) {
Object value = ((ExecutionSlot) element).getValue();
if (value != null) {
if (!((ExecutionSlot) element).isWritable() || isReadOnly) {
cell.setText(getCellTextValue(element, value));
} else if (isPrimitiveType(element)) {
PrimitiveType primitiveType = (PrimitiveType) ((ExecutionSlot) element).getType().getOriginType();
if (isBooleanType(value, primitiveType)) {
TreeItem currentItem = (TreeItem) cell.getItem();
NativeCellWidgetUtil.addNativeCheckbox(cell, element, value, new TreeEditorDisposeListener(currentItem));
// layout cells with checkbox widgets to update positions if tree contents have
// changed
cell.getControl().getParent().layout();
} else {
cell.setText(getCellTextValue(element, value));
}
}
} else {
cell.setText("");
}
}
}
use of org.yakindu.base.types.PrimitiveType in project statecharts by Yakindu.
the class AbstractTypeSystemTest method createPrimitive.
protected PrimitiveType createPrimitive(String name) {
PrimitiveType result = TypesFactory.eINSTANCE.createPrimitiveType();
result.setName(name);
return result;
}
use of org.yakindu.base.types.PrimitiveType in project statecharts by Yakindu.
the class AbstractTypeSystem method declarePrimitive.
protected Type declarePrimitive(String name) {
PrimitiveType primitive = TypesFactory.eINSTANCE.createPrimitiveType();
primitive.setName(name);
declareType(primitive, name);
resource.getContents().add(primitive);
return primitive;
}
Aggregations