Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.etrice.core.config/src')
-rw-r--r--plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/Config.xtext330
-rw-r--r--plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/ConfigPostprocessor.ext32
-rw-r--r--plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/ConfigRuntimeModule.java108
-rw-r--r--plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/ConfigStandaloneSetup.java48
-rw-r--r--plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/GenerateConfig.mwe2300
-rw-r--r--plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/config/util/ConfigUtil.java438
-rw-r--r--plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/converter/ConfigValueConverterService.java160
-rw-r--r--plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/formatting/ConfigFormatter.java158
-rw-r--r--plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/postprocessing/DocuPostprocessor.xtend824
-rw-r--r--plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/postprocessing/ImplPostprocesser.xtend136
-rw-r--r--plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/postprocessing/PostprocessorController.java44
-rw-r--r--plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/scoping/ConfigScopeProvider.java350
12 files changed, 1464 insertions, 1464 deletions
diff --git a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/Config.xtext b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/Config.xtext
index 0bda121fb..bc734be63 100644
--- a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/Config.xtext
+++ b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/Config.xtext
@@ -1,165 +1,165 @@
-/*******************************************************************************
- * Copyright (c) 2012 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 and Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-grammar org.eclipse.etrice.core.Config with org.eclipse.xtext.common.Terminals
-
-generate config "http://www.eclipse.org/etrice/core/Config"
-import "http://www.eclipse.org/emf/2002/Ecore" as ecore
-import "http://www.eclipse.org/etrice/Room" as room
-
-ConfigModel:
- 'ConfigModel' name=FQN '{'
- imports+=Import*
- configElements+=ConfigElement*
- '}';
-
-ConfigElement:
- SubSystemConfig | ActorClassConfig | ActorInstanceConfig | ProtocolClassConfig;
-
-SubSystemConfig:
- 'SubSystemConfig' root=[room::LogicalSystem|FQN] '/' subSystem=[room::SubSystemRef|ID] '{'
- dynConfig=DynamicConfig
- '}';
-
-DynamicConfig:
- 'dynamic configuration' '{'
- ((('file path' filePath=STRING) |
- (('user import' userCode1=STRING)
- ('user constructor' userCode2=STRING))) &
- ('polling timer [ms]' polling=INT)?)
- '}';
-
-ActorClassConfig:
- 'ActorClassConfig' actor=[room::ActorClass|FQN] '{'
- (attributes+=AttrClassConfig)*
- '}';
-
-ActorInstanceConfig:
- 'ActorInstanceConfig' root=[room::LogicalSystem|FQN] '/' subSystem=[room::SubSystemRef|ID] '/' path=RefPath '{'
- ((attributes+=AttrInstanceConfig)* &
- (ports+=PortInstanceConfig)*)
- '}';
-
-ProtocolClassConfig:
- 'ProtocolClassConfig' protocol=[room::ProtocolClass|FQN] '{'
- (('regular' regular=PortClassConfig)? &
- ('conjugate' conjugated=PortClassConfig)?)
- '}';
-
-PortClassConfig:
- {PortClassConfig} 'Port' '{'
- (attributes+=AttrClassConfig)*
- '}';
-
-PortInstanceConfig:
- 'InterfaceItem' item=[room::InterfaceItem|ID] '{'
- (attributes+=AttrInstanceConfig)*
- '}';
-
-AttrConfig:
- AttrClassConfig | AttrInstanceConfig;
-
-AttrClassConfig:
- 'Attr' attribute=[room::Attribute] ('=' value=LiteralArray)? ('{'
- (('min' '=' min=NumberLiteral)?
- ('max' '=' max=NumberLiteral)?
- (attributes+=AttrClassConfig)*)
- '}')?;
-
-AttrInstanceConfig:
- 'Attr' attribute=[room::Attribute] ('=' value=LiteralArray)? ('{'
- ((dynConfig?='dynamic configuration' (readOnly?='read' | 'write'))?
- (attributes+=AttrInstanceConfig*))
- '}')?;
-
-RefPath:
- refs+=ID ('/' refs+=ID)*;
-
- // -------------------- from org.eclipse.etrice.core.Room.xtext ---------------
-Import:
- 'import' (importedNamespace=ImportedFQN 'from' | 'model') importURI=STRING;
-
-ImportedFQN:
- FQN ('.*')?;
-
-FQN:
- ID ('.' ID)*;
-
- // -----------------------------------------------------------------------------
-
-//enum Unit:
-// N|
-// W|
-// S = 's'|
-// KG = 'kg'|
-// M = 'm'|
-// C|
-// NM|
-// RPM|
-// V|
-// A|
-// HZ = 'Hz'|
-// KW
-//;
-
-LiteralArray:
- literals+=Literal (',' literals+=Literal)*;
-
- // Value Types for Attributes
-Literal:
- BooleanLiteral |
- NumberLiteral |
- StringLiteral;
-
-BooleanLiteral:
- {BooleanLiteral} ('false' | isTrue?='true');
-
-NumberLiteral:
- IntLiteral | RealLiteral;
-
-RealLiteral:
- {RealLiteral} value=Real;
-
-IntLiteral:
- {IntLiteral} value=Integer;
-
-StringLiteral:
- {StringLiteral} value=STRING;
-
-Integer returns ecore::ELong:
- SignedInteger | Hexadecimal;
-
-SignedInteger hidden():
- ('+' | '-')? INT;
-
-Hexadecimal hidden():
- HEX;
-
-Real returns ecore::EDouble:
- Decimal | DotDecimal | DecimalDot | DecimalExp;
-
-Decimal hidden():
- ('+' | '-')? INT '.' INT;
-
-DotDecimal hidden():
- ('+' | '-')? '.' INT;
-
-DecimalDot hidden():
- ('+' | '-')? INT '.';
-
-DecimalExp hidden():
- ('+' | '-')? INT '.' INT EXP;
-
-terminal EXP:
- ('e' | 'E') ('+' | '-')? ('0'..'9')+;
-
-terminal HEX:
- ('0x' | '0X') ('0'..'9' | 'a'..'f' | 'A'..'F')+;
+/*******************************************************************************
+ * Copyright (c) 2012 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 and Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+grammar org.eclipse.etrice.core.Config with org.eclipse.xtext.common.Terminals
+
+generate config "http://www.eclipse.org/etrice/core/Config"
+import "http://www.eclipse.org/emf/2002/Ecore" as ecore
+import "http://www.eclipse.org/etrice/Room" as room
+
+ConfigModel:
+ 'ConfigModel' name=FQN '{'
+ imports+=Import*
+ configElements+=ConfigElement*
+ '}';
+
+ConfigElement:
+ SubSystemConfig | ActorClassConfig | ActorInstanceConfig | ProtocolClassConfig;
+
+SubSystemConfig:
+ 'SubSystemConfig' root=[room::LogicalSystem|FQN] '/' subSystem=[room::SubSystemRef|ID] '{'
+ dynConfig=DynamicConfig
+ '}';
+
+DynamicConfig:
+ 'dynamic configuration' '{'
+ ((('file path' filePath=STRING) |
+ (('user import' userCode1=STRING)
+ ('user constructor' userCode2=STRING))) &
+ ('polling timer [ms]' polling=INT)?)
+ '}';
+
+ActorClassConfig:
+ 'ActorClassConfig' actor=[room::ActorClass|FQN] '{'
+ (attributes+=AttrClassConfig)*
+ '}';
+
+ActorInstanceConfig:
+ 'ActorInstanceConfig' root=[room::LogicalSystem|FQN] '/' subSystem=[room::SubSystemRef|ID] '/' path=RefPath '{'
+ ((attributes+=AttrInstanceConfig)* &
+ (ports+=PortInstanceConfig)*)
+ '}';
+
+ProtocolClassConfig:
+ 'ProtocolClassConfig' protocol=[room::ProtocolClass|FQN] '{'
+ (('regular' regular=PortClassConfig)? &
+ ('conjugate' conjugated=PortClassConfig)?)
+ '}';
+
+PortClassConfig:
+ {PortClassConfig} 'Port' '{'
+ (attributes+=AttrClassConfig)*
+ '}';
+
+PortInstanceConfig:
+ 'InterfaceItem' item=[room::InterfaceItem|ID] '{'
+ (attributes+=AttrInstanceConfig)*
+ '}';
+
+AttrConfig:
+ AttrClassConfig | AttrInstanceConfig;
+
+AttrClassConfig:
+ 'Attr' attribute=[room::Attribute] ('=' value=LiteralArray)? ('{'
+ (('min' '=' min=NumberLiteral)?
+ ('max' '=' max=NumberLiteral)?
+ (attributes+=AttrClassConfig)*)
+ '}')?;
+
+AttrInstanceConfig:
+ 'Attr' attribute=[room::Attribute] ('=' value=LiteralArray)? ('{'
+ ((dynConfig?='dynamic configuration' (readOnly?='read' | 'write'))?
+ (attributes+=AttrInstanceConfig*))
+ '}')?;
+
+RefPath:
+ refs+=ID ('/' refs+=ID)*;
+
+ // -------------------- from org.eclipse.etrice.core.Room.xtext ---------------
+Import:
+ 'import' (importedNamespace=ImportedFQN 'from' | 'model') importURI=STRING;
+
+ImportedFQN:
+ FQN ('.*')?;
+
+FQN:
+ ID ('.' ID)*;
+
+ // -----------------------------------------------------------------------------
+
+//enum Unit:
+// N|
+// W|
+// S = 's'|
+// KG = 'kg'|
+// M = 'm'|
+// C|
+// NM|
+// RPM|
+// V|
+// A|
+// HZ = 'Hz'|
+// KW
+//;
+
+LiteralArray:
+ literals+=Literal (',' literals+=Literal)*;
+
+ // Value Types for Attributes
+Literal:
+ BooleanLiteral |
+ NumberLiteral |
+ StringLiteral;
+
+BooleanLiteral:
+ {BooleanLiteral} ('false' | isTrue?='true');
+
+NumberLiteral:
+ IntLiteral | RealLiteral;
+
+RealLiteral:
+ {RealLiteral} value=Real;
+
+IntLiteral:
+ {IntLiteral} value=Integer;
+
+StringLiteral:
+ {StringLiteral} value=STRING;
+
+Integer returns ecore::ELong:
+ SignedInteger | Hexadecimal;
+
+SignedInteger hidden():
+ ('+' | '-')? INT;
+
+Hexadecimal hidden():
+ HEX;
+
+Real returns ecore::EDouble:
+ Decimal | DotDecimal | DecimalDot | DecimalExp;
+
+Decimal hidden():
+ ('+' | '-')? INT '.' INT;
+
+DotDecimal hidden():
+ ('+' | '-')? '.' INT;
+
+DecimalDot hidden():
+ ('+' | '-')? INT '.';
+
+DecimalExp hidden():
+ ('+' | '-')? INT '.' INT EXP;
+
+terminal EXP:
+ ('e' | 'E') ('+' | '-')? ('0'..'9')+;
+
+terminal HEX:
+ ('0x' | '0X') ('0'..'9' | 'a'..'f' | 'A'..'F')+;
diff --git a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/ConfigPostprocessor.ext b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/ConfigPostprocessor.ext
index 8614ef026..4e0fdc8fb 100644
--- a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/ConfigPostprocessor.ext
+++ b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/ConfigPostprocessor.ext
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2012 Juergen Haug
- * 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
- *
- *******************************************************************************/
-
-import xtext;
-
-process(GeneratedMetamodel this) :
- JAVA org.eclipse.etrice.core.postprocessing.PostprocessorController.process(org.eclipse.xtext.GeneratedMetamodel)
+/*******************************************************************************
+ * Copyright (c) 2012 Juergen Haug
+ * 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
+ *
+ *******************************************************************************/
+
+import xtext;
+
+process(GeneratedMetamodel this) :
+ JAVA org.eclipse.etrice.core.postprocessing.PostprocessorController.process(org.eclipse.xtext.GeneratedMetamodel)
; \ No newline at end of file
diff --git a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/ConfigRuntimeModule.java b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/ConfigRuntimeModule.java
index 2882444e4..831ce5ece 100644
--- a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/ConfigRuntimeModule.java
+++ b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/ConfigRuntimeModule.java
@@ -1,54 +1,54 @@
-/*******************************************************************************
- * Copyright (c) 2012 Juergen Haug
- * 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
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.core;
-
-import org.eclipse.etrice.core.converter.ConfigValueConverterService;
-import org.eclipse.etrice.core.scoping.PlatformRelativeUriResolver;
-import org.eclipse.xtext.conversion.IValueConverterService;
-import org.eclipse.xtext.scoping.impl.ImportUriResolver;
-
-import com.google.inject.Binder;
-
-/**
- * Use this class to register components to be used at runtime / without the
- * Equinox extension registry.
- */
-public class ConfigRuntimeModule extends
- org.eclipse.etrice.core.AbstractConfigRuntimeModule {
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.etrice.core.AbstractRoomRuntimeModule#
- * configureIScopeProviderDelegate(com.google.inject.Binder)
- */
- @Override
- public void configureIScopeProviderDelegate(Binder binder) {
- binder.bind(org.eclipse.xtext.scoping.IScopeProvider.class)
- .annotatedWith(
- com.google.inject.name.Names
- .named(org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider.NAMED_DELEGATE))
- .to(org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider.class);
- }
-
- // HOWTO: use URI imports - need special URI resolver
- public Class<? extends ImportUriResolver> bindImportUriResolver() {
- return PlatformRelativeUriResolver.class;
- }
-
- @Override
- public Class<? extends IValueConverterService> bindIValueConverterService() {
- return ConfigValueConverterService.class;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Juergen Haug
+ * 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
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.core;
+
+import org.eclipse.etrice.core.converter.ConfigValueConverterService;
+import org.eclipse.etrice.core.scoping.PlatformRelativeUriResolver;
+import org.eclipse.xtext.conversion.IValueConverterService;
+import org.eclipse.xtext.scoping.impl.ImportUriResolver;
+
+import com.google.inject.Binder;
+
+/**
+ * Use this class to register components to be used at runtime / without the
+ * Equinox extension registry.
+ */
+public class ConfigRuntimeModule extends
+ org.eclipse.etrice.core.AbstractConfigRuntimeModule {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.etrice.core.AbstractRoomRuntimeModule#
+ * configureIScopeProviderDelegate(com.google.inject.Binder)
+ */
+ @Override
+ public void configureIScopeProviderDelegate(Binder binder) {
+ binder.bind(org.eclipse.xtext.scoping.IScopeProvider.class)
+ .annotatedWith(
+ com.google.inject.name.Names
+ .named(org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider.NAMED_DELEGATE))
+ .to(org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider.class);
+ }
+
+ // HOWTO: use URI imports - need special URI resolver
+ public Class<? extends ImportUriResolver> bindImportUriResolver() {
+ return PlatformRelativeUriResolver.class;
+ }
+
+ @Override
+ public Class<? extends IValueConverterService> bindIValueConverterService() {
+ return ConfigValueConverterService.class;
+ }
+
+}
diff --git a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/ConfigStandaloneSetup.java b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/ConfigStandaloneSetup.java
index b602020e2..a7912b044 100644
--- a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/ConfigStandaloneSetup.java
+++ b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/ConfigStandaloneSetup.java
@@ -1,24 +1,24 @@
-/*******************************************************************************
- * Copyright (c) 2012 Juergen Haug
- * 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
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.core;
-
-/**
- * Initialization support for running Xtext languages without equinox extension
- * registry
- */
-public class ConfigStandaloneSetup extends ConfigStandaloneSetupGenerated {
-
- public static void doSetup() {
- new ConfigStandaloneSetup().createInjectorAndDoEMFRegistration();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Juergen Haug
+ * 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
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.core;
+
+/**
+ * Initialization support for running Xtext languages without equinox extension
+ * registry
+ */
+public class ConfigStandaloneSetup extends ConfigStandaloneSetupGenerated {
+
+ public static void doSetup() {
+ new ConfigStandaloneSetup().createInjectorAndDoEMFRegistration();
+ }
+}
diff --git a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/GenerateConfig.mwe2 b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/GenerateConfig.mwe2
index 7cffbe35d..442af0d39 100644
--- a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/GenerateConfig.mwe2
+++ b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/GenerateConfig.mwe2
@@ -1,150 +1,150 @@
-/*******************************************************************************
- * Copyright (c) 2012 Juergen Haug
- * 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
- *
- *******************************************************************************/
-
-module org.eclipse.etrice.core.GenerateConfig
-
-import org.eclipse.emf.mwe.utils.*
-import org.eclipse.xtext.generator.*
-import org.eclipse.xtext.ui.generator.*
-
-var grammarURI = "classpath:/org/eclipse/etrice/core/Config.xtext"
-var file.extensions = "config"
-var projectName = "org.eclipse.etrice.core.config"
-var runtimeProject = "../${projectName}"
-
-Workflow {
- bean = StandaloneSetup {
- scanClassPath = true
- platformUri = "${runtimeProject}/.."
- registerGenModelFile = "platform:/resource/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/Room.genmodel"
- registerGeneratedEPackage = "org.eclipse.etrice.core.room.RoomPackage"
- }
-
- component = DirectoryCleaner {
- directory = "${runtimeProject}/src-gen"
- }
-
- component = DirectoryCleaner {
- directory = "${runtimeProject}.ui/src-gen"
- }
-
- component = Generator {
- pathRtProject = runtimeProject
- pathUiProject = "${runtimeProject}.ui"
- pathTestProject = "../../tests/${projectName}.tests"
- projectNameRt = projectName
- projectNameUi = "${projectName}.ui"
- language = {
- uri = grammarURI
- fileExtensions = file.extensions
-
- // Java API to access grammar elements (required by several other fragments)
- fragment = grammarAccess.GrammarAccessFragment {}
-
- // generates Java API for the generated EPackages
- fragment = ecore.EcoreGeneratorFragment {
- // referencedGenModels = "
- // platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel,
- // platform:/resource/org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel
- // "
- }
-
- // Serializer 2.0
- fragment = serializer.SerializerFragment {
- generateStub = false
- }
-
- // the serialization component (1.0)
- // fragment = parseTreeConstructor.ParseTreeConstructorFragment {}
-
- // a custom ResourceFactory for use with EMF
- fragment = resourceFactory.ResourceFactoryFragment {
- fileExtensions = file.extensions
- }
-
- // The antlr parser generator fragment.
- fragment = parser.antlr.XtextAntlrGeneratorFragment {
- // options = {
- // backtrack = true
- // }
- }
-
- // java-based API for validation
- fragment = validation.JavaValidatorFragment {
- composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
- // composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
- }
-
- // scoping and exporting API
- // fragment = scoping.ImportURIScopingFragment {}
- // fragment = exporting.SimpleNamesFragment {}
-
- // scoping and exporting API
- fragment = scoping.ImportURIScopingFragment {}
- // fragment = scoping.ImportNamespacesScopingFragment {}
- fragment = exporting.QualifiedNamesFragment {}
- //fragment = builder.BuilderIntegrationFragment {}
-
- // generator API
- fragment = generator.GeneratorFragment {
- generateMwe = false
- generateJavaMain = false
- }
-
- // formatter API
- fragment = formatting.FormatterFragment {}
-
- // labeling API
- fragment = labeling.LabelProviderFragment {}
-
- // outline API
- fragment = outline.OutlineTreeProviderFragment {}
- fragment = outline.QuickOutlineFragment {}
-
- // quickfix API
- fragment = quickfix.QuickfixProviderFragment {}
-
- // content assist API
- fragment = contentAssist.JavaBasedContentAssistFragment {}
-
- // generates a more lightweight Antlr parser and lexer tailored for content assist
- fragment = parser.antlr.XtextAntlrUiGeneratorFragment {}
-
- // generates junit test support classes into Generator#pathTestProject
- fragment = junit.Junit4Fragment {}
-
- // project wizard (optional)
- // fragment = projectWizard.SimpleProjectWizardFragment {
- // generatorProjectName = "${projectName}"
- // modelFileExtension = file.extensions
- // }
-
- // rename refactoring
- fragment = refactoring.RefactorElementNameFragment {}
-
- // provides the necessary bindings for java types integration
- // fragment = types.TypesGeneratorFragment {}
-
- // generates the required bindings only if the grammar inherits from Xbase
- fragment = xbase.XbaseGeneratorFragment {}
-
- // provides a preference page for template proposals
- fragment = templates.CodetemplatesGeneratorFragment {}
-
- // provides a compare view
- fragment = compare.CompareFragment {
- fileExtensions = file.extensions
- }
-
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Juergen Haug
+ * 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
+ *
+ *******************************************************************************/
+
+module org.eclipse.etrice.core.GenerateConfig
+
+import org.eclipse.emf.mwe.utils.*
+import org.eclipse.xtext.generator.*
+import org.eclipse.xtext.ui.generator.*
+
+var grammarURI = "classpath:/org/eclipse/etrice/core/Config.xtext"
+var file.extensions = "config"
+var projectName = "org.eclipse.etrice.core.config"
+var runtimeProject = "../${projectName}"
+
+Workflow {
+ bean = StandaloneSetup {
+ scanClassPath = true
+ platformUri = "${runtimeProject}/.."
+ registerGenModelFile = "platform:/resource/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/Room.genmodel"
+ registerGeneratedEPackage = "org.eclipse.etrice.core.room.RoomPackage"
+ }
+
+ component = DirectoryCleaner {
+ directory = "${runtimeProject}/src-gen"
+ }
+
+ component = DirectoryCleaner {
+ directory = "${runtimeProject}.ui/src-gen"
+ }
+
+ component = Generator {
+ pathRtProject = runtimeProject
+ pathUiProject = "${runtimeProject}.ui"
+ pathTestProject = "../../tests/${projectName}.tests"
+ projectNameRt = projectName
+ projectNameUi = "${projectName}.ui"
+ language = {
+ uri = grammarURI
+ fileExtensions = file.extensions
+
+ // Java API to access grammar elements (required by several other fragments)
+ fragment = grammarAccess.GrammarAccessFragment {}
+
+ // generates Java API for the generated EPackages
+ fragment = ecore.EcoreGeneratorFragment {
+ // referencedGenModels = "
+ // platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel,
+ // platform:/resource/org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel
+ // "
+ }
+
+ // Serializer 2.0
+ fragment = serializer.SerializerFragment {
+ generateStub = false
+ }
+
+ // the serialization component (1.0)
+ // fragment = parseTreeConstructor.ParseTreeConstructorFragment {}
+
+ // a custom ResourceFactory for use with EMF
+ fragment = resourceFactory.ResourceFactoryFragment {
+ fileExtensions = file.extensions
+ }
+
+ // The antlr parser generator fragment.
+ fragment = parser.antlr.XtextAntlrGeneratorFragment {
+ // options = {
+ // backtrack = true
+ // }
+ }
+
+ // java-based API for validation
+ fragment = validation.JavaValidatorFragment {
+ composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
+ // composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
+ }
+
+ // scoping and exporting API
+ // fragment = scoping.ImportURIScopingFragment {}
+ // fragment = exporting.SimpleNamesFragment {}
+
+ // scoping and exporting API
+ fragment = scoping.ImportURIScopingFragment {}
+ // fragment = scoping.ImportNamespacesScopingFragment {}
+ fragment = exporting.QualifiedNamesFragment {}
+ //fragment = builder.BuilderIntegrationFragment {}
+
+ // generator API
+ fragment = generator.GeneratorFragment {
+ generateMwe = false
+ generateJavaMain = false
+ }
+
+ // formatter API
+ fragment = formatting.FormatterFragment {}
+
+ // labeling API
+ fragment = labeling.LabelProviderFragment {}
+
+ // outline API
+ fragment = outline.OutlineTreeProviderFragment {}
+ fragment = outline.QuickOutlineFragment {}
+
+ // quickfix API
+ fragment = quickfix.QuickfixProviderFragment {}
+
+ // content assist API
+ fragment = contentAssist.JavaBasedContentAssistFragment {}
+
+ // generates a more lightweight Antlr parser and lexer tailored for content assist
+ fragment = parser.antlr.XtextAntlrUiGeneratorFragment {}
+
+ // generates junit test support classes into Generator#pathTestProject
+ fragment = junit.Junit4Fragment {}
+
+ // project wizard (optional)
+ // fragment = projectWizard.SimpleProjectWizardFragment {
+ // generatorProjectName = "${projectName}"
+ // modelFileExtension = file.extensions
+ // }
+
+ // rename refactoring
+ fragment = refactoring.RefactorElementNameFragment {}
+
+ // provides the necessary bindings for java types integration
+ // fragment = types.TypesGeneratorFragment {}
+
+ // generates the required bindings only if the grammar inherits from Xbase
+ fragment = xbase.XbaseGeneratorFragment {}
+
+ // provides a preference page for template proposals
+ fragment = templates.CodetemplatesGeneratorFragment {}
+
+ // provides a compare view
+ fragment = compare.CompareFragment {
+ fileExtensions = file.extensions
+ }
+
+ }
+ }
+}
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 0a7238da2..c922bf933 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
@@ -1,219 +1,219 @@
-/*******************************************************************************
- * Copyright (c) 2012 Juergen Haug
- * 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
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.core.config.util;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.etrice.core.config.ActorInstanceConfig;
-import org.eclipse.etrice.core.config.PortInstanceConfig;
-import org.eclipse.etrice.core.config.RefPath;
-import org.eclipse.etrice.core.config.SubSystemConfig;
-import org.eclipse.etrice.core.room.ActorClass;
-import org.eclipse.etrice.core.room.ActorContainerClass;
-import org.eclipse.etrice.core.room.ActorContainerRef;
-import org.eclipse.etrice.core.room.ActorRef;
-import org.eclipse.etrice.core.room.Attribute;
-import org.eclipse.etrice.core.room.DataClass;
-import org.eclipse.etrice.core.room.DataType;
-import org.eclipse.etrice.core.room.ExternalPort;
-import org.eclipse.etrice.core.room.InterfaceItem;
-import org.eclipse.etrice.core.room.LiteralType;
-import org.eclipse.etrice.core.room.Port;
-import org.eclipse.etrice.core.room.PortClass;
-import org.eclipse.etrice.core.room.PrimitiveType;
-import org.eclipse.etrice.core.room.ProtocolClass;
-import org.eclipse.etrice.core.room.SAPRef;
-import org.eclipse.etrice.core.room.SubSystemClass;
-import org.eclipse.etrice.core.room.util.RoomHelpers;
-
-public class ConfigUtil {
-
- public static LiteralType getLiteralType(Attribute attr) {
- if (attr == null)
- return null;
-
- if (attr.getRefType() != null) {
- DataType type = attr.getRefType().getType();
- if (type instanceof PrimitiveType) {
- return ((PrimitiveType) type).getType();
- }
- }
-
- return null;
- }
-
- public static ActorClass resolve(ActorContainerClass root, RefPath path) {
- if (path.getRefs().isEmpty())
- return 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();
- }
-
- 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
- *
- * @param root
- * @param path
- * @return
- */
- public static String checkPath(ActorContainerClass root, RefPath path) {
- if (path == null)
- return null;
-
- ActorContainerClass last = root;
- Iterator<String> it = path.getRefs().iterator();
- String ref;
- while (it.hasNext()) {
- ref = it.next();
- // actor
- ActorRef match = null;
- for (ActorRef actor : last.getActorRefs()) {
- if (actor.getName().equals(ref)) {
- match = actor;
- break;
- }
- }
- // port
- List<InterfaceItem> ifs = new ArrayList<InterfaceItem>();
- ifs.addAll(last.getIfSPPs());
- if (last instanceof ActorClass) {
- ActorClass actor = (ActorClass) last;
- ifs.addAll(actor.getIfPorts());
- ifs.addAll(actor.getIntPorts());
- }
- if (last instanceof SubSystemClass)
- ifs.addAll(((SubSystemClass) last).getRelayPorts());
- for (InterfaceItem item : ifs) {
- // not nested, quit if last segment
- if (item.getName().equals(ref) && !it.hasNext())
- return null;
- }
- if (match == null)
- return ref;
- last = match.getType();
- }
-
- return null;
- }
-
- public static PortClass getPortClass(PortInstanceConfig config) {
- InterfaceItem item = config.getItem();
- PortClass portClass = null;
- if (item instanceof Port) {
- Port port = (Port) item;
- if (port.getProtocol() instanceof ProtocolClass) {
- ProtocolClass protocol = (ProtocolClass) port.getProtocol();
- if (port.isConjugated())
- portClass = protocol.getConjugate();
- else
- portClass = protocol.getRegular();
- }
- } else if (item instanceof SAPRef) {
- ProtocolClass protocol = ((SAPRef) item).getProtocol();
- if (protocol.getConjugate() != null)
- portClass = protocol.getConjugate();
- }
-
- return portClass;
- }
-
- public static List<InterfaceItem> getConfigurableInterfaceItems(
- ActorContainerClass acc, boolean includeInherited) {
- ArrayList<InterfaceItem> result = new ArrayList<InterfaceItem>();
-
- if (acc instanceof ActorClass) {
- ActorClass ac = (ActorClass) acc;
- do {
- result.addAll(ac.getIntPorts());
- result.addAll(ac.getStrSAPs());
- for (ExternalPort ext : ac.getExtPorts())
- result.add(ext.getIfport());
- ac = ac.getBase();
- } while (includeInherited && ac != null);
- } else if (acc instanceof SubSystemClass) {
- // nothing
- }
-
- return result;
- }
-
- public static String getPath(ActorInstanceConfig config) {
- String path = "/" + config.getRoot().getName() + "/"
- + config.getSubSystem().getName();
- for (String s : config.getPath().getRefs())
- path += "/" + s;
-
- return path;
- }
-
- public static String getPath(SubSystemConfig config) {
- return "/" + config.getRoot().getName() + "/"
- + config.getSubSystem().getName();
- }
-
- public static List<Attribute> filterConfigurableAttributes(
- List<Attribute> attributes) {
- List<Attribute> result = new ArrayList<Attribute>();
- for (Attribute a : attributes) {
- if (!a.getRefType().isRef())
- if (a.getRefType().getType() instanceof PrimitiveType
- || (a.getRefType().getType() instanceof DataClass && a
- .getSize() == 0))
- result.add(a);
- }
-
- return result;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Juergen Haug
+ * 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
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.core.config.util;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.etrice.core.config.ActorInstanceConfig;
+import org.eclipse.etrice.core.config.PortInstanceConfig;
+import org.eclipse.etrice.core.config.RefPath;
+import org.eclipse.etrice.core.config.SubSystemConfig;
+import org.eclipse.etrice.core.room.ActorClass;
+import org.eclipse.etrice.core.room.ActorContainerClass;
+import org.eclipse.etrice.core.room.ActorContainerRef;
+import org.eclipse.etrice.core.room.ActorRef;
+import org.eclipse.etrice.core.room.Attribute;
+import org.eclipse.etrice.core.room.DataClass;
+import org.eclipse.etrice.core.room.DataType;
+import org.eclipse.etrice.core.room.ExternalPort;
+import org.eclipse.etrice.core.room.InterfaceItem;
+import org.eclipse.etrice.core.room.LiteralType;
+import org.eclipse.etrice.core.room.Port;
+import org.eclipse.etrice.core.room.PortClass;
+import org.eclipse.etrice.core.room.PrimitiveType;
+import org.eclipse.etrice.core.room.ProtocolClass;
+import org.eclipse.etrice.core.room.SAPRef;
+import org.eclipse.etrice.core.room.SubSystemClass;
+import org.eclipse.etrice.core.room.util.RoomHelpers;
+
+public class ConfigUtil {
+
+ public static LiteralType getLiteralType(Attribute attr) {
+ if (attr == null)
+ return null;
+
+ if (attr.getRefType() != null) {
+ DataType type = attr.getRefType().getType();
+ if (type instanceof PrimitiveType) {
+ return ((PrimitiveType) type).getType();
+ }
+ }
+
+ return null;
+ }
+
+ public static ActorClass resolve(ActorContainerClass root, RefPath path) {
+ if (path.getRefs().isEmpty())
+ return 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();
+ }
+
+ 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
+ *
+ * @param root
+ * @param path
+ * @return
+ */
+ public static String checkPath(ActorContainerClass root, RefPath path) {
+ if (path == null)
+ return null;
+
+ ActorContainerClass last = root;
+ Iterator<String> it = path.getRefs().iterator();
+ String ref;
+ while (it.hasNext()) {
+ ref = it.next();
+ // actor
+ ActorRef match = null;
+ for (ActorRef actor : last.getActorRefs()) {
+ if (actor.getName().equals(ref)) {
+ match = actor;
+ break;
+ }
+ }
+ // port
+ List<InterfaceItem> ifs = new ArrayList<InterfaceItem>();
+ ifs.addAll(last.getIfSPPs());
+ if (last instanceof ActorClass) {
+ ActorClass actor = (ActorClass) last;
+ ifs.addAll(actor.getIfPorts());
+ ifs.addAll(actor.getIntPorts());
+ }
+ if (last instanceof SubSystemClass)
+ ifs.addAll(((SubSystemClass) last).getRelayPorts());
+ for (InterfaceItem item : ifs) {
+ // not nested, quit if last segment
+ if (item.getName().equals(ref) && !it.hasNext())
+ return null;
+ }
+ if (match == null)
+ return ref;
+ last = match.getType();
+ }
+
+ return null;
+ }
+
+ public static PortClass getPortClass(PortInstanceConfig config) {
+ InterfaceItem item = config.getItem();
+ PortClass portClass = null;
+ if (item instanceof Port) {
+ Port port = (Port) item;
+ if (port.getProtocol() instanceof ProtocolClass) {
+ ProtocolClass protocol = (ProtocolClass) port.getProtocol();
+ if (port.isConjugated())
+ portClass = protocol.getConjugate();
+ else
+ portClass = protocol.getRegular();
+ }
+ } else if (item instanceof SAPRef) {
+ ProtocolClass protocol = ((SAPRef) item).getProtocol();
+ if (protocol.getConjugate() != null)
+ portClass = protocol.getConjugate();
+ }
+
+ return portClass;
+ }
+
+ public static List<InterfaceItem> getConfigurableInterfaceItems(
+ ActorContainerClass acc, boolean includeInherited) {
+ ArrayList<InterfaceItem> result = new ArrayList<InterfaceItem>();
+
+ if (acc instanceof ActorClass) {
+ ActorClass ac = (ActorClass) acc;
+ do {
+ result.addAll(ac.getIntPorts());
+ result.addAll(ac.getStrSAPs());
+ for (ExternalPort ext : ac.getExtPorts())
+ result.add(ext.getIfport());
+ ac = ac.getBase();
+ } while (includeInherited && ac != null);
+ } else if (acc instanceof SubSystemClass) {
+ // nothing
+ }
+
+ return result;
+ }
+
+ public static String getPath(ActorInstanceConfig config) {
+ String path = "/" + config.getRoot().getName() + "/"
+ + config.getSubSystem().getName();
+ for (String s : config.getPath().getRefs())
+ path += "/" + s;
+
+ return path;
+ }
+
+ public static String getPath(SubSystemConfig config) {
+ return "/" + config.getRoot().getName() + "/"
+ + config.getSubSystem().getName();
+ }
+
+ public static List<Attribute> filterConfigurableAttributes(
+ List<Attribute> attributes) {
+ List<Attribute> result = new ArrayList<Attribute>();
+ for (Attribute a : attributes) {
+ if (!a.getRefType().isRef())
+ if (a.getRefType().getType() instanceof PrimitiveType
+ || (a.getRefType().getType() instanceof DataClass && a
+ .getSize() == 0))
+ result.add(a);
+ }
+
+ return result;
+ }
+}
diff --git a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/converter/ConfigValueConverterService.java b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/converter/ConfigValueConverterService.java
index 3c1c47109..af902b83a 100644
--- a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/converter/ConfigValueConverterService.java
+++ b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/converter/ConfigValueConverterService.java
@@ -1,80 +1,80 @@
-/*******************************************************************************
- * Copyright (c) 2012 Juergen Haug
- * 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
- *
- *******************************************************************************/
-package org.eclipse.etrice.core.converter;
-
-import org.eclipse.xtext.common.services.DefaultTerminalConverters;
-import org.eclipse.xtext.conversion.IValueConverter;
-import org.eclipse.xtext.conversion.ValueConverter;
-import org.eclipse.xtext.conversion.ValueConverterException;
-import org.eclipse.xtext.conversion.impl.AbstractLexerBasedConverter;
-import org.eclipse.xtext.nodemodel.INode;
-import org.eclipse.xtext.util.Strings;
-
-public class ConfigValueConverterService extends DefaultTerminalConverters {
-
- @ValueConverter(rule = "Integer")
- public IValueConverter<Long> getLongConverter() {
- return new LongConverter();
- }
-
- @ValueConverter(rule = "Real")
- public IValueConverter<Double> getRealConverter() {
- return new DoubleConverter();
- }
-
- public class LongConverter extends AbstractLexerBasedConverter<Long> {
-
- @Override
- public Long toValue(String string, INode node)
- throws ValueConverterException {
- if (Strings.isEmpty(string))
- throw new ValueConverterException(
- "Couldn't convert empty string to integer.", node, null);
- if (string.startsWith("0x") || string.startsWith("0X")) {
- try {
- long value = Long.parseLong(string.substring(2), 16);
- return value;
- } catch (NumberFormatException e) {
- throw new ValueConverterException("Couldn't convert '"
- + string + "' to hex.", node, e);
- }
- } else {
- try {
- long value = Long.parseLong(string);
- return value;
- } catch (NumberFormatException e) {
- throw new ValueConverterException("Couldn't convert '"
- + string + "' to integer.", node, e);
- }
- }
- }
- }
-
- public class DoubleConverter extends AbstractLexerBasedConverter<Double> {
-
- @Override
- public Double toValue(String string, INode node)
- throws ValueConverterException {
- if (Strings.isEmpty(string))
- throw new ValueConverterException(
- "Couldn't convert empty string to double.", node, null);
- try {
- double value = Double.parseDouble(string);
- return value;
- } catch (NumberFormatException e) {
- throw new ValueConverterException("Couldn't convert '" + string
- + "' to double.", node, e);
- }
- }
-
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Juergen Haug
+ * 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
+ *
+ *******************************************************************************/
+package org.eclipse.etrice.core.converter;
+
+import org.eclipse.xtext.common.services.DefaultTerminalConverters;
+import org.eclipse.xtext.conversion.IValueConverter;
+import org.eclipse.xtext.conversion.ValueConverter;
+import org.eclipse.xtext.conversion.ValueConverterException;
+import org.eclipse.xtext.conversion.impl.AbstractLexerBasedConverter;
+import org.eclipse.xtext.nodemodel.INode;
+import org.eclipse.xtext.util.Strings;
+
+public class ConfigValueConverterService extends DefaultTerminalConverters {
+
+ @ValueConverter(rule = "Integer")
+ public IValueConverter<Long> getLongConverter() {
+ return new LongConverter();
+ }
+
+ @ValueConverter(rule = "Real")
+ public IValueConverter<Double> getRealConverter() {
+ return new DoubleConverter();
+ }
+
+ public class LongConverter extends AbstractLexerBasedConverter<Long> {
+
+ @Override
+ public Long toValue(String string, INode node)
+ throws ValueConverterException {
+ if (Strings.isEmpty(string))
+ throw new ValueConverterException(
+ "Couldn't convert empty string to integer.", node, null);
+ if (string.startsWith("0x") || string.startsWith("0X")) {
+ try {
+ long value = Long.parseLong(string.substring(2), 16);
+ return value;
+ } catch (NumberFormatException e) {
+ throw new ValueConverterException("Couldn't convert '"
+ + string + "' to hex.", node, e);
+ }
+ } else {
+ try {
+ long value = Long.parseLong(string);
+ return value;
+ } catch (NumberFormatException e) {
+ throw new ValueConverterException("Couldn't convert '"
+ + string + "' to integer.", node, e);
+ }
+ }
+ }
+ }
+
+ public class DoubleConverter extends AbstractLexerBasedConverter<Double> {
+
+ @Override
+ public Double toValue(String string, INode node)
+ throws ValueConverterException {
+ if (Strings.isEmpty(string))
+ throw new ValueConverterException(
+ "Couldn't convert empty string to double.", node, null);
+ try {
+ double value = Double.parseDouble(string);
+ return value;
+ } catch (NumberFormatException e) {
+ throw new ValueConverterException("Couldn't convert '" + string
+ + "' to double.", node, e);
+ }
+ }
+
+ }
+}
diff --git a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/formatting/ConfigFormatter.java b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/formatting/ConfigFormatter.java
index f11d5d8d1..a8e379617 100644
--- a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/formatting/ConfigFormatter.java
+++ b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/formatting/ConfigFormatter.java
@@ -1,79 +1,79 @@
-/*******************************************************************************
- * Copyright (c) 2012 Juergen Haug
- * 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
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.core.formatting;
-
-import org.eclipse.etrice.core.services.ConfigGrammarAccess;
-import org.eclipse.xtext.Keyword;
-import org.eclipse.xtext.formatting.impl.AbstractDeclarativeFormatter;
-import org.eclipse.xtext.formatting.impl.FormattingConfig;
-import org.eclipse.xtext.util.Pair;
-
-/**
- * This class contains custom formatting description.
- *
- * see : http://www.eclipse.org/Xtext/documentation/latest/xtext.html#formatting
- * on how and when to use it
- *
- * Also see {@link org.eclipse.xtext.xtext.XtextFormattingTokenSerializer} as an example
- */
-public class ConfigFormatter extends AbstractDeclarativeFormatter {
-
- @Override
- protected void configureFormatting(FormattingConfig c) {
- ConfigGrammarAccess f = (ConfigGrammarAccess) getGrammarAccess();
-
- // general
-// Set<String> keywords = GrammarUtil.getAllKeywords(grammar.getGrammar());
-// System.out.println("Config keywords:");
-// for (String kw : keywords) {
-// System.out.println(kw+",");
-// }
-
- c.setAutoLinewrap(120);
- c.setLinewrap(1).before(f.getSL_COMMENTRule());
- c.setLinewrap(2).before(f.getML_COMMENTRule());
-
- for (Pair<Keyword, Keyword> pair : f.findKeywordPairs("{", "}")) {
- c.setLinewrap().after(pair.getFirst());
- c.setIndentationIncrement().after(pair.getFirst());
- c.setLinewrap().before(pair.getSecond());
- c.setIndentationDecrement().before(pair.getSecond());
- c.setSpace(" ").between(pair.getFirst(), pair.getSecond());
- }
-
- for (Keyword k: f.findKeywords("(", "|", ".", "*")) {
- c.setNoSpace().around(k);
- }
-
- for (Keyword k: f.findKeywords("<", "~")) {
- c.setNoSpace().after(k);
- }
- for (Keyword k: f.findKeywords(")", ">", ",", ":")) {
- c.setNoSpace().before(k);
- }
-
- for (Keyword k: f.findKeywords("regular","conjugate")) {
- c.setLinewrap().before(k);
- }
-
- c.setLinewrap(1).after(f.getImportRule());
-
- c.setLinewrap(2).around(f.getActorClassConfigRule());
- c.setLinewrap(2).around(f.getProtocolClassConfigRule());
- c.setLinewrap(2).around(f.getActorInstanceConfigRule());
-
- c.setLinewrap(1).around(f.getAttrClassConfigRule());
- c.setLinewrap(1).around(f.getAttrInstanceConfigRule());
- c.setLinewrap(1).around(f.getPortInstanceConfigRule());
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Juergen Haug
+ * 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
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.core.formatting;
+
+import org.eclipse.etrice.core.services.ConfigGrammarAccess;
+import org.eclipse.xtext.Keyword;
+import org.eclipse.xtext.formatting.impl.AbstractDeclarativeFormatter;
+import org.eclipse.xtext.formatting.impl.FormattingConfig;
+import org.eclipse.xtext.util.Pair;
+
+/**
+ * This class contains custom formatting description.
+ *
+ * see : http://www.eclipse.org/Xtext/documentation/latest/xtext.html#formatting
+ * on how and when to use it
+ *
+ * Also see {@link org.eclipse.xtext.xtext.XtextFormattingTokenSerializer} as an example
+ */
+public class ConfigFormatter extends AbstractDeclarativeFormatter {
+
+ @Override
+ protected void configureFormatting(FormattingConfig c) {
+ ConfigGrammarAccess f = (ConfigGrammarAccess) getGrammarAccess();
+
+ // general
+// Set<String> keywords = GrammarUtil.getAllKeywords(grammar.getGrammar());
+// System.out.println("Config keywords:");
+// for (String kw : keywords) {
+// System.out.println(kw+",");
+// }
+
+ c.setAutoLinewrap(120);
+ c.setLinewrap(1).before(f.getSL_COMMENTRule());
+ c.setLinewrap(2).before(f.getML_COMMENTRule());
+
+ for (Pair<Keyword, Keyword> pair : f.findKeywordPairs("{", "}")) {
+ c.setLinewrap().after(pair.getFirst());
+ c.setIndentationIncrement().after(pair.getFirst());
+ c.setLinewrap().before(pair.getSecond());
+ c.setIndentationDecrement().before(pair.getSecond());
+ c.setSpace(" ").between(pair.getFirst(), pair.getSecond());
+ }
+
+ for (Keyword k: f.findKeywords("(", "|", ".", "*")) {
+ c.setNoSpace().around(k);
+ }
+
+ for (Keyword k: f.findKeywords("<", "~")) {
+ c.setNoSpace().after(k);
+ }
+ for (Keyword k: f.findKeywords(")", ">", ",", ":")) {
+ c.setNoSpace().before(k);
+ }
+
+ for (Keyword k: f.findKeywords("regular","conjugate")) {
+ c.setLinewrap().before(k);
+ }
+
+ c.setLinewrap(1).after(f.getImportRule());
+
+ c.setLinewrap(2).around(f.getActorClassConfigRule());
+ c.setLinewrap(2).around(f.getProtocolClassConfigRule());
+ c.setLinewrap(2).around(f.getActorInstanceConfigRule());
+
+ c.setLinewrap(1).around(f.getAttrClassConfigRule());
+ c.setLinewrap(1).around(f.getAttrInstanceConfigRule());
+ c.setLinewrap(1).around(f.getPortInstanceConfigRule());
+ }
+}
diff --git a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/postprocessing/DocuPostprocessor.xtend b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/postprocessing/DocuPostprocessor.xtend
index 4c7e679d1..163c26d65 100644
--- a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/postprocessing/DocuPostprocessor.xtend
+++ b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/postprocessing/DocuPostprocessor.xtend
@@ -1,413 +1,413 @@
-/*******************************************************************************
- * Copyright (c) 2012 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.core.postprocessing
-
-import org.eclipse.xtext.GeneratedMetamodel
-
-import static extension org.eclipse.etrice.core.postprocessing.PostprocessingHelpers.*
-
-class DocuPostprocessor {
-
- def process(GeneratedMetamodel metamodel) {
- val pckg = metamodel.EPackage
-
- //------------------------------------------------------------------
- var cls = pckg.getClass("ConfigModel")
- cls.setDocumentation(
- '''
- The root object for the ROOM Config model. It gives access to
- the {@link SubSystemConfig sub system class},
- {@link ActorClassConfig actor class}, {@link ProtocolClassConfig protocol class} and
- {@link ActorInstanceConfig actor instance} configurations and the room model {@link Import imports}.
- ''')
-
- cls.getAttribute("name").setDocumentation(
- '''
- The model name is a dot separated fully qualified name and is
- used to provide a name space.
- ''')
-
- cls.getReference("imports").setDocumentation(
- '''
- This is a list of all imported room models. The config elements reference these imports.
- ''')
-
- cls.getReference("configElements").setDocumentation(
- '''
- This is a list of all top level config elements
- ''')
-
- //------------------------------------------------------------------
-
- cls = pckg.getClass("ConfigElement")
- cls.setDocumentation(
- '''
- This is the super class of the top level config elements
- <ul>
- <li>{@link SubSystemConfig}</li>
- <li>{@link ActorClassConfig}</li>
- <li>{@link ActorInstanceConfig}</li>
- <li>{@link ProtocolClassConfig}</li>
- </ul>
- ''')
-
- //------------------------------------------------------------------
-
- cls = pckg.getClass("SubSystemConfig")
- cls.setDocumentation(
- '''
- This class defines settings with a sub system scope.
- '''
- )
-
- cls.getReference("root").setDocumentation(
- '''
- This is the logical system that contains the {@link #org.eclipse.etrice.core.room.SubSystemRef sub system reference}.
- ''')
-
- cls.getReference("subSystem").setDocumentation(
- '''
- This is the sub system reference.
- ''')
-
- cls.getReference("dynConfig").setDocumentation(
- '''
- This is the dynamic configuration. It is available within the {@link #getSubSystem sub system}.
- ''')
-
- //------------------------------------------------------------------
-
- cls = pckg.getClass("DynamicConfig")
- cls.setDocumentation(
- '''
- The dynamic configuration provides a configuration at runtime.
- The source of the configuration is abstracted by an interface.
- <br>
- This feature is experimental and implemented for target language java only.
- '''
- )
-
- cls.getAttribute("filePath").setDocumentation(
- '''
- This is the file path of the configuration. In this case the source of the configuration is a simple file.
- '''
- )
-
- cls.getAttribute("userCode1").setDocumentation(
- '''
- Defines the import statement for the implemenation of the configuration source.
- ''')
-
- cls.getAttribute("userCode2").setDocumentation(
- '''
- This is the constructor statement for the implemenation of the configuration source.
- '''
- )
-
- cls.getAttribute("polling").setDocumentation(
- '''
- Defines the time interval in milliseconds to query changes from the configuration source.
- '''
- )
-
- //------------------------------------------------------------------
-
- cls = pckg.getClass("ActorClassConfig")
- cls.setDocumentation(
- '''
- This class models a configuration for an {@link org.eclipse.etrice.core.room.ActorClass actor class}.
- The configuration defines the default values for all instances of the {@link #getActor actor}.
- The values are applied at generation time.
- The config sub elements are:
- <ul>
- <li>{@link AttrClassConfig attribute class config}</li>
- </ul>
- ''')
-
- cls.getReference("actor").setDocumentation(
- '''
- This is the actor class.
- ''')
-
- cls.getReference("attributes").setDocumentation(
- '''
- This is a list of all attribute configurations.
- ''')
-
- //------------------------------------------------------------------
-
- cls = pckg.getClass("ProtocolClassConfig")
- cls.setDocumentation(
- '''
- This class models a configuration for an {@link org.eclipse.etrice.core.room.ProtocolClass protocol class}.
- The config sub elements are:
- <ul>
- <li>a {@link PortClassConfig port class config} for the regular port class</li>
- <li>a {@link PortClassConfig port class config} for the conjugate port class</li>
- </ul>
- ''')
-
- cls.getReference("protocol").setDocumentation(
- '''
- This is the protocol class.
- ''')
-
- cls.getReference("regular").setDocumentation(
- '''
- This is the configuration for the regular part of the protocol.
- ''')
-
- cls.getReference("conjugated").setDocumentation(
- '''
- This is the configuration for the conjugated part of the protocol.
- ''')
-
- //------------------------------------------------------------------
-
- cls = pckg.getClass("PortClassConfig")
- cls.setDocumentation(
- '''
- This class models a configuration for an {@link org.eclipse.etrice.core.room.PortClass port class}.
- The configuration defines the default values for all instances of the port.
- The values are applied at generation time.
- The config sub elements are:
- <ul>
- <li>{@link AttrClassConfig attribute class config}</li>
- </ul>
- ''')
-
- cls.getReference("attributes").setDocumentation(
- '''
- This is a list of all attribute configurations.
- ''')
-
- //------------------------------------------------------------------
-
- cls = pckg.getClass("ActorInstanceConfig")
- cls.setDocumentation(
- '''
- This class models a configuration for an {@link org.eclipse.etrice.core.room.ActorRef actor instance}.
- The configuration defines values for this actor instance and overrides the default values from the corresponding class config.
- The values are applied at generation time.
- The config sub elements are:
- <ul>
- <li>{@link AttrInstanceConfig attribute instance config}</li>
- </ul>
- ''')
-
- cls.getReference("root").setDocumentation(
- '''
- This is the logical system that contains the {@link #getSubSystem sub system}.
- ''')
-
- cls.getReference("subSystem").setDocumentation(
- '''
- This is the sub system that contains the {@link #getRefPath actor instance}.
- ''')
-
- cls.getReference("path").setDocumentation(
- '''
- This is the path of the actor instance relative to the {@link #getSubSystem sub system}.
- ''')
-
- cls.getReference("attributes").setDocumentation(
- '''
- This is a list of all attribute configurations.
- ''')
-
- cls.getReference("ports").setDocumentation(
- '''
- This is a list of all port configurations.
- ''')
-
- //------------------------------------------------------------------
-
- cls = pckg.getClass("PortInstanceConfig")
- cls.setDocumentation(
- '''
- This class models a configuration for an {@link org.eclipse.etrice.core.room.InterfaceItem interface item} (e.g. port instance).
- The configuration defines values for this interface item and overrides the default values from the corresponding class config.
- The values are applied at generation time.
- The config sub elements are:
- <ul>
- <li>{@link AttrInstanceConfig attribute instance config}</li>
- </ul>
- ''')
-
- cls.getReference("item").setDocumentation(
- '''
- This is the interface item.
- ''')
-
- cls.getReference("attributes").setDocumentation(
- '''
- This is a list of all attribute configurations.
- ''')
-
- //------------------------------------------------------------------
-
- cls = pckg.getClass("AttrConfig")
- cls.setDocumentation(
- '''
- It is the super class of
- <ul>
- <li>{@link AttrClassConfig}</li>
- <li>{@link AttrInstanceConfig}</li>
- </ul>
- ''')
-
- cls.getReference("attribute").setDocumentation(
- '''
- This is the attribute.
- ''')
-
- cls.getReference("value").setDocumentation(
- '''
- This is the value of {@link #getAttribute attribute}.
- ''')
-
- //------------------------------------------------------------------
-
- cls = pckg.getClass("AttrClassConfig")
- cls.setDocumentation(
- '''
- This class models a configuration for an {@link org.eclipse.etrice.core.room.Attribute attribute}.
- The configuration defines a default value for all instances of the attribute.
- The values are applied at generation time.
- <br>If the type of the given {@link org.eclipse.etrice.core.config.AttrConfig#getAttribute attribute} is
- <ul>
- <li>primitive, then a {@link org.eclipse.etrice.core.config.AttrConfig#getValue value} might exist and {@link #getAttributes attributes} is empty</li>
- <li>compound attribute (e.g. {@link org.eclipse.etrice.core.room.DataClass data class}), then {@link org.eclipse.etrice.core.config.AttrConfig#getValue value} is null and configurations for children {@link #getAttributes attributes} might exist</li>
- </ul>
- ''')
-
- cls.getReference("attributes").setDocumentation(
- '''
- This is a list of attribute configurations of children attributes, in case the {@link org.eclipse.etrice.core.config.AttrConfig#getAttribute attribute} is compound.
- ''')
-
- cls.getReference("min").setDocumentation(
- '''
- This is the lower bound of {@link org.eclipse.etrice.core.config.AttrConfig#getValue value} , in case the {@link org.eclipse.etrice.core.config.AttrConfig#getAttribute attribute} has a numerical value.
- ''')
-
- cls.getReference("max").setDocumentation(
- '''
- This is the upper bound of {@link org.eclipse.etrice.core.config.AttrConfig#getValue value} , in case the {@link org.eclipse.etrice.core.config.AttrConfig#getAttribute attribute} has a numerical value.
- ''')
-
- //------------------------------------------------------------------
-
- cls = pckg.getClass("AttrInstanceConfig")
- cls.setDocumentation(
- '''
- This class models a configuration for an {@link org.eclipse.etrice.core.room.Attribute attribute}.
- The configuration defines values for this attribute instance and overrides the default values from the corresponding class config.
- The values are applied at generation time.
- <br>If the type of the given {@link org.eclipse.etrice.core.config.AttrConfig#getAttribute attribute} is
- <ul>
- <li>primitive, then a {@link org.eclipse.etrice.core.config.AttrConfig#getValue value} might exist and {@link #getAttributes attributes} is empty</li>
- <li>compound attribute (e.g. {@link org.eclipse.etrice.core.room.DataClass data class}), then {@link org.eclipse.etrice.core.config.AttrConfig#getValue value} is null and configurations for children {@link #getAttributes attributes} might exist</li>
- </ul>
- ''')
-
- cls.getReference("attributes").setDocumentation(
- '''
- This is a list of attribute configurations of children attributes, in case the {@link org.eclipse.etrice.core.config.AttrConfig#getAttribute attribute} is compound.
- ''')
-
- cls.getAttribute("dynConfig").setDocumentation(
- '''
- If the dynamic configuration options is activated for this attribute, then the values are set at runtime by the means of the {@link DynamicConfig dynamic config}.
- ''')
-
- cls.getAttribute("readOnly").setDocumentation(
- '''
- Controls the behavior of the dynamic configuration. If set to false, then {@link org.eclipse.etrice.core.config.AttrConfig#getValue value} is updated (overwritten) if changes occur in the external configuration,
- otherwise set to true, then changes in {@link org.eclipse.etrice.core.config.AttrConfig#getValue value} (that occur from within the system) are recorded to the external configuration.
- ''')
-
- //------------------------------------------------------------------
-
- cls = pckg.getClass("LiteralArray")
- cls.setDocumentation(
- '''
- Aggregates one or more {@link Literal literals}.
- ''')
-
- cls.getReference("literals").setDocumentation(
- '''
- This is a list of literals.
- ''')
-
- //------------------------------------------------------------------
-
- cls = pckg.getClass("Literal")
- cls.setDocumentation(
- '''
- It is the super class of
- <ul>
- <li>{@link BooleanLiteral}</li>
- <li>{@link NumberLiteral}</li>
- <li>{@link StringLiteral}</li>
- </ul>
- that represents a primitive value.
- ''')
-
- //------------------------------------------------------------------
-
- cls = pckg.getClass("RefPath")
- cls.setDocumentation(
- '''
- A path of strings that are interpreted as {@link org.eclipse.etrice.core.room.ActorRef}s starting at a {@link org.eclipse.etrice.core.room.SubSystemClass}.
- ''')
-
- cls.getAttribute("refs").setDocumentation(
- '''
- This is a path in the instance tree where each segment corresponds to the name of the
- corresponding {@link ActorContainerRef}.
- ''')
-
- //------------------------------------------------------------------
-
- cls = pckg.getClass("Import")
- cls.setDocumentation(
- '''
- The import declares an imported {@link org.eclipse.etrice.core.room.RoomModel room model} (given as a URI) and
- an optional imported namespace.
- ''')
-
- cls.getAttribute("importedNamespace").setDocumentation(
- '''
- The imported name space has to be a dot separated qualified name followed by .*.
- Example: my.namespace.*
- ''')
-
- cls.getAttribute("importURI").setDocumentation(
- '''
- The import URI can be a relative or absolute file system path.
- It may contain environment variables in ${} which will be expanded.
- <p>
- Examples:
- <ul>
- <li>import model "AnotherModel.room"</li>
- <li>import my.namespace.* from "AnotherModel.room"</li>
- <li>import my.namespace.* from "../../AnotherProject/models/AnotherModel.room"</li>
- <li>import my.namespace.* from "/${ROOM_MODELS}/SomeModel.room"</li>
- </ul>
- </p>
- ''')
-
- }
-
+/*******************************************************************************
+ * Copyright (c) 2012 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.core.postprocessing
+
+import org.eclipse.xtext.GeneratedMetamodel
+
+import static extension org.eclipse.etrice.core.postprocessing.PostprocessingHelpers.*
+
+class DocuPostprocessor {
+
+ def process(GeneratedMetamodel metamodel) {
+ val pckg = metamodel.EPackage
+
+ //------------------------------------------------------------------
+ var cls = pckg.getClass("ConfigModel")
+ cls.setDocumentation(
+ '''
+ The root object for the ROOM Config model. It gives access to
+ the {@link SubSystemConfig sub system class},
+ {@link ActorClassConfig actor class}, {@link ProtocolClassConfig protocol class} and
+ {@link ActorInstanceConfig actor instance} configurations and the room model {@link Import imports}.
+ ''')
+
+ cls.getAttribute("name").setDocumentation(
+ '''
+ The model name is a dot separated fully qualified name and is
+ used to provide a name space.
+ ''')
+
+ cls.getReference("imports").setDocumentation(
+ '''
+ This is a list of all imported room models. The config elements reference these imports.
+ ''')
+
+ cls.getReference("configElements").setDocumentation(
+ '''
+ This is a list of all top level config elements
+ ''')
+
+ //------------------------------------------------------------------
+
+ cls = pckg.getClass("ConfigElement")
+ cls.setDocumentation(
+ '''
+ This is the super class of the top level config elements
+ <ul>
+ <li>{@link SubSystemConfig}</li>
+ <li>{@link ActorClassConfig}</li>
+ <li>{@link ActorInstanceConfig}</li>
+ <li>{@link ProtocolClassConfig}</li>
+ </ul>
+ ''')
+
+ //------------------------------------------------------------------
+
+ cls = pckg.getClass("SubSystemConfig")
+ cls.setDocumentation(
+ '''
+ This class defines settings with a sub system scope.
+ '''
+ )
+
+ cls.getReference("root").setDocumentation(
+ '''
+ This is the logical system that contains the {@link #org.eclipse.etrice.core.room.SubSystemRef sub system reference}.
+ ''')
+
+ cls.getReference("subSystem").setDocumentation(
+ '''
+ This is the sub system reference.
+ ''')
+
+ cls.getReference("dynConfig").setDocumentation(
+ '''
+ This is the dynamic configuration. It is available within the {@link #getSubSystem sub system}.
+ ''')
+
+ //------------------------------------------------------------------
+
+ cls = pckg.getClass("DynamicConfig")
+ cls.setDocumentation(
+ '''
+ The dynamic configuration provides a configuration at runtime.
+ The source of the configuration is abstracted by an interface.
+ <br>
+ This feature is experimental and implemented for target language java only.
+ '''
+ )
+
+ cls.getAttribute("filePath").setDocumentation(
+ '''
+ This is the file path of the configuration. In this case the source of the configuration is a simple file.
+ '''
+ )
+
+ cls.getAttribute("userCode1").setDocumentation(
+ '''
+ Defines the import statement for the implemenation of the configuration source.
+ ''')
+
+ cls.getAttribute("userCode2").setDocumentation(
+ '''
+ This is the constructor statement for the implemenation of the configuration source.
+ '''
+ )
+
+ cls.getAttribute("polling").setDocumentation(
+ '''
+ Defines the time interval in milliseconds to query changes from the configuration source.
+ '''
+ )
+
+ //------------------------------------------------------------------
+
+ cls = pckg.getClass("ActorClassConfig")
+ cls.setDocumentation(
+ '''
+ This class models a configuration for an {@link org.eclipse.etrice.core.room.ActorClass actor class}.
+ The configuration defines the default values for all instances of the {@link #getActor actor}.
+ The values are applied at generation time.
+ The config sub elements are:
+ <ul>
+ <li>{@link AttrClassConfig attribute class config}</li>
+ </ul>
+ ''')
+
+ cls.getReference("actor").setDocumentation(
+ '''
+ This is the actor class.
+ ''')
+
+ cls.getReference("attributes").setDocumentation(
+ '''
+ This is a list of all attribute configurations.
+ ''')
+
+ //------------------------------------------------------------------
+
+ cls = pckg.getClass("ProtocolClassConfig")
+ cls.setDocumentation(
+ '''
+ This class models a configuration for an {@link org.eclipse.etrice.core.room.ProtocolClass protocol class}.
+ The config sub elements are:
+ <ul>
+ <li>a {@link PortClassConfig port class config} for the regular port class</li>
+ <li>a {@link PortClassConfig port class config} for the conjugate port class</li>
+ </ul>
+ ''')
+
+ cls.getReference("protocol").setDocumentation(
+ '''
+ This is the protocol class.
+ ''')
+
+ cls.getReference("regular").setDocumentation(
+ '''
+ This is the configuration for the regular part of the protocol.
+ ''')
+
+ cls.getReference("conjugated").setDocumentation(
+ '''
+ This is the configuration for the conjugated part of the protocol.
+ ''')
+
+ //------------------------------------------------------------------
+
+ cls = pckg.getClass("PortClassConfig")
+ cls.setDocumentation(
+ '''
+ This class models a configuration for an {@link org.eclipse.etrice.core.room.PortClass port class}.
+ The configuration defines the default values for all instances of the port.
+ The values are applied at generation time.
+ The config sub elements are:
+ <ul>
+ <li>{@link AttrClassConfig attribute class config}</li>
+ </ul>
+ ''')
+
+ cls.getReference("attributes").setDocumentation(
+ '''
+ This is a list of all attribute configurations.
+ ''')
+
+ //------------------------------------------------------------------
+
+ cls = pckg.getClass("ActorInstanceConfig")
+ cls.setDocumentation(
+ '''
+ This class models a configuration for an {@link org.eclipse.etrice.core.room.ActorRef actor instance}.
+ The configuration defines values for this actor instance and overrides the default values from the corresponding class config.
+ The values are applied at generation time.
+ The config sub elements are:
+ <ul>
+ <li>{@link AttrInstanceConfig attribute instance config}</li>
+ </ul>
+ ''')
+
+ cls.getReference("root").setDocumentation(
+ '''
+ This is the logical system that contains the {@link #getSubSystem sub system}.
+ ''')
+
+ cls.getReference("subSystem").setDocumentation(
+ '''
+ This is the sub system that contains the {@link #getRefPath actor instance}.
+ ''')
+
+ cls.getReference("path").setDocumentation(
+ '''
+ This is the path of the actor instance relative to the {@link #getSubSystem sub system}.
+ ''')
+
+ cls.getReference("attributes").setDocumentation(
+ '''
+ This is a list of all attribute configurations.
+ ''')
+
+ cls.getReference("ports").setDocumentation(
+ '''
+ This is a list of all port configurations.
+ ''')
+
+ //------------------------------------------------------------------
+
+ cls = pckg.getClass("PortInstanceConfig")
+ cls.setDocumentation(
+ '''
+ This class models a configuration for an {@link org.eclipse.etrice.core.room.InterfaceItem interface item} (e.g. port instance).
+ The configuration defines values for this interface item and overrides the default values from the corresponding class config.
+ The values are applied at generation time.
+ The config sub elements are:
+ <ul>
+ <li>{@link AttrInstanceConfig attribute instance config}</li>
+ </ul>
+ ''')
+
+ cls.getReference("item").setDocumentation(
+ '''
+ This is the interface item.
+ ''')
+
+ cls.getReference("attributes").setDocumentation(
+ '''
+ This is a list of all attribute configurations.
+ ''')
+
+ //------------------------------------------------------------------
+
+ cls = pckg.getClass("AttrConfig")
+ cls.setDocumentation(
+ '''
+ It is the super class of
+ <ul>
+ <li>{@link AttrClassConfig}</li>
+ <li>{@link AttrInstanceConfig}</li>
+ </ul>
+ ''')
+
+ cls.getReference("attribute").setDocumentation(
+ '''
+ This is the attribute.
+ ''')
+
+ cls.getReference("value").setDocumentation(
+ '''
+ This is the value of {@link #getAttribute attribute}.
+ ''')
+
+ //------------------------------------------------------------------
+
+ cls = pckg.getClass("AttrClassConfig")
+ cls.setDocumentation(
+ '''
+ This class models a configuration for an {@link org.eclipse.etrice.core.room.Attribute attribute}.
+ The configuration defines a default value for all instances of the attribute.
+ The values are applied at generation time.
+ <br>If the type of the given {@link org.eclipse.etrice.core.config.AttrConfig#getAttribute attribute} is
+ <ul>
+ <li>primitive, then a {@link org.eclipse.etrice.core.config.AttrConfig#getValue value} might exist and {@link #getAttributes attributes} is empty</li>
+ <li>compound attribute (e.g. {@link org.eclipse.etrice.core.room.DataClass data class}), then {@link org.eclipse.etrice.core.config.AttrConfig#getValue value} is null and configurations for children {@link #getAttributes attributes} might exist</li>
+ </ul>
+ ''')
+
+ cls.getReference("attributes").setDocumentation(
+ '''
+ This is a list of attribute configurations of children attributes, in case the {@link org.eclipse.etrice.core.config.AttrConfig#getAttribute attribute} is compound.
+ ''')
+
+ cls.getReference("min").setDocumentation(
+ '''
+ This is the lower bound of {@link org.eclipse.etrice.core.config.AttrConfig#getValue value} , in case the {@link org.eclipse.etrice.core.config.AttrConfig#getAttribute attribute} has a numerical value.
+ ''')
+
+ cls.getReference("max").setDocumentation(
+ '''
+ This is the upper bound of {@link org.eclipse.etrice.core.config.AttrConfig#getValue value} , in case the {@link org.eclipse.etrice.core.config.AttrConfig#getAttribute attribute} has a numerical value.
+ ''')
+
+ //------------------------------------------------------------------
+
+ cls = pckg.getClass("AttrInstanceConfig")
+ cls.setDocumentation(
+ '''
+ This class models a configuration for an {@link org.eclipse.etrice.core.room.Attribute attribute}.
+ The configuration defines values for this attribute instance and overrides the default values from the corresponding class config.
+ The values are applied at generation time.
+ <br>If the type of the given {@link org.eclipse.etrice.core.config.AttrConfig#getAttribute attribute} is
+ <ul>
+ <li>primitive, then a {@link org.eclipse.etrice.core.config.AttrConfig#getValue value} might exist and {@link #getAttributes attributes} is empty</li>
+ <li>compound attribute (e.g. {@link org.eclipse.etrice.core.room.DataClass data class}), then {@link org.eclipse.etrice.core.config.AttrConfig#getValue value} is null and configurations for children {@link #getAttributes attributes} might exist</li>
+ </ul>
+ ''')
+
+ cls.getReference("attributes").setDocumentation(
+ '''
+ This is a list of attribute configurations of children attributes, in case the {@link org.eclipse.etrice.core.config.AttrConfig#getAttribute attribute} is compound.
+ ''')
+
+ cls.getAttribute("dynConfig").setDocumentation(
+ '''
+ If the dynamic configuration options is activated for this attribute, then the values are set at runtime by the means of the {@link DynamicConfig dynamic config}.
+ ''')
+
+ cls.getAttribute("readOnly").setDocumentation(
+ '''
+ Controls the behavior of the dynamic configuration. If set to false, then {@link org.eclipse.etrice.core.config.AttrConfig#getValue value} is updated (overwritten) if changes occur in the external configuration,
+ otherwise set to true, then changes in {@link org.eclipse.etrice.core.config.AttrConfig#getValue value} (that occur from within the system) are recorded to the external configuration.
+ ''')
+
+ //------------------------------------------------------------------
+
+ cls = pckg.getClass("LiteralArray")
+ cls.setDocumentation(
+ '''
+ Aggregates one or more {@link Literal literals}.
+ ''')
+
+ cls.getReference("literals").setDocumentation(
+ '''
+ This is a list of literals.
+ ''')
+
+ //------------------------------------------------------------------
+
+ cls = pckg.getClass("Literal")
+ cls.setDocumentation(
+ '''
+ It is the super class of
+ <ul>
+ <li>{@link BooleanLiteral}</li>
+ <li>{@link NumberLiteral}</li>
+ <li>{@link StringLiteral}</li>
+ </ul>
+ that represents a primitive value.
+ ''')
+
+ //------------------------------------------------------------------
+
+ cls = pckg.getClass("RefPath")
+ cls.setDocumentation(
+ '''
+ A path of strings that are interpreted as {@link org.eclipse.etrice.core.room.ActorRef}s starting at a {@link org.eclipse.etrice.core.room.SubSystemClass}.
+ ''')
+
+ cls.getAttribute("refs").setDocumentation(
+ '''
+ This is a path in the instance tree where each segment corresponds to the name of the
+ corresponding {@link ActorContainerRef}.
+ ''')
+
+ //------------------------------------------------------------------
+
+ cls = pckg.getClass("Import")
+ cls.setDocumentation(
+ '''
+ The import declares an imported {@link org.eclipse.etrice.core.room.RoomModel room model} (given as a URI) and
+ an optional imported namespace.
+ ''')
+
+ cls.getAttribute("importedNamespace").setDocumentation(
+ '''
+ The imported name space has to be a dot separated qualified name followed by .*.
+ Example: my.namespace.*
+ ''')
+
+ cls.getAttribute("importURI").setDocumentation(
+ '''
+ The import URI can be a relative or absolute file system path.
+ It may contain environment variables in ${} which will be expanded.
+ <p>
+ Examples:
+ <ul>
+ <li>import model "AnotherModel.room"</li>
+ <li>import my.namespace.* from "AnotherModel.room"</li>
+ <li>import my.namespace.* from "../../AnotherProject/models/AnotherModel.room"</li>
+ <li>import my.namespace.* from "/${ROOM_MODELS}/SomeModel.room"</li>
+ </ul>
+ </p>
+ ''')
+
+ }
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/postprocessing/ImplPostprocesser.xtend b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/postprocessing/ImplPostprocesser.xtend
index a9222761b..8e68a7cea 100644
--- a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/postprocessing/ImplPostprocesser.xtend
+++ b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/postprocessing/ImplPostprocesser.xtend
@@ -1,69 +1,69 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.core.postprocessing
-
-import org.eclipse.xtext.GeneratedMetamodel
-
-import static extension org.eclipse.etrice.core.postprocessing.PostprocessingHelpers.*
-
-class ImplPostProcessing {
-
- def process(GeneratedMetamodel metamodel) {
- var configPackage = metamodel.EPackage
-
- var configModel = configPackage.getClass("ConfigModel")
- configModel.addOperation(
- "getActorClassConfigs",
- configPackage.getEClassifier("ActorClassConfig"),
- UNBOUNDED_MULTIPLICITY,
- '''
- EList<ActorClassConfig> list = new org.eclipse.emf.common.util.BasicEList<ActorClassConfig>();
- for(ConfigElement element : this.getConfigElements())
- if(element instanceof ActorClassConfig)
- list.add((ActorClassConfig) element);
- return list;
- ''')
- configModel.addOperation(
- "getActorInstanceConfigs",
- configPackage.getEClassifier("ActorInstanceConfig"),
- UNBOUNDED_MULTIPLICITY,
- '''
- EList<ActorInstanceConfig> list = new org.eclipse.emf.common.util.BasicEList<ActorInstanceConfig>();
- for(ConfigElement element : this.getConfigElements())
- if(element instanceof ActorInstanceConfig)
- list.add((ActorInstanceConfig) element);
- return list;''')
- configModel.addOperation(
- "getProtocolClassConfigs",
- configPackage.getEClassifier("ProtocolClassConfig"),
- UNBOUNDED_MULTIPLICITY,
- '''
- EList<ProtocolClassConfig> list = new org.eclipse.emf.common.util.BasicEList<ProtocolClassConfig>();
- for(ConfigElement element : this.getConfigElements())
- if(element instanceof ProtocolClassConfig)
- list.add((ProtocolClassConfig) element);
- return list;
- ''')
- configModel.addOperation(
- "getSubSystemConfigs",
- configPackage.getEClassifier("SubSystemConfig"),
- UNBOUNDED_MULTIPLICITY,
- '''
- EList<SubSystemConfig> list = new org.eclipse.emf.common.util.BasicEList<SubSystemConfig>();
- for(ConfigElement element : this.getConfigElements())
- if(element instanceof SubSystemConfig)
- list.add((SubSystemConfig) element);
- return list;''')
- }
-
+/*******************************************************************************
+ * Copyright (c) 2012 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
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.core.postprocessing
+
+import org.eclipse.xtext.GeneratedMetamodel
+
+import static extension org.eclipse.etrice.core.postprocessing.PostprocessingHelpers.*
+
+class ImplPostProcessing {
+
+ def process(GeneratedMetamodel metamodel) {
+ var configPackage = metamodel.EPackage
+
+ var configModel = configPackage.getClass("ConfigModel")
+ configModel.addOperation(
+ "getActorClassConfigs",
+ configPackage.getEClassifier("ActorClassConfig"),
+ UNBOUNDED_MULTIPLICITY,
+ '''
+ EList<ActorClassConfig> list = new org.eclipse.emf.common.util.BasicEList<ActorClassConfig>();
+ for(ConfigElement element : this.getConfigElements())
+ if(element instanceof ActorClassConfig)
+ list.add((ActorClassConfig) element);
+ return list;
+ ''')
+ configModel.addOperation(
+ "getActorInstanceConfigs",
+ configPackage.getEClassifier("ActorInstanceConfig"),
+ UNBOUNDED_MULTIPLICITY,
+ '''
+ EList<ActorInstanceConfig> list = new org.eclipse.emf.common.util.BasicEList<ActorInstanceConfig>();
+ for(ConfigElement element : this.getConfigElements())
+ if(element instanceof ActorInstanceConfig)
+ list.add((ActorInstanceConfig) element);
+ return list;''')
+ configModel.addOperation(
+ "getProtocolClassConfigs",
+ configPackage.getEClassifier("ProtocolClassConfig"),
+ UNBOUNDED_MULTIPLICITY,
+ '''
+ EList<ProtocolClassConfig> list = new org.eclipse.emf.common.util.BasicEList<ProtocolClassConfig>();
+ for(ConfigElement element : this.getConfigElements())
+ if(element instanceof ProtocolClassConfig)
+ list.add((ProtocolClassConfig) element);
+ return list;
+ ''')
+ configModel.addOperation(
+ "getSubSystemConfigs",
+ configPackage.getEClassifier("SubSystemConfig"),
+ UNBOUNDED_MULTIPLICITY,
+ '''
+ EList<SubSystemConfig> list = new org.eclipse.emf.common.util.BasicEList<SubSystemConfig>();
+ for(ConfigElement element : this.getConfigElements())
+ if(element instanceof SubSystemConfig)
+ list.add((SubSystemConfig) element);
+ return list;''')
+ }
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/postprocessing/PostprocessorController.java b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/postprocessing/PostprocessorController.java
index 9b90b83ab..60e35e708 100644
--- a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/postprocessing/PostprocessorController.java
+++ b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/postprocessing/PostprocessorController.java
@@ -1,22 +1,22 @@
-/*******************************************************************************
- * Copyright (c) 2012 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
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.core.postprocessing;
-
-import org.eclipse.xtext.GeneratedMetamodel;
-
-public class PostprocessorController {
- public static void process(GeneratedMetamodel metamodel){
- new DocuPostprocessor().process(metamodel);
- new ImplPostProcessing().process(metamodel);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 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
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.core.postprocessing;
+
+import org.eclipse.xtext.GeneratedMetamodel;
+
+public class PostprocessorController {
+ public static void process(GeneratedMetamodel metamodel){
+ new DocuPostprocessor().process(metamodel);
+ new ImplPostProcessing().process(metamodel);
+ }
+}
diff --git a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/scoping/ConfigScopeProvider.java b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/scoping/ConfigScopeProvider.java
index 28d74d4a1..daad30775 100644
--- a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/scoping/ConfigScopeProvider.java
+++ b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/scoping/ConfigScopeProvider.java
@@ -1,175 +1,175 @@
-/*******************************************************************************
- * Copyright (c) 2012 Juergen Haug
- * 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
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.core.scoping;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.etrice.core.config.ActorClassConfig;
-import org.eclipse.etrice.core.config.ActorInstanceConfig;
-import org.eclipse.etrice.core.config.AttrConfig;
-import org.eclipse.etrice.core.config.PortClassConfig;
-import org.eclipse.etrice.core.config.PortInstanceConfig;
-import org.eclipse.etrice.core.config.ProtocolClassConfig;
-import org.eclipse.etrice.core.config.SubSystemConfig;
-import org.eclipse.etrice.core.config.util.ConfigUtil;
-import org.eclipse.etrice.core.room.ActorClass;
-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.LogicalSystem;
-import org.eclipse.etrice.core.room.PortClass;
-import org.eclipse.etrice.core.room.SubSystemClass;
-import org.eclipse.etrice.core.room.SubSystemRef;
-import org.eclipse.etrice.core.room.util.RoomHelpers;
-import org.eclipse.xtext.resource.EObjectDescription;
-import org.eclipse.xtext.resource.IEObjectDescription;
-import org.eclipse.xtext.scoping.IScope;
-import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider;
-import org.eclipse.xtext.scoping.impl.SimpleScope;
-
-/**
- * This class contains custom scoping description.
- *
- * @see http://www.eclipse.org/Xtext/documentation/latest/xtext.html#scoping on
- * how and when to use it
- *
- */
-public class ConfigScopeProvider extends AbstractDeclarativeScopeProvider {
-
- public IScope scope_SubSystemConfig_subSystem(SubSystemConfig ctx, EReference ref){
- final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
-
- LogicalSystem root = ctx.getRoot();
- for (SubSystemRef ssRef : root.getSubSystems())
- scopes.add(EObjectDescription.create(ssRef.getName(), ssRef));
-
- return new SimpleScope(IScope.NULLSCOPE, scopes);
- }
-
- public IScope scope_ActorInstanceConfig_subSystem(ActorInstanceConfig ctx,
- EReference ref) {
- final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
-
- LogicalSystem root = ctx.getRoot();
- for (SubSystemRef ssRef : root.getSubSystems())
- scopes.add(EObjectDescription.create(ssRef.getName(), ssRef));
-
- return new SimpleScope(IScope.NULLSCOPE, scopes);
- }
-
- public IScope scope_PortInstanceConfig_item(PortInstanceConfig ctx,
- EReference ref) {
- final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
-
- ActorInstanceConfig actorConfig = (ActorInstanceConfig) ctx
- .eContainer();
- SubSystemClass subsystem = actorConfig.getSubSystem().getType();
- if (subsystem != null) {
- ActorClass ac = ConfigUtil
- .resolve(subsystem, actorConfig.getPath());
- for (InterfaceItem item : ConfigUtil.getConfigurableInterfaceItems(
- ac, true))
- scopes.add(EObjectDescription.create(item.getName(), item));
- }
-
- return new SimpleScope(IScope.NULLSCOPE, scopes);
- }
-
- public IScope scope_AttrConfig_attribute(AttrConfig ctx, EReference ref) {
- final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
-
- if (ctx.eContainer() instanceof AttrConfig)
- collectAttributes((AttrConfig) ctx.eContainer(), scopes);
- else if (ctx.eContainer() instanceof ActorClassConfig)
- collectAttributes((ActorClassConfig) ctx.eContainer(), scopes);
- else if (ctx.eContainer() instanceof ActorInstanceConfig)
- collectAttributes((ActorInstanceConfig) ctx.eContainer(), scopes);
- else if (ctx.eContainer() instanceof PortClassConfig)
- collectAttributes((PortClassConfig) ctx.eContainer(), scopes);
- else if (ctx.eContainer() instanceof PortInstanceConfig)
- collectAttributes((PortInstanceConfig) ctx.eContainer(), scopes);
- return new SimpleScope(IScope.NULLSCOPE, scopes);
- }
-
- private void collectAttributes(AttrConfig config,
- List<IEObjectDescription> scopes) {
- if (config.getAttribute().getRefType().getType() instanceof DataClass) {
- DataClass dc = (DataClass) config.getAttribute().getRefType()
- .getType();
- for (Attribute att : ConfigUtil
- .filterConfigurableAttributes(RoomHelpers
- .getAllAttributes(dc))) {
- scopes.add(EObjectDescription.create(att.getName(), att));
- }
- }
- }
-
- private void collectAttributes(ActorClassConfig config,
- List<IEObjectDescription> scopes) {
- ActorClass actor = config.getActor();
- if (actor != null) {
- for (Attribute att : ConfigUtil
- .filterConfigurableAttributes(RoomHelpers
- .getAllAttributes(actor))) {
- scopes.add(EObjectDescription.create(att.getName(), att));
- }
- }
- }
-
- private void collectAttributes(ActorInstanceConfig config,
- List<IEObjectDescription> scopes) {
- SubSystemClass subsystem = config.getSubSystem().getType();
- if (subsystem != null) {
- ActorClass actor = ConfigUtil.resolve(subsystem, config.getPath());
- for (Attribute att : ConfigUtil
- .filterConfigurableAttributes(RoomHelpers
- .getAllAttributes(actor))) {
- scopes.add(EObjectDescription.create(att.getName(), att));
- }
- }
- }
-
- private void collectAttributes(PortClassConfig config,
- List<IEObjectDescription> scopes) {
- ProtocolClassConfig protocolConfig = (ProtocolClassConfig) config
- .eContainer();
- PortClass portClass = null;
- if (protocolConfig.getRegular() == config)
- portClass = protocolConfig.getProtocol().getRegular();
- else
- portClass = protocolConfig.getProtocol().getConjugate();
-
- if (portClass != null)
- for (Attribute att : ConfigUtil
- .filterConfigurableAttributes(portClass.getAttributes()))
- scopes.add(EObjectDescription.create(att.getName(), att));
- }
-
- private void collectAttributes(PortInstanceConfig config,
- List<IEObjectDescription> scopes) {
- PortClass portClass = ConfigUtil.getPortClass(config);
- if (portClass != null)
- for (Attribute att : ConfigUtil
- .filterConfigurableAttributes(portClass.getAttributes()))
- scopes.add(EObjectDescription.create(att.getName(), att));
- }
-}
-
-/*
- * IScope scope_<RefDeclaringEClass>_<Reference>( <ContextType> ctx, EReference
- * ref)
- *
- * IScope scope_<TypeToReturn>(<ContextType> ctx, EReference ref)
- */
+/*******************************************************************************
+ * Copyright (c) 2012 Juergen Haug
+ * 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
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.core.scoping;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.etrice.core.config.ActorClassConfig;
+import org.eclipse.etrice.core.config.ActorInstanceConfig;
+import org.eclipse.etrice.core.config.AttrConfig;
+import org.eclipse.etrice.core.config.PortClassConfig;
+import org.eclipse.etrice.core.config.PortInstanceConfig;
+import org.eclipse.etrice.core.config.ProtocolClassConfig;
+import org.eclipse.etrice.core.config.SubSystemConfig;
+import org.eclipse.etrice.core.config.util.ConfigUtil;
+import org.eclipse.etrice.core.room.ActorClass;
+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.LogicalSystem;
+import org.eclipse.etrice.core.room.PortClass;
+import org.eclipse.etrice.core.room.SubSystemClass;
+import org.eclipse.etrice.core.room.SubSystemRef;
+import org.eclipse.etrice.core.room.util.RoomHelpers;
+import org.eclipse.xtext.resource.EObjectDescription;
+import org.eclipse.xtext.resource.IEObjectDescription;
+import org.eclipse.xtext.scoping.IScope;
+import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider;
+import org.eclipse.xtext.scoping.impl.SimpleScope;
+
+/**
+ * This class contains custom scoping description.
+ *
+ * @see http://www.eclipse.org/Xtext/documentation/latest/xtext.html#scoping on
+ * how and when to use it
+ *
+ */
+public class ConfigScopeProvider extends AbstractDeclarativeScopeProvider {
+
+ public IScope scope_SubSystemConfig_subSystem(SubSystemConfig ctx, EReference ref){
+ final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
+
+ LogicalSystem root = ctx.getRoot();
+ for (SubSystemRef ssRef : root.getSubSystems())
+ scopes.add(EObjectDescription.create(ssRef.getName(), ssRef));
+
+ return new SimpleScope(IScope.NULLSCOPE, scopes);
+ }
+
+ public IScope scope_ActorInstanceConfig_subSystem(ActorInstanceConfig ctx,
+ EReference ref) {
+ final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
+
+ LogicalSystem root = ctx.getRoot();
+ for (SubSystemRef ssRef : root.getSubSystems())
+ scopes.add(EObjectDescription.create(ssRef.getName(), ssRef));
+
+ return new SimpleScope(IScope.NULLSCOPE, scopes);
+ }
+
+ public IScope scope_PortInstanceConfig_item(PortInstanceConfig ctx,
+ EReference ref) {
+ final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
+
+ ActorInstanceConfig actorConfig = (ActorInstanceConfig) ctx
+ .eContainer();
+ SubSystemClass subsystem = actorConfig.getSubSystem().getType();
+ if (subsystem != null) {
+ ActorClass ac = ConfigUtil
+ .resolve(subsystem, actorConfig.getPath());
+ for (InterfaceItem item : ConfigUtil.getConfigurableInterfaceItems(
+ ac, true))
+ scopes.add(EObjectDescription.create(item.getName(), item));
+ }
+
+ return new SimpleScope(IScope.NULLSCOPE, scopes);
+ }
+
+ public IScope scope_AttrConfig_attribute(AttrConfig ctx, EReference ref) {
+ final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();
+
+ if (ctx.eContainer() instanceof AttrConfig)
+ collectAttributes((AttrConfig) ctx.eContainer(), scopes);
+ else if (ctx.eContainer() instanceof ActorClassConfig)
+ collectAttributes((ActorClassConfig) ctx.eContainer(), scopes);
+ else if (ctx.eContainer() instanceof ActorInstanceConfig)
+ collectAttributes((ActorInstanceConfig) ctx.eContainer(), scopes);
+ else if (ctx.eContainer() instanceof PortClassConfig)
+ collectAttributes((PortClassConfig) ctx.eContainer(), scopes);
+ else if (ctx.eContainer() instanceof PortInstanceConfig)
+ collectAttributes((PortInstanceConfig) ctx.eContainer(), scopes);
+ return new SimpleScope(IScope.NULLSCOPE, scopes);
+ }
+
+ private void collectAttributes(AttrConfig config,
+ List<IEObjectDescription> scopes) {
+ if (config.getAttribute().getRefType().getType() instanceof DataClass) {
+ DataClass dc = (DataClass) config.getAttribute().getRefType()
+ .getType();
+ for (Attribute att : ConfigUtil
+ .filterConfigurableAttributes(RoomHelpers
+ .getAllAttributes(dc))) {
+ scopes.add(EObjectDescription.create(att.getName(), att));
+ }
+ }
+ }
+
+ private void collectAttributes(ActorClassConfig config,
+ List<IEObjectDescription> scopes) {
+ ActorClass actor = config.getActor();
+ if (actor != null) {
+ for (Attribute att : ConfigUtil
+ .filterConfigurableAttributes(RoomHelpers
+ .getAllAttributes(actor))) {
+ scopes.add(EObjectDescription.create(att.getName(), att));
+ }
+ }
+ }
+
+ private void collectAttributes(ActorInstanceConfig config,
+ List<IEObjectDescription> scopes) {
+ SubSystemClass subsystem = config.getSubSystem().getType();
+ if (subsystem != null) {
+ ActorClass actor = ConfigUtil.resolve(subsystem, config.getPath());
+ for (Attribute att : ConfigUtil
+ .filterConfigurableAttributes(RoomHelpers
+ .getAllAttributes(actor))) {
+ scopes.add(EObjectDescription.create(att.getName(), att));
+ }
+ }
+ }
+
+ private void collectAttributes(PortClassConfig config,
+ List<IEObjectDescription> scopes) {
+ ProtocolClassConfig protocolConfig = (ProtocolClassConfig) config
+ .eContainer();
+ PortClass portClass = null;
+ if (protocolConfig.getRegular() == config)
+ portClass = protocolConfig.getProtocol().getRegular();
+ else
+ portClass = protocolConfig.getProtocol().getConjugate();
+
+ if (portClass != null)
+ for (Attribute att : ConfigUtil
+ .filterConfigurableAttributes(portClass.getAttributes()))
+ scopes.add(EObjectDescription.create(att.getName(), att));
+ }
+
+ private void collectAttributes(PortInstanceConfig config,
+ List<IEObjectDescription> scopes) {
+ PortClass portClass = ConfigUtil.getPortClass(config);
+ if (portClass != null)
+ for (Attribute att : ConfigUtil
+ .filterConfigurableAttributes(portClass.getAttributes()))
+ scopes.add(EObjectDescription.create(att.getName(), att));
+ }
+}
+
+/*
+ * IScope scope_<RefDeclaringEClass>_<Reference>( <ContextType> ctx, EReference
+ * ref)
+ *
+ * IScope scope_<TypeToReturn>(<ContextType> ctx, EReference ref)
+ */

Back to the top