use of org.yakindu.sct.model.sruntime.ExecutionSlot 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.sct.model.sruntime.ExecutionSlot in project statecharts by Yakindu.
the class ExecutionContextLabelProvider method getEnumName.
protected String getEnumName(Object element, Object value) {
EnumerationType enumType = (EnumerationType) ((ExecutionSlot) element).getType().getOriginType();
String text = enumType.getEnumerator().get(((Long) value).intValue()).getName();
return text;
}
use of org.yakindu.sct.model.sruntime.ExecutionSlot in project statecharts by Yakindu.
the class EnumerationEditingSupport method convertValue.
@Override
protected Object convertValue(Object element, Object value) {
if (element instanceof ExecutionSlot) {
if (value != null && value instanceof Integer) {
int index = ((Integer) value).intValue();
EnumerationType e = getEnumerationType((ExecutionSlot) element);
if (index < 0) {
return new Long(e.getEnumerator().iterator().next().getLiteralValue());
}
return new Long(e.getEnumerator().get(index).getLiteralValue());
}
}
return null;
}
use of org.yakindu.sct.model.sruntime.ExecutionSlot in project statecharts by Yakindu.
the class EnumerationEditingSupport method getCellEditor.
@Override
public CellEditor getCellEditor(Object element) {
if (element instanceof ExecutionSlot) {
EnumerationType e = getEnumerationType((ExecutionSlot) element);
List<String> enumeratorNames = new ArrayList<String>();
for (Enumerator enumerator : e.getEnumerator()) {
enumeratorNames.add(enumerator.getName());
}
return new ComboBoxCellEditor((Composite) getViewer().getControl(), enumeratorNames.toArray(new String[] {}), SWT.READ_ONLY);
}
return null;
}
use of org.yakindu.sct.model.sruntime.ExecutionSlot in project statecharts by Yakindu.
the class ReferenceSlotImpl method setReference.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setReference(ExecutionSlot newReference) {
ExecutionSlot oldReference = reference;
reference = newReference;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SRuntimePackage.REFERENCE_SLOT__REFERENCE, oldReference, reference));
}
Aggregations