Skip to content
Snippets Groups Projects
Commit b9242f2c authored by Nelson Tavares de Sousa's avatar Nelson Tavares de Sousa
Browse files

removed package from grammar

parent fc327e1a
No related branches found
No related tags found
No related merge requests found
...@@ -3,10 +3,25 @@ ...@@ -3,10 +3,25 @@
*/ */
package de.cau.se.teetime.configuration.dsl.ui.contentassist package de.cau.se.teetime.configuration.dsl.ui.contentassist
import de.cau.se.teetime.configuration.dsl.config.Stage
import org.eclipse.emf.ecore.EObject
import org.eclipse.xtext.RuleCall
import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext
import org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor
/** /**
* See https://www.eclipse.org/Xtext/documentation/304_ide_concepts.html#content-assist * See https://www.eclipse.org/Xtext/documentation/304_ide_concepts.html#content-assist
* on how to customize the content assistant. * on how to customize the content assistant.
*/ */
class ConfigProposalProvider extends AbstractConfigProposalProvider { class ConfigProposalProvider extends AbstractConfigProposalProvider {
override complete_Stage(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
super.complete_Stage(model, ruleCall, context, acceptor)
val stage = (model as Stage)
if (stage.active) {
createCompletionProposal("Bla", "DispStr", null, context)
} else {
}
}
} }
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
<eClassifiers xsi:type="ecore:EClass" name="Configuration"> <eClassifiers xsi:type="ecore:EClass" name="Configuration">
<eStructuralFeatures xsi:type="ecore:EReference" name="imports" upperBound="-1" <eStructuralFeatures xsi:type="ecore:EReference" name="imports" upperBound="-1"
eType="#//ImportDeclaration" containment="true"/> eType="#//ImportDeclaration" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="package" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="type" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="type" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="argumentList" eType="#//ArgumentDeclarationList" <eStructuralFeatures xsi:type="ecore:EReference" name="argumentList" eType="#//ArgumentDeclarationList"
containment="true"/> containment="true"/>
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" <genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText="generated by Xtext 2.10.0" modelDirectory="/de.cau.se.teetime.configuration.dsl/src-gen" xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText="generated by Xtext 2.9.2" modelDirectory="/de.cau.se.teetime.configuration.dsl/src-gen"
modelPluginID="de.cau.se.teetime.configuration.dsl" forceOverwrite="true" modelName="Config" modelPluginID="de.cau.se.teetime.configuration.dsl" forceOverwrite="true" modelName="Config"
updateClasspath="false" rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container" updateClasspath="false" rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container"
complianceLevel="6.0" copyrightFields="false" runtimeVersion="2.11"> complianceLevel="6.0" copyrightFields="false" runtimeVersion="2.11">
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
fileExtensions="config" ecorePackage="Config.ecore#/"> fileExtensions="config" ecorePackage="Config.ecore#/">
<genClasses ecoreClass="Config.ecore#//Configuration"> <genClasses ecoreClass="Config.ecore#//Configuration">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Config.ecore#//Configuration/imports"/> <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Config.ecore#//Configuration/imports"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute Config.ecore#//Configuration/package"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute Config.ecore#//Configuration/type"/> <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Config.ecore#//Configuration/type"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Config.ecore#//Configuration/argumentList"/> <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Config.ecore#//Configuration/argumentList"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Config.ecore#//Configuration/elements"/> <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Config.ecore#//Configuration/elements"/>
......
...@@ -6,7 +6,7 @@ Configuration: ...@@ -6,7 +6,7 @@ Configuration:
//most projects will have only few configurations, so we enforce one configuration per file //most projects will have only few configurations, so we enforce one configuration per file
//a configuration must have a name and optionally a package //a configuration must have a name and optionally a package
(imports+=ImportDeclaration)* (imports+=ImportDeclaration)*
(package=QualifiedName)? type=QualifiedName '('(argumentList=ArgumentDeclarationList)?')''{' type=QualifiedName '('(argumentList=ArgumentDeclarationList)?')''{'
(elements += ConfigurationElement)* (elements += ConfigurationElement)*
'}' '}'
; ;
......
...@@ -30,7 +30,6 @@ class ConfigGenerator extends AbstractGenerator { ...@@ -30,7 +30,6 @@ class ConfigGenerator extends AbstractGenerator {
override void doGenerate(Resource resource, IFileSystemAccess2 fsa, IGeneratorContext context) { override void doGenerate(Resource resource, IFileSystemAccess2 fsa, IGeneratorContext context) {
var split = resource.URI.toString.split("\\/") var split = resource.URI.toString.split("\\/")
System.err.print("FIL3: ")
var foundSrc = false; var foundSrc = false;
var package = newArrayList() var package = newArrayList()
split = split.subList(0, split.size - 2) split = split.subList(0, split.size - 2)
...@@ -44,9 +43,6 @@ class ConfigGenerator extends AbstractGenerator { ...@@ -44,9 +43,6 @@ class ConfigGenerator extends AbstractGenerator {
val packageName = String.join(".", package) val packageName = String.join(".", package)
package.add("") package.add("")
val pathName = String.join("/", package) val pathName = String.join("/", package)
System.err.println(pathName)
System.err.println(packageName)
// for (c : resource.allContents.toIterable.filter(Configuration)) { // for (c : resource.allContents.toIterable.filter(Configuration)) {
// model = c // model = c
// if (c.package != null) { // if (c.package != null) {
...@@ -62,9 +58,7 @@ class ConfigGenerator extends AbstractGenerator { ...@@ -62,9 +58,7 @@ class ConfigGenerator extends AbstractGenerator {
def compileConfig(Configuration c, String packageName) ''' def compileConfig(Configuration c, String packageName) '''
«compileHeader» «compileHeader»
«IF c.package != null»
package «packageName.toString»; package «packageName.toString»;
«ENDIF»
«c.compileImports» «c.compileImports»
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment