diff options
author | Henrik Rentz-Reichert | 2012-11-22 07:47:46 +0000 |
---|---|---|
committer | Henrik Rentz-Reichert | 2012-11-22 07:47:46 +0000 |
commit | 589d8f49b0aee217c64a455ed86847ae856260d8 (patch) | |
tree | adb937aba464328fbd745215b01858e85f1fdf9a /plugins/org.eclipse.etrice.generator.config | |
parent | 0fe4d0820b332d206b821906ca3a3e2bbf1c88df (diff) | |
download | org.eclipse.etrice-589d8f49b0aee217c64a455ed86847ae856260d8.tar.gz org.eclipse.etrice-589d8f49b0aee217c64a455ed86847ae856260d8.tar.xz org.eclipse.etrice-589d8f49b0aee217c64a455ed86847ae856260d8.zip |
[generator, generator.config, generator.java] bug fix for instance path
The new instance path has as first segment the sub system ref name
rather than the sub system class name as before.
Therefore as an intermediate work around for configuration the first
segment is replaced by the old value.
Diffstat (limited to 'plugins/org.eclipse.etrice.generator.config')
2 files changed, 39 insertions, 6 deletions
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 e7b0e7588..0981c3ef4 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 @@ -35,6 +35,7 @@ import org.eclipse.emf.ecore.resource.Resource import org.eclipse.etrice.core.config.ConfigModel
import com.google.inject.Inject
import org.eclipse.xtext.scoping.impl.ImportUriResolver
+import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance
class DataConfiguration implements IDataConfiguration {
@@ -81,12 +82,12 @@ class DataConfiguration implements IDataConfiguration { }
override getAttrInstanceConfigValue(ActorInstance ai, List<Attribute> path) {
- var id = ai.path+"/"+path.toStringPath
+ var id = ai.subsyspath+"/"+path.toStringPath
DataConfigurationHelper::actorInstanceAttrMap.get(id)?.value?.toStringExpr
}
override getAttrInstanceConfigValue(ActorInstance ai, InterfaceItem port, List<Attribute> path) {
- var id = ai.path+"/"+port.name+"/"+path.toStringPath
+ var id = ai.subsyspath+"/"+port.name+"/"+path.toStringPath
DataConfigurationHelper::actorInstanceAttrMap.get(id)?.value?.toStringExpr
}
@@ -177,4 +178,12 @@ class DataConfiguration implements IDataConfiguration { }
}
+ // TODO: this has to be replaced by a simple ai.path later
+ def subsyspath(ActorInstance ai) {
+ var parent = ai.eContainer
+ while (! (parent instanceof SubSystemInstance))
+ parent = parent.eContainer
+ ai.path.replaceFirst("/[a-zA-Z_]+/", "/"+(parent as SubSystemInstance).subSystemClass.name+"/")
+ }
+
}
\ No newline at end of file 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 45e8f6405..be5d41bf6 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 @@ -24,6 +24,7 @@ import org.eclipse.etrice.core.config.StringLiteral; import org.eclipse.etrice.core.config.SubSystemConfig;
import org.eclipse.etrice.core.genmodel.base.ILogger;
import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance;
+import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.Attribute;
import org.eclipse.etrice.core.room.InterfaceItem;
@@ -139,8 +140,8 @@ public class DataConfiguration implements IDataConfiguration { public String getAttrInstanceConfigValue(final ActorInstance ai, final List<Attribute> path) {
String _xblockexpression = null;
{
- String _path = ai.getPath();
- String _plus = (_path + "/");
+ String _subsyspath = this.subsyspath(ai);
+ String _plus = (_subsyspath + "/");
String _stringPath = this.toStringPath(path);
String id = (_plus + _stringPath);
AttrInstanceConfig _get = DataConfigurationHelper.actorInstanceAttrMap.get(id);
@@ -154,8 +155,8 @@ public class DataConfiguration implements IDataConfiguration { public String getAttrInstanceConfigValue(final ActorInstance ai, final InterfaceItem port, final List<Attribute> path) {
String _xblockexpression = null;
{
- String _path = ai.getPath();
- String _plus = (_path + "/");
+ String _subsyspath = this.subsyspath(ai);
+ String _plus = (_subsyspath + "/");
String _name = port.getName();
String _plus_1 = (_plus + _name);
String _plus_2 = (_plus_1 + "/");
@@ -369,4 +370,27 @@ public class DataConfiguration implements IDataConfiguration { }
}
}
+
+ public String subsyspath(final ActorInstance ai) {
+ String _xblockexpression = null;
+ {
+ EObject parent = ai.eContainer();
+ boolean _not = (!(parent instanceof SubSystemInstance));
+ boolean _while = _not;
+ while (_while) {
+ EObject _eContainer = parent.eContainer();
+ parent = _eContainer;
+ boolean _not_1 = (!(parent instanceof SubSystemInstance));
+ _while = _not_1;
+ }
+ String _path = ai.getPath();
+ SubSystemClass _subSystemClass = ((SubSystemInstance) parent).getSubSystemClass();
+ String _name = _subSystemClass.getName();
+ String _plus = ("/" + _name);
+ String _plus_1 = (_plus + "/");
+ String _replaceFirst = _path.replaceFirst("/[a-zA-Z_]+/", _plus_1);
+ _xblockexpression = (_replaceFirst);
+ }
+ return _xblockexpression;
+ }
}
|