use of org.yakindu.sct.model.sruntime.ReferenceSlot 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("");
}
}
}
Aggregations