Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/contentassist/RoomProposalProvider.java1
-rw-r--r--plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/util/UIExpressionUtil.xtend38
-rw-r--r--plugins/org.eclipse.etrice.expressions.ui/src/org/eclipse/etrice/expressions/detailcode/DefaultDetailExpressionProvider.xtend98
-rw-r--r--plugins/org.eclipse.etrice.expressions.ui/src/org/eclipse/etrice/expressions/detailcode/DetailExpressionProvider.xtend (renamed from plugins/org.eclipse.etrice.expressions.ui/src/org/eclipse/etrice/expressions/detailcode/GuardDetailExpressionProvider.xtend)144
-rw-r--r--plugins/org.eclipse.etrice.expressions.ui/src/org/eclipse/etrice/expressions/detailcode/RuntimeDetailExpressionProvider.xtend51
-rw-r--r--plugins/org.eclipse.etrice.expressions.ui/src/org/eclipse/etrice/expressions/ui/contentassist/DetailExpressionProposalConfig.xtend10
-rw-r--r--plugins/org.eclipse.etrice.expressions.ui/src/org/eclipse/etrice/expressions/ui/highlight/AbstractHighlightStyles.xtend5
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/StatePropertyDialog.java4
-rw-r--r--tests/org.eclipse.etrice.generator.common.tests/models/DetailExpressionTest.room183
9 files changed, 236 insertions, 298 deletions
diff --git a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/contentassist/RoomProposalProvider.java b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/contentassist/RoomProposalProvider.java
index f6f141e49..065e4b257 100644
--- a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/contentassist/RoomProposalProvider.java
+++ b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/contentassist/RoomProposalProvider.java
@@ -35,7 +35,6 @@ import org.eclipse.etrice.core.room.RoomPackage;
import org.eclipse.etrice.core.room.StandardOperation;
import org.eclipse.etrice.core.room.util.RoomHelpers;
import org.eclipse.etrice.core.ui.util.UIExpressionUtil;
-import org.eclipse.etrice.expressions.detailcode.DefaultDetailExpressionProvider;
import org.eclipse.etrice.expressions.detailcode.IDetailExpressionProvider;
import org.eclipse.etrice.expressions.ui.contentassist.RoomExpressionProposalProvider;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
diff --git a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/util/UIExpressionUtil.xtend b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/util/UIExpressionUtil.xtend
index 6cce6f9e8..9c915fc9d 100644
--- a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/util/UIExpressionUtil.xtend
+++ b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/util/UIExpressionUtil.xtend
@@ -12,26 +12,22 @@
package org.eclipse.etrice.core.ui.util
+import java.util.Map
import org.eclipse.emf.ecore.EObject
-import org.eclipse.etrice.core.fsm.fSM.Guard
-import org.eclipse.etrice.core.fsm.fSM.StateGraphItem
+import org.eclipse.etrice.core.fsm.fSM.ModelComponent
import org.eclipse.etrice.core.fsm.fSM.TransitionBase
+import org.eclipse.etrice.core.genmodel.fsm.ExtendedFsmGenBuilder
import org.eclipse.etrice.core.genmodel.fsm.FsmGenExtensions
import org.eclipse.etrice.core.genmodel.fsm.fsmgen.GraphContainer
import org.eclipse.etrice.core.room.ActorClass
-import org.eclipse.etrice.expressions.detailcode.DefaultDetailExpressionProvider
+import org.eclipse.etrice.core.room.MessageData
+import org.eclipse.etrice.core.ui.RoomUiModule
import org.eclipse.etrice.expressions.detailcode.DetailExpressionAssistParser
-import org.eclipse.etrice.expressions.detailcode.GuardDetailExpressionProvider
+import org.eclipse.etrice.expressions.detailcode.DetailExpressionProvider
import org.eclipse.etrice.expressions.detailcode.IDetailExpressionProvider
import org.eclipse.etrice.expressions.detailcode.IDetailExpressionProvider.ExpressionFeature
import org.eclipse.jface.text.Document
import org.eclipse.xtext.nodemodel.ILeafNode
-import org.eclipse.etrice.core.room.MessageData
-import org.eclipse.etrice.core.genmodel.fsm.ExtendedFsmGenBuilder
-import java.util.Map
-import org.eclipse.etrice.core.fsm.fSM.ModelComponent
-import org.eclipse.etrice.core.ui.RoomUiModule
-
import static org.eclipse.xtext.EcoreUtil2.getContainerOfType
@@ -54,19 +50,15 @@ class UIExpressionUtil {
}
- static def IDetailExpressionProvider selectExpressionProvider(EObject it, GenModelAccess genModelAccess) {
- val ac = getContainerOfType(it, ActorClass)
- val exprProvider = switch it {
- case getContainerOfType(it, Guard) !== null && ac !== null: new GuardDetailExpressionProvider(ac)
- case getContainerOfType(it, StateGraphItem) !== null && ac !== null: new DefaultDetailExpressionProvider(ac)
- default: new IDetailExpressionProvider.EmptyDetailExpressionProvider
- }
- if(exprProvider instanceof GuardDetailExpressionProvider) {
- val transition = getContainerOfType(it, TransitionBase)
- if(transition !== null) {
- val commonData = FsmGenExtensions.getLinkFor(genModelAccess.get(ac), transition)?.commonData
- if(commonData instanceof MessageData)
- exprProvider.transitionEventData = commonData
+ static def IDetailExpressionProvider selectExpressionProvider(EObject it, GenModelAccess genModelAccess) {
+ val exprProvider = new DetailExpressionProvider(it)
+ val transition = getContainerOfType(it, TransitionBase)
+ if(transition !== null) {
+ val ac = getContainerOfType(it, ActorClass)
+ if(ac !== null) {
+ val commonData = FsmGenExtensions.getLinkFor(genModelAccess.get(ac), transition)?.commonData
+ if(commonData instanceof MessageData)
+ exprProvider.transitionEventData = commonData
}
}
diff --git a/plugins/org.eclipse.etrice.expressions.ui/src/org/eclipse/etrice/expressions/detailcode/DefaultDetailExpressionProvider.xtend b/plugins/org.eclipse.etrice.expressions.ui/src/org/eclipse/etrice/expressions/detailcode/DefaultDetailExpressionProvider.xtend
deleted file mode 100644
index f425585a1..000000000
--- a/plugins/org.eclipse.etrice.expressions.ui/src/org/eclipse/etrice/expressions/detailcode/DefaultDetailExpressionProvider.xtend
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Juergen Haug (initial contribution)
- *
- *******************************************************************************/
-package org.eclipse.etrice.expressions.detailcode
-
-import java.util.List
-import org.eclipse.etrice.core.room.Attribute
-import org.eclipse.etrice.core.room.DataClass
-import org.eclipse.etrice.core.room.InterfaceItem
-import org.eclipse.etrice.core.room.Port
-import org.eclipse.etrice.core.room.SAP
-import org.eclipse.etrice.core.room.SPP
-import org.eclipse.etrice.expressions.detailcode.GuardDetailExpressionProvider
-import org.eclipse.etrice.expressions.detailcode.IDetailExpressionProvider.ExpressionFeature
-import org.eclipse.etrice.expressions.detailcode.IDetailExpressionProvider.ExpressionPostfix
-import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor
-
-/**
- * Defines expression for fsm detail code of an ActorClass
- */
-@FinalFieldsConstructor
-class DefaultDetailExpressionProvider extends GuardDetailExpressionProvider {
-
- override getInitialFeatures() {
- // no super call, keep it simple
- val List<ExpressionFeature> scope = newArrayList
-
- if(transitionEventData !== null) {
- scope += new ExpressionFeature('transitionData', ExpressionPostfix.NONE) => [
- data = transitionEventData
- ]
- }
- scope += actorClass.latestOperations.map[createExprFeature]
- scope += actorClass.allAttributes.map[createExprFeature]
- actorClass.allInterfaceItems.forEach [
- switch it {
- SPP case isEventDriven/* fall through */,
- Port case isEventDriven && isReplicated: {
- scope += createExprFeature(ExpressionPostfix.NONE) // additional feature for broadcast
- scope += createExprFeature(ExpressionPostfix.BRACKETS)
- }
- Port case isReplicated/* fall through */,
- SPP:
- scope += createExprFeature(ExpressionPostfix.BRACKETS)
- default:
- scope += createExprFeature(ExpressionPostfix.NONE)
- }
- ]
-
- return scope.filterNull.filter[id !== null].toList
- }
-
- override getContextFeatures(ExpressionFeature ctx) {
- // no super call, keep it simple
- ctx.assertNotNull
-
- val List<ExpressionFeature> scope = newArrayList
- switch obj : ctx.data {
- Port case obj.multiplicity == 1/* fall through */,
- SAP: scope +=
- obj.protocol.getAllOperations(!obj.conjugated).map[createExprFeature]
- }
- switch obj : ctx.data {
- InterfaceItem: {
- val pc = obj.protocol
- switch pc.commType {
- case EVENT_DRIVEN:
- scope += pc.getAllMessages(obj.conjugated).map[createExprFeature]
- case DATA_DRIVEN:
- if (obj.conjugated)
- scope += pc.allIncomingMessages.map[createExprFeature]
- else
- scope += pc.allIncomingMessages.map[createExprFeature(ExpressionPostfix.NONE)] // data message has no Parenthesis
- case SYNCHRONOUS: {}
- }
-
- // TODO Attributes ?
- }
- Attribute case obj.type.type instanceof DataClass: {
- val dc = obj.type.type as DataClass
- scope += dc.allAttributes.map[createExprFeature]
- // not supported yet by code translation:
- // scope += dc.latestOperations.map[createExprFeature(ExpressionPostfix.PARENTHESES)]
- }
- }
-
- return scope.filterNull.filter[id !== null].toList
- }
-
-}
diff --git a/plugins/org.eclipse.etrice.expressions.ui/src/org/eclipse/etrice/expressions/detailcode/GuardDetailExpressionProvider.xtend b/plugins/org.eclipse.etrice.expressions.ui/src/org/eclipse/etrice/expressions/detailcode/DetailExpressionProvider.xtend
index 93caacef1..44a4a7ac3 100644
--- a/plugins/org.eclipse.etrice.expressions.ui/src/org/eclipse/etrice/expressions/detailcode/GuardDetailExpressionProvider.xtend
+++ b/plugins/org.eclipse.etrice.expressions.ui/src/org/eclipse/etrice/expressions/detailcode/DetailExpressionProvider.xtend
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2015 protos software gmbh (http://www.protos.de).
+ * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -9,12 +9,15 @@
* Juergen Haug (initial contribution)
*
*******************************************************************************/
+
package org.eclipse.etrice.expressions.detailcode
import com.google.common.base.Strings
import java.util.List
import org.eclipse.core.runtime.Assert
import org.eclipse.emf.ecore.EObject
+import org.eclipse.etrice.core.fsm.fSM.Guard
+import org.eclipse.etrice.core.fsm.fSM.StateGraphItem
import org.eclipse.etrice.core.room.ActorClass
import org.eclipse.etrice.core.room.Attribute
import org.eclipse.etrice.core.room.DataClass
@@ -23,7 +26,9 @@ import org.eclipse.etrice.core.room.Message
import org.eclipse.etrice.core.room.MessageData
import org.eclipse.etrice.core.room.Operation
import org.eclipse.etrice.core.room.Port
+import org.eclipse.etrice.core.room.PortClass
import org.eclipse.etrice.core.room.SAP
+import org.eclipse.etrice.core.room.SPP
import org.eclipse.etrice.core.room.util.RoomHelpers
import org.eclipse.xtend.lib.annotations.AccessorType
import org.eclipse.xtend.lib.annotations.Accessors
@@ -31,19 +36,13 @@ import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor
import org.eclipse.xtext.util.SimpleAttributeResolver
import static extension org.eclipse.xtend.lib.annotations.AccessorType.*
+import static extension org.eclipse.xtext.EcoreUtil2.getContainerOfType
-/**
- * Defines expression for fsm guards of an ActorClass
- * <ul>
- * <li>attributes and operations of ActorClass</li>
- * <li>data-driven incoming messages</li>
- * </ul>
- */
- @FinalFieldsConstructor
-class GuardDetailExpressionProvider implements IDetailExpressionProvider {
-
+@FinalFieldsConstructor
+class DetailExpressionProvider implements IDetailExpressionProvider {
+
// ctor
- protected val ActorClass actorClass
+ protected val EObject model
protected val extension RoomHelpers roomHelpers = new RoomHelpers
protected val nameProvider = SimpleAttributeResolver.NAME_RESOLVER
@@ -51,44 +50,115 @@ class GuardDetailExpressionProvider implements IDetailExpressionProvider {
@Accessors(AccessorType.PUBLIC_SETTER) protected MessageData transitionEventData
override getInitialFeatures() {
- val List<ExpressionFeature> scope = newArrayList
+ val scope = newArrayList
if(transitionEventData !== null) {
scope += new ExpressionFeature('transitionData', ExpressionPostfix.NONE) => [
data = transitionEventData
]
}
- scope += actorClass.allInterfaceItems.filter[isEventDriven || !isConjugated].map[
- switch it {
- Port case isReplicated: createExprFeature(IDetailExpressionProvider.ExpressionPostfix.BRACKETS)
- default: createExprFeature(IDetailExpressionProvider.ExpressionPostfix.NONE)
- }]
- scope += actorClass.latestOperations.map[createExprFeature]
- scope += actorClass.allAttributes.map[createExprFeature]
+ if(model.isInContainment(Operation)) {
+ scope += model.getContainerOfType(Operation).arguments.map[createExprFeature(ExpressionPostfix.NONE)]
+ }
+ switch model {
+ case model.isInContainment(ActorClass): {
+ val ac = model.getContainerOfType(ActorClass)
+ scope += initialFsmExpression(ac)
+ scope += ac.latestOperations.map[createExprFeature]
+ scope += ac.allAttributes.map[createExprFeature]
+ }
+ case model.isInContainment(PortClass): {
+ val pc = model.getContainerOfType(PortClass)
+ // TODO operations
+ // TODO inherited attributes
+ scope += pc.attributes.map[createExprFeature]
+ }
+ case model.isInContainment(DataClass): {
+ val dc = model.getContainerOfType(DataClass)
+ scope += dc.latestOperations.map[createExprFeature]
+ scope += dc.allAttributes.map[createExprFeature]
+ }
+ }
return scope.filterNull.filter[id !== null].toList
}
-
+
+ protected def List<ExpressionFeature> initialFsmExpression(ActorClass ac) {
+ val scope = newArrayList
+ switch model {
+ case model.isInContainment(Guard): {
+ scope += ac.allInterfaceItems.filter[isEventDriven || !isConjugated].map[
+ switch it {
+ Port case isReplicated: createExprFeature(IDetailExpressionProvider.ExpressionPostfix.BRACKETS)
+ default: createExprFeature(IDetailExpressionProvider.ExpressionPostfix.NONE)
+ }]
+ }
+ case model.isInContainment(StateGraphItem): {
+ ac.allInterfaceItems.forEach [
+ switch it {
+ SPP case isEventDriven/* fall through */,
+ Port case isEventDriven && isReplicated: {
+ scope += createExprFeature(ExpressionPostfix.NONE) // additional feature for broadcast
+ scope += createExprFeature(ExpressionPostfix.BRACKETS)
+ }
+ Port case isReplicated/* fall through */,
+ SPP:
+ scope += createExprFeature(ExpressionPostfix.BRACKETS)
+ default:
+ scope += createExprFeature(ExpressionPostfix.NONE)
+ }
+ ]
+ }
+ }
+
+ return scope
+ }
+
+ protected def List<ExpressionFeature> contextFsmMessages(InterfaceItem ifItem, ExpressionFeature ctx) {
+ val scope = newArrayList
+ switch model {
+ case model.isInContainment(Guard): {
+ val pc = ifItem.protocol
+ switch pc?.commType {
+ case DATA_DRIVEN:
+ if (!ifItem.conjugated) scope += pc.allIncomingMessages.map[createExprFeature]
+ case EVENT_DRIVEN: { /* no async message calls */}
+ case SYNCHRONOUS: {}
+ }
+ }
+ case model.isInContainment(StateGraphItem): {
+ val pc = ifItem.protocol
+ switch pc?.commType {
+ case EVENT_DRIVEN:
+ scope += pc.getAllMessages(ifItem.conjugated).map[createExprFeature]
+ case DATA_DRIVEN:
+ if (ifItem.conjugated)
+ scope += pc.allIncomingMessages.map[createExprFeature]
+ else
+ scope += pc.allIncomingMessages.map[createExprFeature(ExpressionPostfix.NONE)] // data message has no Parenthesis
+ case SYNCHRONOUS: {}
+ }
+ }
+ }
+
+ return scope
+ }
+
override getContextFeatures(ExpressionFeature ctx) {
- ctx.assertNotNull
-
val List<ExpressionFeature> scope = newArrayList
+
switch obj : ctx.data {
Port case obj.multiplicity == 1/* fall through */,
SAP: scope +=
obj.protocol.getAllOperations(!obj.conjugated).map[createExprFeature]
}
switch obj : ctx.data {
- InterfaceItem: {
- val pc = obj.protocol
- switch pc.commType {
- case DATA_DRIVEN:
- if (!obj.conjugated) scope += pc.allIncomingMessages.map[createExprFeature]
- case EVENT_DRIVEN: { /* no async message calls */}
- case SYNCHRONOUS: {}
- }
- }
- Attribute case obj.type.type instanceof DataClass: {
+ Port case obj.multiplicity == 1/* fall through */,
+ SAP: scope +=
+ obj.protocol.getAllOperations(!obj.conjugated).map[createExprFeature]
+ InterfaceItem:
+ scope += contextFsmMessages(obj, ctx)
+ Attribute case obj.type?.type instanceof DataClass: {
val dc = obj.type.type as DataClass
scope += dc.allAttributes.map[createExprFeature]
scope += dc.latestOperations.map[createExprFeature]
@@ -128,5 +198,9 @@ class GuardDetailExpressionProvider implements IDetailExpressionProvider {
Assert.isNotNull(feature.postfix)
Assert.isNotNull(feature.data)
}
-
-}
+
+ private def isInContainment(EObject it, Class<? extends EObject> clazz) {
+ getContainerOfType(clazz) !== null
+ }
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.etrice.expressions.ui/src/org/eclipse/etrice/expressions/detailcode/RuntimeDetailExpressionProvider.xtend b/plugins/org.eclipse.etrice.expressions.ui/src/org/eclipse/etrice/expressions/detailcode/RuntimeDetailExpressionProvider.xtend
deleted file mode 100644
index 101e1ad8e..000000000
--- a/plugins/org.eclipse.etrice.expressions.ui/src/org/eclipse/etrice/expressions/detailcode/RuntimeDetailExpressionProvider.xtend
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.eclipse.etrice.expressions.detailcode
-
-import org.eclipse.emf.ecore.EObject
-import org.eclipse.etrice.core.room.InterfaceItem
-import org.eclipse.etrice.core.room.Port
-import org.eclipse.etrice.core.room.SPP
-import org.eclipse.xtend.lib.annotations.Accessors
-import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor
-
-/**
- * Defines expression that does not have an model representation. Extends {@link DefaultDetailExpressionProvider}
- */
-@FinalFieldsConstructor
-class RuntimeDetailExpressionProvider extends DefaultDetailExpressionProvider {
-
- public static val RT_METHOD_GET_REPLICATION = "getReplication"
-
- @Accessors
- static class RuntimeMethodExpressionData {
- //val String methodName
- //EObject eObj
- }
-
- override getContextFeatures(ExpressionFeature ctx) {
- val scope = super.getContextFeatures(ctx)
-
- switch obj : ctx.data {
- InterfaceItem: {
- if (ctx.postfix == ExpressionPostfix.NONE) {
- switch obj {
- Port case obj.replicated/* fall through */,
- SPP: {
- // not supported yet by code translation
- //scope += createRtMethodExprFeature(RT_METHOD_GET_REPLICATION, obj)
- }
- }
- }
- }
- }
-
- return scope.filterNull.filter[id !== null].toList
- }
-
- protected def createRtMethodExprFeature(String methodName, EObject eObj) {
- val feature = new ExpressionFeature(methodName, ExpressionPostfix.PARENTHESES)
- feature.data = new RuntimeMethodExpressionData()
-
- return feature
- }
-
-}
diff --git a/plugins/org.eclipse.etrice.expressions.ui/src/org/eclipse/etrice/expressions/ui/contentassist/DetailExpressionProposalConfig.xtend b/plugins/org.eclipse.etrice.expressions.ui/src/org/eclipse/etrice/expressions/ui/contentassist/DetailExpressionProposalConfig.xtend
index ba8720f66..4bd74a596 100644
--- a/plugins/org.eclipse.etrice.expressions.ui/src/org/eclipse/etrice/expressions/ui/contentassist/DetailExpressionProposalConfig.xtend
+++ b/plugins/org.eclipse.etrice.expressions.ui/src/org/eclipse/etrice/expressions/ui/contentassist/DetailExpressionProposalConfig.xtend
@@ -19,6 +19,7 @@ import org.eclipse.emf.ecore.EObject
import org.eclipse.etrice.core.room.Attribute
import org.eclipse.etrice.core.room.InterfaceItem
import org.eclipse.etrice.core.room.Message
+import org.eclipse.etrice.core.room.MessageData
import org.eclipse.etrice.core.room.Operation
import org.eclipse.etrice.core.room.Port
import org.eclipse.etrice.core.room.SPP
@@ -26,13 +27,10 @@ import org.eclipse.etrice.core.room.VarDecl
import org.eclipse.etrice.core.room.util.RoomHelpers
import org.eclipse.etrice.expressions.detailcode.IDetailExpressionProvider.ExpressionFeature
import org.eclipse.etrice.expressions.detailcode.IDetailExpressionProvider.ExpressionPostfix
-import org.eclipse.etrice.expressions.detailcode.RuntimeDetailExpressionProvider
-import org.eclipse.etrice.expressions.detailcode.RuntimeDetailExpressionProvider.RuntimeMethodExpressionData
+import org.eclipse.etrice.generator.generic.ILanguageExtension
import org.eclipse.jface.viewers.ILabelProvider
import org.eclipse.swt.graphics.Image
import org.eclipse.swt.graphics.Point
-import org.eclipse.etrice.generator.generic.ILanguageExtension
-import org.eclipse.etrice.core.room.MessageData
@Singleton
class DetailExpressionProposalConfig{
@@ -103,8 +101,8 @@ class DetailExpressionProposalConfig{
typedInfo = data?.type?.type?.name
InterfaceItem:
typedInfo = roomHelpers.getProtocol(data)?.name
- RuntimeMethodExpressionData case feature.id == RuntimeDetailExpressionProvider.RT_METHOD_GET_REPLICATION:
- typedInfo = 'int'
+// RuntimeMethodExpressionData case feature.id == RuntimeDetailExpressionProvider.RT_METHOD_GET_REPLICATION:
+// typedInfo = 'int'
VarDecl: {
typedInfo = data?.refType?.type?.name
classInfo = ""
diff --git a/plugins/org.eclipse.etrice.expressions.ui/src/org/eclipse/etrice/expressions/ui/highlight/AbstractHighlightStyles.xtend b/plugins/org.eclipse.etrice.expressions.ui/src/org/eclipse/etrice/expressions/ui/highlight/AbstractHighlightStyles.xtend
index f6a2ff065..624686da9 100644
--- a/plugins/org.eclipse.etrice.expressions.ui/src/org/eclipse/etrice/expressions/ui/highlight/AbstractHighlightStyles.xtend
+++ b/plugins/org.eclipse.etrice.expressions.ui/src/org/eclipse/etrice/expressions/ui/highlight/AbstractHighlightStyles.xtend
@@ -17,7 +17,6 @@ import org.eclipse.etrice.core.room.Attribute
import org.eclipse.etrice.core.room.InterfaceItem
import org.eclipse.etrice.core.room.Operation
import org.eclipse.etrice.expressions.detailcode.IDetailExpressionProvider.ExpressionFeature
-import org.eclipse.etrice.expressions.detailcode.RuntimeDetailExpressionProvider.RuntimeMethodExpressionData
import org.eclipse.swt.graphics.RGB
/** Enables re-usability of scanner for xtext and jface editor */
@@ -56,8 +55,8 @@ abstract class AbstractHighlightStyles {
operation
EObject:
specialFeature // unknown model object == special
- RuntimeMethodExpressionData:
- operation
+// RuntimeMethodExpressionData:
+// operation
}
}
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/StatePropertyDialog.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/StatePropertyDialog.java
index 85b1d25df..8e2e225bd 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/StatePropertyDialog.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/StatePropertyDialog.java
@@ -17,7 +17,7 @@ import org.eclipse.etrice.core.fsm.fSM.State;
import org.eclipse.etrice.core.fsm.validation.FSMValidationUtilXtend.Result;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.util.RoomHelpers;
-import org.eclipse.etrice.expressions.detailcode.RuntimeDetailExpressionProvider;
+import org.eclipse.etrice.core.ui.util.UIExpressionUtil;
import org.eclipse.etrice.ui.behavior.Activator;
import org.eclipse.etrice.ui.behavior.fsm.actioneditor.IActionCodeEditor;
import org.eclipse.etrice.ui.behavior.fsm.dialogs.AbstractMemberAwarePropertyDialog;
@@ -210,7 +210,7 @@ public class StatePropertyDialog extends AbstractMemberAwarePropertyDialog imple
StringToDetailCode s2m, DetailCodeToString m2s) {
IActionCodeEditor entry = super.createActionCodeEditor(parent, label,
- detailCode, state, feat, s2m, m2s, new RuntimeDetailExpressionProvider(ac));
+ detailCode, state, feat, s2m, m2s, UIExpressionUtil.selectExpressionProvider(detailCode));
Control control;
if (entry != null)
diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/DetailExpressionTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/DetailExpressionTest.room
index 12fc5f20b..77cde675e 100644
--- a/tests/org.eclipse.etrice.generator.common.tests/models/DetailExpressionTest.room
+++ b/tests/org.eclipse.etrice.generator.common.tests/models/DetailExpressionTest.room
@@ -4,6 +4,12 @@ RoomModel DetailExpressionTestModel {
import room.basic.test.* from "../../../runtime/${etModellib}/model/Tests.room"
import room.basic.service.timing.* from "../../../runtime/${etModellib}/model/TimingService.room"
+
+/**
+ * TODO define supported expression properly
+ * TODO sync UI and translation in generator
+ */
+
async ActorClass DetailExpressionTest {
Interface {
SPP sppEvent: PEventdriven
@@ -11,7 +17,7 @@ RoomModel DetailExpressionTestModel {
}
Structure {
ServiceImplementation of sppEvent
- Attribute numberArray [ 5 ]: int32
+ Attribute numberArray [5]: int32
Attribute infoData: DDataNested
Port rPortEvent: PEventdriven
Port rPortData: PDatadriven
@@ -21,57 +27,62 @@ RoomModel DetailExpressionTestModel {
conjugated Port cReplEvent [*]: PEventdriven
}
Behavior {
- Operation actorOp(param: int32): boolean {
- "return true;"
- }
+ ctor '''
+ numberArray[0] = 5;
+ '''
+ dtor '''
+ numberArray[0] = 5;
+ '''
+ Operation actorOp(param: int32): boolean '''
+ return param == 0;
+ '''
StateMachine {
Transition eventTrans: idle -> state1 {
triggers {
- <out1: cPortEvent guard {
- "/* TODO activate action code editor */"
- "rPortData.in1 == numberArray[3] &&"
- "transitionData && infoData.flag"
- }>
- }
- action
- {
- "// TODO syntax highlightiing"
- "rPortEvent.out1(true);"
- "rPortData.in1;"
- "rReplEvent[0].out1(true);"
- "rReplEvent.out1(true); // broadcast"
- "cPortEvent.in1();"
- "cPortData.in1(32);"
- "cReplEvent[1].in1();"
- "cReplEvent.in1(); // broadcast"
- "sppEvent[4].out1(true);"
- "sppEvent.out1(true); // broadcast"
- "rPortEvent.regularOp(32);"
- "cPortEvent.conjugatedOp(32);"
- "actorOp(32);"
- "int number = numberArray[0];"
- "DData nestedData = infoData.nested;"
- "int port = infoData.nested.tcpPort;"
- ""
- "// transition event data"
- "int data = (transitionData)? 1 : 0;"
- ""
- "// -- not supported yet by code translation --"
- "// getReplication():"
- "// int replSize1 = rReplEvent.getReplication();"
- "// int replSize2 = cReplEvent.getReplication();"
- "// int replSize2 = sppEvent.getReplication();"
- ""
- "// DataClass operations:"
- "// infoData.operation(32);"
- "// infoData.nested.set(\"127.0.0.1\", 8080);"
+ <out1: cPortEvent guard '''
+ /* TODO activate action code editor */
+ rPortData.in1 == numberArray[3] &&
+ transitionData && infoData.flag
+ '''
+ >
}
+ action '''
+ // TODO syntax highlighting
+ rPortEvent.out1(true);
+ rPortData.in1;
+ rReplEvent[0].out1(true);
+ rReplEvent.out1(true); // broadcast
+ cPortEvent.in1();
+ cPortData.in1(32);
+ cReplEvent[1].in1();
+ cReplEvent.in1(); // broadcast
+ sppEvent[4].out1(true);
+ sppEvent.out1(true); // broadcast
+ rPortEvent.regularOp(32);
+ cPortEvent.conjOp(32);
+ actorOp(32);
+ int number = numberArray[0];
+ DData nestedData = infoData.nested;
+ int port = infoData.nested.tcpPort;
+
+ // transition event data
+ int data = (transitionData)? 1 : 0;
+
+ // -- not supported yet by code translation --
+ // getReplication():
+ // int replSize1 = rReplEvent.getReplication();
+ // int replSize2 = cReplEvent.getReplication();
+ // int replSize2 = sppEvent.getReplication();
+
+ // DataClass operations:
+ // infoData.dataOp(32);
+ // infoData.nested.dataOp("127.0.0.1", 8080);
+ '''
}
Transition guardedTrans: idle -> state2 {
- guard
- {
- "rPortData.in1 == numberArray[3] && infoData.flag && actorOp(32) && rPortEvent.regularOp(32) && cPortEvent.conjugatedOp(32)"
- }
+ guard '''
+ rPortData.in1 == numberArray[3] && infoData.flag && actorOp(32) && rPortEvent.regularOp(32) && cPortEvent.conjOp(32)
+ '''
}
Transition init: initial -> idle
State idle
@@ -90,17 +101,27 @@ RoomModel DetailExpressionTestModel {
}
regular PortClass
{
- Operation regularOp(param: int32): boolean {
- "return true;"
- }
- Attribute regularAttr: int32
+ Attribute regularAttr : boolean = "true"
+ Operation regularOp(param: int32): boolean '''
+ // return regularOp2(param);
+ return true;
+ '''
+ Operation regularOp2(): boolean '''
+ // return regularAttr;
+ return true;
+ '''
}
conjugated PortClass
{
- Operation conjugatedOp(param: int32): boolean {
- "return true;"
- }
- Attribute conjugatedAttr: int32
+ Attribute conjAttr : boolean = "true"
+ Operation conjOp(param: int32): boolean '''
+ // return conjOp2(param);
+ return true;
+ '''
+ Operation conjOp2(): boolean '''
+ // return conjAttr;
+ return true;
+ '''
}
}
@@ -108,40 +129,44 @@ RoomModel DetailExpressionTestModel {
incoming {
Message in1(data: int32)
}
- /* not supported yet
- regular PortClass
- {
- Operation regularOp(param: int32): boolean {
- ""
- }
- Attribute regularAttr: int32
- }
- conjugated PortClass
- {
- Operation conjugatedOp(param: int32): boolean {
- ""
- }
- Attribute conjugatedAttr: int32
- }
- * /*
- */
+ /* not supported yet
+ * regular PortClass
+ * {
+ * Operation regularOp(param: int32): boolean {
+ * ""
+ * }
+ * Attribute regularAttr: int32
+ * }
+ * conjugated PortClass
+ * {
+ * Operation conjugatedOp(param: int32): boolean {
+ * ""
+ * }
+ * Attribute conjugatedAttr: int32
+ * }
+ * /*
+ */
}
DataClass DDataNested {
- Operation dataOp(number: int32) {
- ""
- }
+ Operation dataOp(number: int32) : boolean '''
+ // return dataOp2() && number;
+ return true;
+ '''
+ Operation dataOp2() : boolean '''
+ // nested.dataOp("", 0);
+ // return flag && nested.tcpPort;
+ return true;
+ '''
Attribute flag: boolean
- Attribute array [ 5 ]: int32
+ Attribute array [5]: int32
Attribute nested: DData
}
DataClass DData {
- Operation dataOp(ip: string, port: int32) {
- ""
- }
+ Operation dataOp(ip: string, port: int32) '''
+ '''
Attribute iPAddr: string
Attribute tcpPort: int32
}
-
} \ No newline at end of file

Back to the top