Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Updated domain model generator with Reflective editor
/*******************************************************************************
* Copyright (c) 2010 itemis AG (http://www.itemis.eu) and others.
* 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
*******************************************************************************/
module org.eclipse.xtext.example.domainmodel.GenerateDomainmodelLanguage
import org.eclipse.emf.mwe.utils.*
import org.eclipse.xtext.generator.*
import org.eclipse.xtext.ui.generator.*
import hu.cubussapiens.xtext.reflectiveeditor.generator.*
var grammarURI = "classpath:/org/eclipse/xtext/example/domainmodel/Domainmodel.xtext"
var file.extensions = "dmodel"
var projectName = "org.eclipse.xtext.example.domainmodel"
var runtimeProject = "../${projectName}"
var lineDelimiter = '\n'
Workflow {
bean = StandaloneSetup {
scanClassPath = true
registerGeneratedEPackage = "org.eclipse.xtext.xbase.XbasePackage"
registerGenModelFile = "platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel"
registerGenModelFile = "platform:/resource/org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel"
}
component = DirectoryCleaner {
directory = "${runtimeProject}/src-gen"
}
component = DirectoryCleaner {
directory = "${runtimeProject}.ui/src-gen"
}
component = DirectoryCleaner {
directory = "${runtimeProject}.tests/src-gen"
}
component = Generator auto-inject {
pathRtProject = runtimeProject
pathUiProject = "${runtimeProject}.ui"
pathTestProject = "${runtimeProject}.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 auto-inject {}
// Generate java classes for Ecore models
fragment = ecore.EMFGeneratorFragment auto-inject {
emfRuntimeVersion = "2.10"
}
// the serialization component
fragment = serializer.SerializerFragment {}
// a custom ResourceFactory for use with EMF
fragment = resourceFactory.ResourceFactoryFragment {
fileExtensions = file.extensions
}
// the following fragment generates an Antlr parser
fragment = parser.antlr.XtextAntlrGeneratorFragment auto-inject {}
// java-based API for validation
fragment = validation.JavaValidatorFragment {
// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
}
// scoping API
fragment = scoping.ImportNamespacesScopingFragment {
generateStub = false
}
fragment = exporting.QualifiedNamesFragment {}
// testing API
fragment = junit.Junit4Fragment {}
// formatter API
fragment = formatting2.Formatter2Fragment {}
// labeling API
fragment = labeling.LabelProviderFragment {}
// outline API
fragment = outline.OutlineTreeProviderFragment {}
fragment = outline.QuickOutlineFragment {}
// java-based API for content assistance
fragment = contentAssist.JavaBasedContentAssistFragment {}
fragment = parser.antlr.XtextAntlrUiGeneratorFragment auto-inject {
partialParsing = true
}
fragment = builder.BuilderIntegrationFragment {}
// quickfix API
fragment = quickfix.QuickfixProviderFragment {}
// rename refactoring
fragment = refactoring.RefactorElementNameFragment {}
// provides a compare view
fragment = compare.CompareFragment {
fileExtensions = file.extensions
}
// Xbase support
fragment = types.TypesGeneratorFragment {}
fragment = xbase.XbaseGeneratorFragment {}
// Code generator
fragment = generator.GeneratorFragment {
}
fragment = templates.CodetemplatesGeneratorFragment {}
fragment = ReflectiveXtextEditorFragment {
fileExtensions = file.extensions
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.