Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Haug2012-09-04 06:43:32 -0400
committerJuergen Haug2012-09-04 07:44:32 -0400
commit6fe05eb4d4a8dc783b7d260156d8f0e9fb16f609 (patch)
tree4e0c5b4ca52f6014cde1423d86b9fa85a8666279 /plugins/org.eclipse.etrice.core.config
parent927c25922c80dc2cca4156194c4da89920fa6f0d (diff)
downloadorg.eclipse.etrice-6fe05eb4d4a8dc783b7d260156d8f0e9fb16f609.tar.gz
org.eclipse.etrice-6fe05eb4d4a8dc783b7d260156d8f0e9fb16f609.tar.xz
org.eclipse.etrice-6fe05eb4d4a8dc783b7d260156d8f0e9fb16f609.zip
[CQ 6485][config, runtime] .gitignore for config.tests,
ActorInstanceConfig hyperlinking added, runtime.ui rebuild Change-Id: Ia4ddd0651b9dd7f81207fef7bbcac14b8090a840
Diffstat (limited to 'plugins/org.eclipse.etrice.core.config')
-rw-r--r--plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/config/util/ConfigUtil.java25
-rw-r--r--plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/validation/ConfigJavaValidator.java82
2 files changed, 71 insertions, 36 deletions
diff --git a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/config/util/ConfigUtil.java b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/config/util/ConfigUtil.java
index 1806e6a95..4eb476223 100644
--- a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/config/util/ConfigUtil.java
+++ b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/config/util/ConfigUtil.java
@@ -73,6 +73,31 @@ public class ConfigUtil {
return (ActorClass) result;
}
+
+ public static ActorRef getLastActorRef(ActorContainerClass root,
+ RefPath path) {
+ if(path.getRefs().isEmpty())
+ return null;
+
+ ActorRef lastMatch = null;
+ ActorContainerClass result = root;
+ for (String ref : path.getRefs()) {
+ ActorRef match = null;
+ for (ActorContainerRef actor : RoomHelpers.getRefs(result, true)) {
+ if (actor instanceof ActorRef && actor.getName().equals(ref)) {
+ match = (ActorRef) actor;
+ break;
+ }
+ }
+
+ if (match == null)
+ return null;
+ result = match.getType();
+ lastMatch = match;
+ }
+
+ return lastMatch;
+ }
/**
* returns first invalid path segment else null
diff --git a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/validation/ConfigJavaValidator.java b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/validation/ConfigJavaValidator.java
index 40c2f930d..87d9aa487 100644
--- a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/validation/ConfigJavaValidator.java
+++ b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/validation/ConfigJavaValidator.java
@@ -41,6 +41,7 @@ import org.eclipse.etrice.core.config.util.ConfigUtil;
import org.eclipse.etrice.core.converter.ConfigValueConverterService;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.ActorContainerClass;
+import org.eclipse.etrice.core.room.ActorRef;
import org.eclipse.etrice.core.room.Attribute;
import org.eclipse.etrice.core.room.DataType;
import org.eclipse.etrice.core.room.InterfaceItem;
@@ -95,6 +96,9 @@ public class ConfigJavaValidator extends AbstractConfigJavaValidator {
@Check
public void checkActorClassConfig(ActorClassConfig config) {
+ if (config.getActor().isAbstract())
+ error("abstract actor classes not supported",
+ ConfigPackage.Literals.ACTOR_CLASS_CONFIG__ACTOR);
checkDuplicateAttributes(config.getAttributes(),
ConfigPackage.Literals.ACTOR_CLASS_CONFIG__ATTRIBUTES);
@@ -109,8 +113,17 @@ public class ConfigJavaValidator extends AbstractConfigJavaValidator {
String invalidSegment = ConfigUtil.checkPath(root, path);
if (invalidSegment != null)
error("no match for segment '" + invalidSegment + "'",
- ConfigPackage.eINSTANCE
- .getActorInstanceConfig_Path());
+ ConfigPackage.Literals.ACTOR_INSTANCE_CONFIG__PATH);
+ else {
+ ActorRef aRef = ConfigUtil.getLastActorRef(root, path);
+ if (aRef != null) {
+ if (aRef.getSize() > 1)
+ error("no arrays of actor references supported",
+ ConfigPackage.Literals.ACTOR_INSTANCE_CONFIG__PATH);
+ } else
+ error("invalid actor reference",
+ ConfigPackage.Literals.ACTOR_INSTANCE_CONFIG__PATH);
+ }
}
}
// duplicate port instance config check
@@ -155,18 +168,21 @@ public class ConfigJavaValidator extends AbstractConfigJavaValidator {
@Check
public void checkAttrConfig(AttrConfig config) {
- Attribute attr = config.getAttribute();
- if (attr == null)
+ Attribute a = config.getAttribute();
+ if (a == null)
return;
- DataType type = attr.getRefType().getType();
+ DataType type = a.getRefType().getType();
if (type instanceof PrimitiveType) {
PrimitiveType primitive = (PrimitiveType) type;
checkAttrConfigValue(primitive, config);
} else if (type instanceof DataType) {
if (config.getValue() != null)
- error("not allowed",
- ConfigPackage.eINSTANCE.getAttrConfig_Value());
+ error("not available",
+ ConfigPackage.Literals.ATTR_CONFIG__VALUE);
+ if (a.getSize() > 0)
+ error("DataClass arrays not supported",
+ ConfigPackage.Literals.ATTR_CLASS_CONFIG__ATTRIBUTES);
}
}
@@ -196,19 +212,21 @@ public class ConfigJavaValidator extends AbstractConfigJavaValidator {
if (config.isDynConfig()) {
if (!(config.eContainer() instanceof ActorInstanceConfig))
error("dynamic configuration only at root attributes", feature);
- if(config.eContainer() instanceof ActorInstanceConfig){
- SubSystemClass ssc = ((ActorInstanceConfig)config.eContainer()).getRoot();
+ if (config.eContainer() instanceof ActorInstanceConfig) {
+ SubSystemClass ssc = ((ActorInstanceConfig) config.eContainer())
+ .getRoot();
ConfigModel model = getConfigModel(config);
boolean found = false;
- for(SubSystemConfig c : model.getSubSystemConfigs())
- if(c.getSubSystem().equals(ssc)){
- if(c.getDynConfig() == null)
- error("no source for dynamic config in SubSystemConfig", feature);
- found = true;
+ for (SubSystemConfig c : model.getSubSystemConfigs())
+ if (c.getSubSystem().equals(ssc)) {
+ if (c.getDynConfig() == null)
+ error("no source for dynamic config in SubSystemConfig",
+ feature);
+ found = true;
}
- if(!found)
+ if (!found)
error("no SubSystemConfig found", feature);
-
+
}
}
@@ -346,16 +364,12 @@ public class ConfigJavaValidator extends AbstractConfigJavaValidator {
LiteralType type = primitive.getType();
if (type == LiteralType.INT || type == LiteralType.REAL) {
- if (config.getValue() != null) {
- if (config.getValue().getLiterals().get(0) instanceof IntLiteral) {
- if (!(min instanceof IntLiteral))
- error("incompatible datatype: maximum is not int",
- minRef);
- } else if (config.getValue().getLiterals().get(0) instanceof RealLiteral) {
- if (!(min instanceof RealLiteral))
- error("incompatible datatype: maximum is not real",
- minRef);
- }
+ if (primitive.getType() == LiteralType.INT) {
+ if (!(min instanceof IntLiteral))
+ error("incompatible datatype: maximum is not int", minRef);
+ } else if (primitive.getType() == LiteralType.REAL) {
+ if (!(min instanceof RealLiteral))
+ error("incompatible datatype: maximum is not real", minRef);
}
// check room default if config default is not set
String defaultValue = config.getAttribute()
@@ -411,16 +425,12 @@ public class ConfigJavaValidator extends AbstractConfigJavaValidator {
LiteralType type = primitive.getType();
if (type == LiteralType.INT || type == LiteralType.REAL) {
- if (config.getValue() != null) {
- if (config.getValue().getLiterals().get(0) instanceof IntLiteral) {
- if (!(max instanceof IntLiteral))
- error("incompatible datatype: maximum is not int",
- maxRef);
- } else if (config.getValue().getLiterals().get(0) instanceof RealLiteral) {
- if (!(max instanceof RealLiteral))
- error("incompatible datatype: maximum is not real",
- maxRef);
- }
+ if (primitive.getType() == LiteralType.INT) {
+ if (!(max instanceof IntLiteral))
+ error("incompatible datatype: maximum is not int", maxRef);
+ } else if (primitive.getType() == LiteralType.REAL) {
+ if (!(max instanceof RealLiteral))
+ error("incompatible datatype: maximum is not real", maxRef);
}
// check room default if config default is not set
String defaultValue = config.getAttribute()

Back to the top