Search in sources :

Example 1 with ExecutionOperation

use of org.yakindu.sct.model.sruntime.ExecutionOperation in project statecharts by Yakindu.

the class ExecutionContextLabelProvider method updateNameCell.

private void updateNameCell(ViewerCell cell) {
    Object element = cell.getElement();
    if (element instanceof ExecutionEvent) {
        ExecutionEvent event = (ExecutionEvent) element;
        cell.setText(event.getName());
        StyleRange style1 = new StyleRange();
        style1.start = 0;
        style1.length = event.getName().length();
        style1.underline = true;
        style1.foreground = ColorConstants.lightBlue;
        cell.setText(event.getName());
        cell.setStyleRanges(new StyleRange[] { style1 });
        if (event.isRaised()) {
            cell.setImage(SimulationImages.EVENT_ENABLED.image());
        } else if (event.getName().contains("time_event")) {
            cell.setImage(SimulationImages.TIMEEVENT.image());
        } else {
            cell.setImage(SimulationImages.EVENT_DISABLED.image());
        }
    } else if (element instanceof ExecutionOperation) {
        ExecutionVariable variable = (ExecutionVariable) element;
        cell.setText(variable.getName());
        cell.setImage(SimulationImages.OPERATION.image());
    } else if (element instanceof ExecutionVariable) {
        ExecutionVariable variable = (ExecutionVariable) element;
        cell.setText(variable.getName());
        if (((ExecutionVariable) element).isWritable())
            cell.setImage(SimulationImages.VARIABLE.image());
        else
            cell.setImage(SimulationImages.VARIABLE_LOCK.image());
    } else if (element instanceof CompositeSlot) {
        cell.setText(((CompositeSlot) element).getName());
        cell.setImage(SimulationImages.SCOPE.image());
    }
}
Also used : ExecutionEvent(org.yakindu.sct.model.sruntime.ExecutionEvent) StyleRange(org.eclipse.swt.custom.StyleRange) CompositeSlot(org.yakindu.sct.model.sruntime.CompositeSlot) ExecutionOperation(org.yakindu.sct.model.sruntime.ExecutionOperation) ExecutionVariable(org.yakindu.sct.model.sruntime.ExecutionVariable)

Aggregations

StyleRange (org.eclipse.swt.custom.StyleRange)1 CompositeSlot (org.yakindu.sct.model.sruntime.CompositeSlot)1 ExecutionEvent (org.yakindu.sct.model.sruntime.ExecutionEvent)1 ExecutionOperation (org.yakindu.sct.model.sruntime.ExecutionOperation)1 ExecutionVariable (org.yakindu.sct.model.sruntime.ExecutionVariable)1