Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Belle2017-10-29 17:58:29 +0000
committerJan Belle2017-10-29 17:58:29 +0000
commitb93d6d7752517d95c8c5af0d0c538fb80de8768e (patch)
tree86dc9d05250c60462dda92841d82afa73496f064 /plugins/org.eclipse.etrice.core.room/src
parent2a669d89c92501424e3522822f4ab5fa1248c604 (diff)
downloadorg.eclipse.etrice-b93d6d7752517d95c8c5af0d0c538fb80de8768e.tar.gz
org.eclipse.etrice-b93d6d7752517d95c8c5af0d0c538fb80de8768e.tar.xz
org.eclipse.etrice-b93d6d7752517d95c8c5af0d0c538fb80de8768e.zip
[core.room] allow annotations at ports and messages
Diffstat (limited to 'plugins/org.eclipse.etrice.core.room/src')
-rw-r--r--plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/Room.xtext12
-rw-r--r--plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/RoomJavaValidator.java6
2 files changed, 14 insertions, 4 deletions
diff --git a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/Room.xtext b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/Room.xtext
index f8e86e160..9015bfd2d 100644
--- a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/Room.xtext
+++ b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/Room.xtext
@@ -143,7 +143,7 @@ CompoundProtocolClass:
SubProtocol: 'SubProtocol' name=ID ':' protocol=[GeneralProtocolClass|FQN];
Message:
- (priv?='private')? 'Message' name=ID '(' (data=VarDecl)? ')'
+ (priv?='private')? 'Message' name=ID '(' (data=VarDecl)? ')' annotations+=Annotation*
(docu=Documentation)?;
PortClass:
@@ -220,7 +220,7 @@ ActorClass:
InterfaceItem: Port | SAP | SPP;
Port:
- (conjugated?='conjugated')? 'Port' name=ID (multiplicity=MULTIPLICITY)? ':' protocol=[GeneralProtocolClass|FQN] (docu=Documentation)?;
+ (conjugated?='conjugated')? 'Port' name=ID (multiplicity=MULTIPLICITY)? ':' protocol=[GeneralProtocolClass|FQN] annotations+=Annotation* (docu=Documentation)?;
ExternalPort:
'external' 'Port' interfacePort=[Port|ID] ;
@@ -334,7 +334,9 @@ AnnotationTargetType:
'ProtocolClass' |
'CompoundProtocolClass' |
'SubSystemClass' |
- 'LogicalSystem'
+ 'LogicalSystem' |
+ 'Port' |
+ 'Message'
;
enum RoomAnnotationTargetEnum:
@@ -344,5 +346,7 @@ enum RoomAnnotationTargetEnum:
PROTOCOL_CLASS='ProtocolClass' |
COMPOUND_PROTOCOL_CLASS='CompoundProtocolClass' |
SUBSYSTEM_CLASS='SubSystemClass' |
- LOGICAL_SYSTEM_CLASS='LogicalSystem'
+ LOGICAL_SYSTEM_CLASS='LogicalSystem' |
+ PORT='Port' |
+ MESSAGE='Message'
;
diff --git a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/RoomJavaValidator.java b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/RoomJavaValidator.java
index bf6ef9189..cf6f2a6b5 100644
--- a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/RoomJavaValidator.java
+++ b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/RoomJavaValidator.java
@@ -727,6 +727,12 @@ public class RoomJavaValidator extends AbstractRoomJavaValidator {
else if(parent instanceof SubSystemClass && !targetList.contains(RoomAnnotationTargetEnum.SUBSYSTEM_CLASS.getLiteral())) {
invalidTargetType = RoomAnnotationTargetEnum.SUBSYSTEM_CLASS;
}
+ else if(parent instanceof Port && !targetList.contains(RoomAnnotationTargetEnum.PORT.getLiteral())) {
+ invalidTargetType = RoomAnnotationTargetEnum.PORT;
+ }
+ else if(parent instanceof Message && !targetList.contains(RoomAnnotationTargetEnum.MESSAGE.getLiteral())) {
+ invalidTargetType = RoomAnnotationTargetEnum.MESSAGE;
+ }
if(invalidTargetType != null) {
error("AnnotationType " + a.getType().getName() + " is not allowed for target " + invalidTargetType.getLiteral(),
a,

Back to the top