Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/contentassist/ConfigProposalProvider.java3
-rw-r--r--plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/validation/ConfigJavaValidator.java7
-rw-r--r--plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/DataConfiguration.xtend9
-rw-r--r--plugins/org.eclipse.etrice.generator.config/xtend-gen/org/eclipse/etrice/generator/config/DataConfiguration.java13
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.xtend4
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/VariableServiceGen.xtend12
-rw-r--r--plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.java7
-rw-r--r--plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/VariableServiceGen.java16
8 files changed, 31 insertions, 40 deletions
diff --git a/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/contentassist/ConfigProposalProvider.java b/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/contentassist/ConfigProposalProvider.java
index c3544f8a1..7b2b5ed7b 100644
--- a/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/contentassist/ConfigProposalProvider.java
+++ b/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/contentassist/ConfigProposalProvider.java
@@ -234,8 +234,7 @@ public class ConfigProposalProvider extends AbstractConfigProposalProvider {
}
if (keyword.getValue().equals("=")) {
if (!config.getAttribute().eIsProxy())
- // TODO-Enum
- if (!(dataType instanceof PrimitiveType))
+ if (!(dataType instanceof PrimitiveType || dataType instanceof EnumerationType))
return true;
}
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 7220cc90a..4d1d7fe69 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
@@ -189,12 +189,17 @@ public class ConfigJavaValidator extends AbstractConfigJavaValidator {
return;
DataType type = attr.getType().getType();
-
+
if (type instanceof PrimitiveType) {
PrimitiveType primitive = (PrimitiveType) type;
checkAttrConfigMin(primitive, config);
checkAttrConfigMax(primitive, config);
+ } else {
+ if(config.getMin() != null)
+ error("min is only allowed for numeric types", ConfigPackage.Literals.ATTR_CLASS_CONFIG__MIN);
+ if(config.getMax() != null)
+ error("max is only allowed for numeric types", ConfigPackage.Literals.ATTR_CLASS_CONFIG__MAX);
}
}
diff --git a/plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/DataConfiguration.xtend b/plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/DataConfiguration.xtend
index b5d1e0c1f..260ce9ea2 100644
--- a/plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/DataConfiguration.xtend
+++ b/plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/DataConfiguration.xtend
@@ -39,6 +39,7 @@ import org.eclipse.etrice.generator.base.IDataConfiguration
import org.eclipse.etrice.generator.base.IResourceURIAcceptor
import org.eclipse.etrice.generator.config.util.DataConfigurationHelper
import org.eclipse.xtext.scoping.impl.ImportUriResolver
+import java.util.HashSet
class DataConfiguration implements IDataConfiguration {
@@ -162,17 +163,17 @@ class DataConfiguration implements IDataConfiguration {
}
override getDynConfigReadAttributes(ActorClass actor) {
- val result = new ArrayList<Attribute>
+ val result = new HashSet<Attribute>
var configs = DataConfigurationHelper::dynActorClassAttrMap.get(actor)
configs?.forEach(c|if(c.readOnly) result.add(c.attribute))
- return result
+ return result.toList
}
override getDynConfigWriteAttributes(ActorClass actor) {
- val result = new ArrayList<Attribute>
+ val result = new HashSet<Attribute>
var configs = DataConfigurationHelper::dynActorClassAttrMap.get(actor)
configs?.forEach(c|if(!c.readOnly) result.add(c.attribute))
- return result
+ return result.toList
}
override void addReferencedModels(IResourceURIAcceptor acceptor, EObject root) {
diff --git a/plugins/org.eclipse.etrice.generator.config/xtend-gen/org/eclipse/etrice/generator/config/DataConfiguration.java b/plugins/org.eclipse.etrice.generator.config/xtend-gen/org/eclipse/etrice/generator/config/DataConfiguration.java
index dca84345d..0bf7c2b15 100644
--- a/plugins/org.eclipse.etrice.generator.config/xtend-gen/org/eclipse/etrice/generator/config/DataConfiguration.java
+++ b/plugins/org.eclipse.etrice.generator.config/xtend-gen/org/eclipse/etrice/generator/config/DataConfiguration.java
@@ -13,6 +13,7 @@ package org.eclipse.etrice.generator.config;
import com.google.common.base.Objects;
import com.google.inject.Inject;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
import org.eclipse.emf.common.EMFPlugin;
import org.eclipse.emf.common.util.EList;
@@ -436,8 +437,8 @@ public class DataConfiguration implements IDataConfiguration {
}
public List<Attribute> getDynConfigReadAttributes(final ActorClass actor) {
- ArrayList<Attribute> _arrayList = new ArrayList<Attribute>();
- final ArrayList<Attribute> result = _arrayList;
+ HashSet<Attribute> _hashSet = new HashSet<Attribute>();
+ final HashSet<Attribute> result = _hashSet;
List<AttrInstanceConfig> configs = DataConfigurationHelper.dynActorClassAttrMap.get(actor);
if (configs!=null) {
final Procedure1<AttrInstanceConfig> _function = new Procedure1<AttrInstanceConfig>() {
@@ -451,12 +452,12 @@ public class DataConfiguration implements IDataConfiguration {
};
IterableExtensions.<AttrInstanceConfig>forEach(configs, _function);
}
- return result;
+ return IterableExtensions.<Attribute>toList(result);
}
public List<Attribute> getDynConfigWriteAttributes(final ActorClass actor) {
- ArrayList<Attribute> _arrayList = new ArrayList<Attribute>();
- final ArrayList<Attribute> result = _arrayList;
+ HashSet<Attribute> _hashSet = new HashSet<Attribute>();
+ final HashSet<Attribute> result = _hashSet;
List<AttrInstanceConfig> configs = DataConfigurationHelper.dynActorClassAttrMap.get(actor);
if (configs!=null) {
final Procedure1<AttrInstanceConfig> _function = new Procedure1<AttrInstanceConfig>() {
@@ -471,7 +472,7 @@ public class DataConfiguration implements IDataConfiguration {
};
IterableExtensions.<AttrInstanceConfig>forEach(configs, _function);
}
- return result;
+ return IterableExtensions.<Attribute>toList(result);
}
public void addReferencedModels(final IResourceURIAcceptor acceptor, final EObject root) {
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.xtend
index e1524d3d3..854e77d16 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.xtend
@@ -141,10 +141,6 @@ class ConfigGenAddon {
«ENDIF»
'''
}
- EnumerationType: {
- // TODO-Enum
- ""
- }
}
}
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/VariableServiceGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/VariableServiceGen.xtend
index 1a65d6c48..18b4a02d9 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/VariableServiceGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/VariableServiceGen.xtend
@@ -145,8 +145,7 @@ class VariableServiceGen {
«FOR dc : getAllDataClasses(dataClasses)»
private void writeDataClass(String id, «dc.typeName» object, Map<String, Object> map){
«FOR a : dc.allAttributes»
-««« TODO-Enum
- «IF a.type.type.primitive»
+ «IF a.type.type.enumerationOrPrimitive»
map.put(id+"/«a.name»", «IF a.size>0»toObjectArray(«ENDIF»object.«invokeGetter(a.name, null)»«IF a.size>0»)«ENDIF»);
«ELSE»
writeDataClass(id+"/«a.name»", object.«invokeGetter(a.name, null)», map);
@@ -212,8 +211,7 @@ class VariableServiceGen {
def private CharSequence genGetAttributeValues(List<Attribute> path, ActorInstance ai){
val a = path.last
- // TODO-Enum
- if (a.type.type.primitive) {
+ if (a.type.type.enumerationOrPrimitive) {
'''
values.put("«ai.path»«path.toAbsolutePath('/')»", «IF a.size>0»toObjectArray(«ENDIF»«ai.varName».«path.invokeGetters(null)»«IF a.size>0»)«ENDIF»);
'''
@@ -232,8 +230,7 @@ class VariableServiceGen {
var a = path.last
var aVarName = path.toAbsolutePath("_")
- // TODO-Enum
- if(a.type.type.primitive){'''
+ if(a.type.type.enumerationOrPrimitive){'''
id = "«ai.path»«path.toAbsolutePath("/")»";
«IF a.size==0»«a.type.type.typeName.toWrapper»«ELSE»«a.type.type.typeName»[]«ENDIF» «aVarName» = null;
object = values.get(id);
@@ -259,8 +256,7 @@ class VariableServiceGen {
var a = path.last
var aVarName = path.toAbsolutePath("_")
- // TODO-Enum
- if (a.type.type.primitive) {
+ if (a.type.type.enumerationOrPrimitive) {
val getters = if(path.size>1)path.take(path.size-1).invokeGetters(null)+"." else ""
'''
if(«aVarName» != null){
diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.java
index 48d131195..9f90c1bbe 100644
--- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.java
+++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.java
@@ -461,13 +461,6 @@ public class ConfigGenAddon {
_switchResult = _xblockexpression_1;
}
}
- if (!_matched) {
- if (aType instanceof EnumerationType) {
- final EnumerationType _enumerationType = (EnumerationType)aType;
- _matched=true;
- _switchResult = "";
- }
- }
_xblockexpression = (_switchResult);
}
return _xblockexpression;
diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/VariableServiceGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/VariableServiceGen.java
index 21026709d..a066ba95d 100644
--- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/VariableServiceGen.java
+++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/VariableServiceGen.java
@@ -411,8 +411,8 @@ public class VariableServiceGen {
{
RefableType _type = a_2.getType();
DataType _type_1 = _type.getType();
- boolean _isPrimitive = this._typeHelpers.isPrimitive(_type_1);
- if (_isPrimitive) {
+ boolean _isEnumerationOrPrimitive = this._typeHelpers.isEnumerationOrPrimitive(_type_1);
+ if (_isEnumerationOrPrimitive) {
_builder.append("\t");
_builder.append("\t");
_builder.append("map.put(id+\"/");
@@ -674,8 +674,8 @@ public class VariableServiceGen {
CharSequence _xifexpression = null;
RefableType _type = a.getType();
DataType _type_1 = _type.getType();
- boolean _isPrimitive = this._typeHelpers.isPrimitive(_type_1);
- if (_isPrimitive) {
+ boolean _isEnumerationOrPrimitive = this._typeHelpers.isEnumerationOrPrimitive(_type_1);
+ if (_isEnumerationOrPrimitive) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("values.put(\"");
String _path = ai.getPath();
@@ -745,8 +745,8 @@ public class VariableServiceGen {
CharSequence _xifexpression = null;
RefableType _type = a.getType();
DataType _type_1 = _type.getType();
- boolean _isPrimitive = this._typeHelpers.isPrimitive(_type_1);
- if (_isPrimitive) {
+ boolean _isEnumerationOrPrimitive = this._typeHelpers.isEnumerationOrPrimitive(_type_1);
+ if (_isEnumerationOrPrimitive) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("id = \"");
String _path = ai.getPath();
@@ -895,8 +895,8 @@ public class VariableServiceGen {
CharSequence _xifexpression = null;
RefableType _type = a.getType();
DataType _type_1 = _type.getType();
- boolean _isPrimitive = this._typeHelpers.isPrimitive(_type_1);
- if (_isPrimitive) {
+ boolean _isEnumerationOrPrimitive = this._typeHelpers.isEnumerationOrPrimitive(_type_1);
+ if (_isEnumerationOrPrimitive) {
CharSequence _xblockexpression_1 = null;
{
String _xifexpression_1 = null;

Back to the top