Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* KIELER - Kiel Integrated Environment for Layout Eclipse RichClient
*
* http://rtsys.informatik.uni-kiel.de/kieler
*
* Copyright ${year} by
* + Kiel University
* + Department of Computer Science
* + Real-Time and Embedded Systems Group
*
* This code is provided under the terms of the Eclipse Public License (EPL).
*/
package de.cau.cs.kieler.core.definitions;

/**
*
*/
public class Semantics {
public static String PRAGMA_LEGACY_SEMANTICS = "LegacySemantics";


}
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,15 @@ class StateSynthesis extends SubSynthesis<State, KNode> {

//pre-evaluate type
val isConnector = state.isConnector
val isInitialConnector = isConnector && state.isInitial;

// Basic state style
switch state {
case isInitialConnector: {
node.addInitialConnectorFigure
node.getProperty(KlighdProperties.SEMANTIC_FILTER_TAGS).add(SCChartsSemanticFilterTags.CONNECTOR_STATE)
proxy.addInitialConnectorFigure
}
case isConnector: {
node.addConnectorFigure
node.getProperty(KlighdProperties.SEMANTIC_FILTER_TAGS).add(SCChartsSemanticFilterTags.CONNECTOR_STATE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ import static de.cau.cs.kieler.sccharts.ui.synthesis.GeneralSynthesisOptions.*
import static de.cau.cs.kieler.sccharts.ui.synthesis.styles.ColorStore.Color.*

import static extension de.cau.cs.kieler.klighd.syntheses.DiagramSyntheses.*
import de.cau.cs.kieler.sccharts.extensions.SCChartsCoreExtensions
import de.cau.cs.kieler.annotations.extensions.PragmaExtensions

/**
* Transforms {@link Transition} into {@link KEdge} diagram elements.
Expand Down Expand Up @@ -67,8 +69,11 @@ class TransitionSynthesis extends SubSynthesis<Transition, KEdge> {
@Inject extension TransitionStyles
@Inject extension ColorStore
@Inject extension AdaptiveZoom
@Inject extension SCChartsCoreExtensions
@Inject extension PragmaExtensions

override performTranformation(Transition transition) {
val legacySemantics = transition.getSCCharts.hasPragma("LegacySemantics");
val edge = transition.createEdge().associateWith(transition);
edge.configureEdgeLOD(transition)

Expand All @@ -89,7 +94,7 @@ class TransitionSynthesis extends SubSynthesis<Transition, KEdge> {
edge.addTransitionSpline();

// Modifiers
if (transition.isImplicitlyImmediate) {
if (transition.isImplicitlyImmediate && (legacySemantics || !transition.sourceState.isConnector)) {
edge.setImmediateStyle
}
if (transition.nondeterministic) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,17 @@ class StateStyles {
]
}

/**
* Adds an initial connector figure.
*/
def KRoundedRectangle addInitialConnectorFigure(KNode node) {
node.setMinimalNodeSize(0.5f * DEFAULT_FIGURE_MIN_NODE_SIZE, 0.5f * DEFAULT_FIGURE_MIN_NODE_SIZE);
node.addRoundedRectangle(DEFAULT_FIGURE_CORNER_RADIUS, DEFAULT_FIGURE_CORNER_RADIUS, baseLineWidth) => [
background = STATE_CONNECTOR.color;
foreground = STATE_CONNECTOR.color;
]
}

/**
* Adds a small state figure.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ import org.eclipse.xtext.validation.Check
import org.eclipse.xtext.validation.CheckType

import static extension java.lang.String.*
import de.cau.cs.kieler.core.definitions.Semantics

/**
* This class contains custom validation rules.
Expand Down Expand Up @@ -134,6 +135,7 @@ class SCTXValidator extends AbstractSCTXValidator {
static val String CANNOT_BIND_LITERAL_TO_OUTPUT = "You cannot bind a literal to an output object."
static val String DUPLICATE_VARIABLE = "The variable is declared multiple times in this scope."
static val String NON_IMMEDIATE_CONNECTOR = "Outgoing transitions of connector states should be marked as immediate."
static val String IMMEDIATE_CONNECTOR = "Outgoing transitions of connector states should not be marked as immediate unless legacy semantics are used."
static val String NO_DEFAULT_TRANSITION = "Connector states should have an outgoing transition without trigger."
static val String NO_OUTGOING_TRANSITION = "Connector states must have an outgoing transition."
static val String NON_REACHABLE_TRANSITION = "The transition is not reachable."
Expand Down Expand Up @@ -724,9 +726,12 @@ class SCTXValidator extends AbstractSCTXValidator {
if(state.connector) {
var Transition lastTransition
var boolean transitionWithoutTrigger = false
val hasLegacySemantics = state.SCCharts.hasPragma(Semantics.PRAGMA_LEGACY_SEMANTICS)
for(trans : state.outgoingTransitions) {
if(!trans.isImmediate) {
if(hasLegacySemantics && !trans.isImmediate) {
warning(NON_IMMEDIATE_CONNECTOR, trans, null)
} else if (!hasLegacySemantics && trans.isImmediate) {
warning(IMMEDIATE_CONNECTOR, trans, null)
}
if(trans.trigger === null) {
transitionWithoutTrigger = true
Expand Down
Loading