References to UML elements [message #1720458] |
Mon, 18 January 2016 18:32 |
Ernesto Posse Messages: 438 Registered: March 2011 |
Senior Member |
|
|
Hi. I'm developing a language that supports references to UML elements, but I'm having trouble building with Xtext 2.9.1.
The abstract syntax for the language is an Ecore model that has an EClass called "UMLProtocol" with a single 'collaboration' attribute that is a reference to a UML Collaboration.
The relevant parts of the Xtext grammar are the following:
grammar org.eclipse.papyrusrt.xtumlrt.xtext.Umlrt with org.eclipse.xtext.common.Terminals
import "http://www.eclipse.org/emf/2002/Ecore" as ecore
import "http://www.eclipse.org/papyrusrt/xtumlrt/common"
import "http://www.eclipse.org/papyrusrt/xtumlrt/umlrt"
import "http://www.eclipse.org/uml2/5.0.0/UML" as uml // (1)
Import returns AbstractImport:
'import' 'ns' {Import} importedNamespace=QualifiedName ('.*')?
| 'import' 'uri' {URIImport} importURI=STRING
;
QualifiedName:
ID ('.' ID)*
;
// ...
fragment ProtocolReferenceFragment returns RTPort:
':' type=[Protocol | QualifiedName]
| ':' 'uml' type=[UMLProtocol | QualifiedName]
;
The workflow is this:
module org.eclipse.papyrusrt.xtumlrt.xtext.GenerateTumlrt
import org.eclipse.xtext.xtext.generator.*
import org.eclipse.xtext.xtext.generator.model.project.*
var rootPath = ".."
Workflow {
component = XtextGenerator {
configuration = {
project = StandardProjectConfig {
baseName = "org.eclipse.papyrusrt.xtumlrt.xtext"
rootPath = rootPath
runtimeTest = {
enabled = true
}
eclipsePlugin = {
enabled = true
}
eclipsePluginTest = {
enabled = true
}
createEclipseMetaData = true
}
code = {
encoding = "UTF-8"
fileHeader = "/*\n * generated by Xtext \${version}\n */"
}
}
language = StandardLanguage {
name = "org.eclipse.papyrusrt.xtumlrt.xtext.Tumlrt"
fileExtensions = "umlrt"
referencedResource = "platform:/resource/org.eclipse.papyrusrt.xtumlrt.umlrt.model/model/umlrt.genmodel"
referencedResource = "platform:/resource/org.eclipse.papyrusrt.xtumlrt.common.model/model/common.genmodel"
fragment = ecore2xtext.Ecore2XtextValueConverterServiceFragment2 auto-inject {}
fragment = org.eclipse.xtext.generator.adapter.FragmentAdapter {
fragment = org.eclipse.xtext.generator.ecore2xtext.FormatterFragment {}
}
serializer = {
generateStub = false
}
validator = {
// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
}
}
}
}
but when running it I get this:
0 [main] INFO text.xtext.generator.XtextGenerator - Initializing Xtext generator
9 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Adding generated EPackage 'org.eclipse.xtext.common.types.TypesPackage'
209 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Registering project org.eclipse.papyrusrt.xtumlrt.xtext at 'file:/Users/epp/Development/PapyrusRT/git/org.eclipse.papyrus-rt/plugins/xtumlrt/xtext/org.eclipse.papyrusrt.xtumlrt.xtext/'
209 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Registering project org.eclipse.papyrusrt.xtumlrt.xtext.tests at 'file:/Users/epp/Development/PapyrusRT/git/org.eclipse.papyrus-rt/plugins/xtumlrt/xtext/org.eclipse.papyrusrt.xtumlrt.xtext.tests/'
209 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Registering project org.eclipse.papyrusrt.xtumlrt.xtext.ide at 'file:/Users/epp/Development/PapyrusRT/git/org.eclipse.papyrus-rt/plugins/xtumlrt/xtext/org.eclipse.papyrusrt.xtumlrt.xtext.ide/'
209 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Registering project org.eclipse.papyrusrt.xtumlrt.xtext.ui at 'file:/Users/epp/Development/PapyrusRT/git/org.eclipse.papyrus-rt/plugins/xtumlrt/xtext/org.eclipse.papyrusrt.xtumlrt.xtext.ui/'
209 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Registering project org.eclipse.papyrusrt.xtumlrt.xtext.ui.tests at 'file:/Users/epp/Development/PapyrusRT/git/org.eclipse.papyrus-rt/plugins/xtumlrt/xtext/org.eclipse.papyrusrt.xtumlrt.xtext.ui.tests/'
224 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Using resourceSet registry. The registered Packages will not be registered in the global EPackage.Registry.INSTANCE!
583 [main] INFO clipse.emf.mwe.utils.GenModelHelper - Registered GenModel 'http://www.eclipse.org/Xtext/Xbase/XAnnotations' from 'platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel'
588 [main] INFO clipse.emf.mwe.utils.GenModelHelper - Registered GenModel 'http://www.eclipse.org/xtext/xbase/Xtype' from 'platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel'
614 [main] INFO clipse.emf.mwe.utils.GenModelHelper - Registered GenModel 'http://www.eclipse.org/xtext/xbase/Xbase' from 'platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel'
614 [main] INFO clipse.emf.mwe.utils.GenModelHelper - Registered GenModel 'http://www.eclipse.org/xtext/common/JavaVMTypes' from 'platform:/resource/org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel'
712 [main] INFO clipse.emf.mwe.utils.GenModelHelper - Registered GenModel 'http://www.eclipse.org/papyrusrt/xtumlrt/umlrt' from 'platform:/resource/org.eclipse.papyrusrt.xtumlrt.umlrt.model/model/umlrt.genmodel'
712 [main] INFO clipse.emf.mwe.utils.GenModelHelper - Registered GenModel 'http://www.eclipse.org/papyrusrt/xtumlrt/common' from 'platform:/resource/org.eclipse.papyrusrt.xtumlrt.common.model/model/common.genmodel'
713 [main] ERROR xt.generator.XtextGeneratorLanguage - Error loading 'platform:/plugin/org.eclipse.uml2.uml/model/UML.genmodel'
713 [main] ERROR xt.generator.XtextGeneratorLanguage - Error loading 'platform:/plugin/org.eclipse.uml2.types/model/Types.genmodel'
713 [main] ERROR xt.generator.XtextGeneratorLanguage - Error loading 'platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel'
1325 [main] ERROR xt.generator.XtextGeneratorLanguage - [XtextLinkingDiagnostic: null:7 Couldn't resolve reference to EPackage 'http://www.eclipse.org/uml2/5.0.0/UML'., TransformationDiagnostic: null:27 Cannot find compatible feature importURI in sealed EClass URIImport from imported package http://www.eclipse.org/papyrusrt/xtumlrt/umlrt: The existing attribute 'importURI' has an incompatible type 'null'. The expected type is 'EString' [java.lang.String]. (ErrorCode: CannotCreateTypeInSealedMetamodel)]
1328 [main] ERROR mf.mwe2.launch.runtime.Mwe2Launcher - Problems running workflow org.eclipse.papyrusrt.xtumlrt.xtext.GenerateTumlrt: Problem parsing 'file:/Users/epp/Development/PapyrusRT/git/org.eclipse.papyrus-rt/plugins/xtumlrt/xtext/org.eclipse.papyrusrt.xtumlrt.xtext/../org.eclipse.papyrusrt.xtumlrt.xtext/src/org/eclipse/papyrusrt/xtumlrt/xtext/Tumlrt.xtext':
XtextLinkingDiagnostic: null:7 Couldn't resolve reference to EPackage 'http://www.eclipse.org/uml2/5.0.0/UML'.
TransformationDiagnostic: null:27 Cannot find compatible feature importURI in sealed EClass URIImport from imported package http://www.eclipse.org/papyrusrt/xtumlrt/umlrt: The existing attribute 'importURI' has an incompatible type 'null'. The expected type is 'EString' [java.lang.String]. (ErrorCode: CannotCreateTypeInSealedMetamodel)
java.lang.RuntimeException: Problems running workflow org.eclipse.papyrusrt.xtumlrt.xtext.GenerateTumlrt: Problem parsing 'file:/Users/epp/Development/PapyrusRT/git/org.eclipse.papyrus-rt/plugins/xtumlrt/xtext/org.eclipse.papyrusrt.xtumlrt.xtext/../org.eclipse.papyrusrt.xtumlrt.xtext/src/org/eclipse/papyrusrt/xtumlrt/xtext/Tumlrt.xtext':
XtextLinkingDiagnostic: null:7 Couldn't resolve reference to EPackage 'http://www.eclipse.org/uml2/5.0.0/UML'.
TransformationDiagnostic: null:27 Cannot find compatible feature importURI in sealed EClass URIImport from imported package http://www.eclipse.org/papyrusrt/xtumlrt/umlrt: The existing attribute 'importURI' has an incompatible type 'null'. The expected type is 'EString' [java.lang.String]. (ErrorCode: CannotCreateTypeInSealedMetamodel)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:104)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:62)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:52)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:78)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:36)
Caused by: java.lang.IllegalStateException: Problem parsing 'file:/Users/epp/Development/PapyrusRT/git/org.eclipse.papyrus-rt/plugins/xtumlrt/xtext/org.eclipse.papyrusrt.xtumlrt.xtext/../org.eclipse.papyrusrt.xtumlrt.xtext/src/org/eclipse/papyrusrt/xtumlrt/xtext/Tumlrt.xtext':
XtextLinkingDiagnostic: null:7 Couldn't resolve reference to EPackage 'http://www.eclipse.org/uml2/5.0.0/UML'.
TransformationDiagnostic: null:27 Cannot find compatible feature importURI in sealed EClass URIImport from imported package http://www.eclipse.org/papyrusrt/xtumlrt/umlrt: The existing attribute 'importURI' has an incompatible type 'null'. The expected type is 'EString' [java.lang.String]. (ErrorCode: CannotCreateTypeInSealedMetamodel)
at org.eclipse.xtext.xtext.generator.XtextGeneratorLanguage.initialize(XtextGeneratorLanguage.java:280)
at org.eclipse.xtext.xtext.generator.StandardLanguage.initialize(StandardLanguage.java:166)
at org.eclipse.xtext.xtext.generator.XtextGenerator.initialize(XtextGenerator.java:176)
at org.eclipse.xtext.xtext.generator.XtextGenerator.checkConfigurationInternal(XtextGenerator.java:120)
at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent2.checkConfiguration(AbstractWorkflowComponent2.java:21)
at org.eclipse.emf.mwe.core.lib.Mwe2Bridge.preInvoke(Mwe2Bridge.java:65)
at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.preInvoke(AbstractWorkflowComponent.java:197)
at org.eclipse.emf.mwe2.runtime.workflow.AbstractCompositeWorkflowComponent.preInvoke(AbstractCompositeWorkflowComponent.java:29)
at org.eclipse.emf.mwe2.runtime.workflow.Workflow.run(Workflow.java:18)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:102)
... 4 more
Now, I do not have org.eclipse.uml2.uml as a project in my workspace but it is installed, Xtext recognizes it to be a registered package and I expect it to be available in the target platform.
Furthermore, I have installed the latest UML2, which is 5.1.0. It would seem like an error in line (1) in the grammar where I use 'import "http://www.eclipse.org/uml2/5.0.0/UML" as uml', but it turns out that the Ns URI declared in UML.ecore is "http://www.eclipse.org/uml2/5.0.0/UML". (If I change that line to 5.1.0, the Xtext editor points an error, with 5.0.0 it only shows a warning saying that the package contains references to elements in the package registry and not in the workspace)
Why is it complaining about not finding the package if I have it installed? I have checked and both UML.ecore and UML.genmodel are included in the jar file under the 'model' folder.
Given the warning message, is it not possible to have references to elements that are not in the workspace? Would I have to import org.eclipse.uml2.uml as a project in the workspace for it to work?
I tried adding
referencedResource = "platform:/plugin/org.eclipse.uml2.uml/model/UML.genmodel"
to the StandardLanguage configuration, but then it fails when registering the packages saying that it doesn't recognize the 'platform' protocol.
I thought it could be dealt with by adding a URI map, as it used to be possible with the old workflow, but I can't find how to add URI maps in the new configuration style.
It's also complaining about the type importURI attribute, but the type is set to EString in the model.
Any help is appreciated.
Thanks.
|
|
|
|
|
|
Re: References to UML elements [message #1720478 is a reply to message #1720475] |
Mon, 18 January 2016 20:35 |
Ernesto Posse Messages: 438 Registered: March 2011 |
Senior Member |
|
|
I tried with the old-style workflow (below) and it succeeds, but there are some strange errors:
1761 [main] ERROR ipse.xtext.generator.LanguageConfig - Error loading 'platform:/plugin/org.eclipse.uml2.uml/model/UML.genmodel'
1761 [main] ERROR ipse.xtext.generator.LanguageConfig - Error loading 'platform:/plugin/org.eclipse.uml2.codegen.ecore/model/GenModel.genmodel'
1761 [main] ERROR ipse.xtext.generator.LanguageConfig - Error loading 'platform:/plugin/org.eclipse.uml2.types/model/Types.genmodel'
1761 [main] ERROR ipse.xtext.generator.LanguageConfig - Error loading 'platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel'
I also discovered that the uml2/2.2.0/GenModel was located under org.eclipse.uml2.codegen.ecore. I added it to the referencedResources, to the list of dependencies and to the usedGenPackages of my genmodel, but it made no difference.
Now I'm confused: since it works with the old-style worflow, there's something about the new style that may have a bug, but even with the old-style it complains with those errors, which after debugging I found something bizarre: those genmodels are added to the resource set, but when actually loading their contents, the contents are empty! It seems that this doesn't bother the Xtext generator, though. This is strange.
Could this be a bug?
I'd like to use the new-style workflow.
The old-style workflow that works is this:
module org.eclipse.papyrusrt.xtumlrt.xtext.Tumlrt
import org.eclipse.emf.mwe.utils.*
import org.eclipse.xtext.generator.*
import org.eclipse.xtext.ui.generator.*
var projectName = "org.eclipse.papyrusrt.xtumlrt.xtext"
var grammarURI = "platform:/resource/${projectName}/src/org/eclipse/papyrusrt/xtumlrt/xtext/Tumlrt.xtext"
var fileExtensions = "umlrt"
var generateXtendStub = true
//var workspaceDefault = "./source" This should be the value for the workspace provided by the maven build
var workspaceDefault = "../../../.."
var workspace = "${workspaceDefault}"
var xtumlrtBaseDir = "${workspace}/plugins/xtumlrt"
var xtextBaseDir = "${xtumlrtBaseDir}/xtext"
var umlrtCodeGenDir = "${workspace}/plugins/umlrt/codegen"
var platformUri = xtumlrtBaseDir
var runtimeProject = "${xtextBaseDir}/${projectName}"
Workflow {
bean = StandaloneSetup {
// use an XtextResourceset throughout the process, which is able to resolve classpath:/ URIs.
resourceSet = org.eclipse.xtext.resource.XtextResourceSet:theResourceSet {}
scanClassPath = true
platformUri = "${platformUri}"
// add mappings from platform:/resource to classpath:/
uriMap = {
from = "platform:/resource/org.eclipse.xtext.xbase/"
to = "classpath:/"
}
uriMap = {
from = "platform:/resource/org.eclipse.xtext.common.types/"
to = "classpath:/"
}
uriMap = {
from = "platform:/resource/org.eclipse.papyrusrt.xtumlrt.common.model/"
to = "${xtumlrtBaseDir}/metamodel/org.eclipse.papyrusrt.xtumlrt.common.model/"
}
uriMap = {
from = "platform:/resource/org.eclipse.papyrusrt.xtumlrt.umlrt.model/"
to = "${xtumlrtBaseDir}/metamodel/org.eclipse.papyrusrt.xtumlrt.umlrt.model/"
}
uriMap = {
from = "platform:/resource/org.eclipse.papyrusrt.codegen.statemachines.flat.model/model/smflatmodel.genmodel"
to = "${umlrtCodeGenDir}/org.eclipse.papyrusrt.codegen.statemachines.flat.model/model/smflatmodel.genmodel"
}
registerGenModelFile = "platform:/resource/org.eclipse.papyrusrt.xtumlrt.common.model/model/common.genmodel"
registerGenModelFile = "platform:/resource/org.eclipse.papyrusrt.xtumlrt.umlrt.model/model/umlrt.genmodel"
registerGeneratedEPackage = "org.eclipse.papyrusrt.xtumlrt.common.CommonPackage"
registerGeneratedEPackage = "org.eclipse.papyrusrt.xtumlrt.umlrt.UmlrtPackage"
// registerGeneratedEPackage = "org.eclipse.papyrusrt.codegen.statemachines.flat.model"
// registerGenModelFile = "platform:/resource/org.eclipse.papyrusrt.codegen.statemachines.flat.model/model/smflatmodel.genmodel"
}
component = DirectoryCleaner {
directory = "${runtimeProject}/src-gen"
}
component = DirectoryCleaner {
directory = "${runtimeProject}.ui/src-gen"
}
component = Generator {
pathRtProject = runtimeProject
pathUiProject = "${runtimeProject}.ui"
pathTestProject = "${runtimeProject}.tests"
projectNameRt = projectName
projectNameUi = "${projectName}.ui"
language = auto-inject {
forcedResourceSet = theResourceSet
uri = grammarURI
// Java API to access grammar elements (required by several other fragments)
fragment = grammarAccess.GrammarAccessFragment auto-inject {}
// generates Java API for the generated EPackages
// fragment = ecore.EcoreGeneratorFragment auto-inject {}
// the Ecore2Xtext specific terminal converter
fragment = ecore2xtext.Ecore2XtextValueConverterServiceFragment auto-inject {}
// serializer 2.0
fragment = serializer.SerializerFragment auto-inject {
//generateStub = false
}
// the old serialization component
// fragment = parseTreeConstructor.ParseTreeConstructorFragment auto-inject {}
// a custom ResourceFactory for use with EMF
fragment = resourceFactory.ResourceFactoryFragment auto-inject {}
// the Antlr parser
fragment = parser.antlr.XtextAntlrGeneratorFragment auto-inject {
options = {
classSplitting = true
}
}
// Xtend-based API for validation
fragment = validation.ValidatorFragment auto-inject {
// composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
}
// old scoping and exporting API
// fragment = scoping.ImportNamespacesScopingFragment auto-inject {}
// fragment = exporting.QualifiedNamesFragment auto-inject {}
// scoping and exporting API
fragment = scoping.ImportURIScopingFragment auto-inject {}
fragment = exporting.SimpleNamesFragment auto-inject {}
fragment = builder.BuilderIntegrationFragment auto-inject {}
// generator API
fragment = generator.GeneratorFragment auto-inject {}
// formatter API
// fragment = formatting.FormatterFragment auto-inject {}
fragment = ecore2xtext.FormatterFragment auto-inject {}
// labeling API
fragment = labeling.LabelProviderFragment auto-inject {}
// outline API
fragment = outline.OutlineTreeProviderFragment auto-inject {}
fragment = outline.QuickOutlineFragment auto-inject {}
// quickfix API
fragment = quickfix.QuickfixProviderFragment auto-inject {}
//content assist API
fragment = contentAssist.ContentAssistFragment auto-inject {}
// antlr parser generator tailored for content assist
fragment = parser.antlr.XtextAntlrUiGeneratorFragment auto-inject {
options = {
classSplitting = true
}
}
// generates junit test support classes into Generator#pathTestProject
fragment = junit.Junit4Fragment auto-inject {}
// project wizard (optional)
// fragment = projectWizard.SimpleProjectWizardFragment auto-inject {
// generatorProjectName = "${projectName}.generator"
// }
// rename refactoring
fragment = refactoring.RefactorElementNameFragment auto-inject {}
// provides the necessary bindings for java types integration
fragment = types.TypesGeneratorFragment auto-inject {}
// generates the required bindings only if the grammar inherits from Xbase
fragment = xbase.XbaseGeneratorFragment auto-inject {}
// generates the required bindings only if the grammar inherits from Xtype
fragment = xbase.XtypeGeneratorFragment auto-inject {}
// provides a preference page for template proposals
fragment = templates.CodetemplatesGeneratorFragment auto-inject {}
// provides a compare view
fragment = compare.CompareFragment auto-inject {}
}
}
}
|
|
|
|
|
Re: References to UML elements [message #1720487 is a reply to message #1720483] |
Mon, 18 January 2016 21:22 |
|
i came so far but now i am stuck
bean = org.xtext.example.mydsl2.UriMapper {
uriMap = {
from = "platform:/plugin/org.eclipse.emf.codegen.ecore/model/GenModel.genmodel"
to = "platform:/resource/org.eclipse.emf.codegen.ecore/model/GenModel.genmodel"
}
uriMap = {
from = "platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel"
to = "platform:/resource/org.eclipse.emf.ecore/model/Ecore.genmodel"
}
uriMap = {
from = "platform:/plugin/org.eclipse.uml2.codegen.ecore/model/GenModel.genmodel"
to = "platform:/resource/org.eclipse.uml2.codegen.ecore/model/GenModel.genmodel"
}
uriMap = {
from = "platform:/plugin/org.eclipse.uml2.uml/model/UML.genmodel"
to = "platform:/resource/org.eclipse.uml2.uml/model/UML.genmodel"
}
uriMap = {
from = "platform:/plugin/org.eclipse.emf.codegen.ecore/model/GenModel.ecore"
to = "platform:/resource/org.eclipse.emf.codegen.ecore/model/GenModel.ecore"
}
uriMap = {
from = "platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore"
to = "platform:/resource/org.eclipse.emf.ecore/model/Ecore.ecore"
}
uriMap = {
from = "platform:/plugin/org.eclipse.uml2.types/model/Types.ecore"
to = "platform:/resource/org.eclipse.uml2.types/model/Types.ecore"
}
uriMap = {
from = "platform:/plugin/org.eclipse.uml2.types/model/Types.genmodel"
to = "platform:/resource/org.eclipse.uml2.types/model/Types.genmodel"
}
uriMap = {
from = "platform:/plugin/org.eclipse.uml2.codegen.ecore/model/GenModel.ecore"
to = "platform:/resource/org.eclipse.uml2.codegen.ecore/model/GenModel.ecore"
}
uriMap = {
from = "platform:/plugin/org.eclipse.uml2.uml/model/UML.ecore"
to = "platform:/resource/org.eclipse.uml2.uml/model/UML.ecore"
}
}
component = XtextGenerator {
package org.xtext.example.mydsl2;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.resource.URIConverter;
import org.eclipse.emf.mwe.core.ConfigurationException;
import org.eclipse.emf.mwe.utils.Mapping;
import org.eclipse.uml2.codegen.ecore.genmodel.GenModelPackage;
public class UriMapper {
public UriMapper() {
EPackage p = GenModelPackage.eINSTANCE;
}
public void addUriMap(final Mapping uriMap) {
final URI baseUri = URI.createURI(uriMap.getFrom());
final URI mappedUri = URI.createURI(uriMap.getTo());
if (mappedUri == null)
throw new ConfigurationException("cannot make URI out of " + uriMap.getTo());
else {
URIConverter.URI_MAP.put(baseUri, mappedUri);
}
}
}
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
|
|
|
|
|
|
Re: References to UML elements [message #1720837 is a reply to message #1720608] |
Thu, 21 January 2016 10:54 |
|
I tried to reproduce a similar setup and it works if I add a StandaloneSetup as described Christians blog. You can still use the StandaloneSetup with the new Xtext 2.9 workflow style. Try adding
bean = org.eclipse.emf.mwe.utils.StandaloneSetup {
platformUri = rootPath
scanClassPath = true
uriMap = {
from = "platform:/plugin/org.eclipse.emf.codegen.ecore/model/GenModel.genmodel"
to = "platform:/resource/org.eclipse.emf.codegen.ecore/model/GenModel.genmodel"
}
uriMap = {
from = "platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel"
to = "platform:/resource/org.eclipse.emf.ecore/model/Ecore.genmodel"
}
uriMap = {
from = "platform:/plugin/org.eclipse.uml2.codegen.ecore/model/GenModel.genmodel"
to = "platform:/resource/org.eclipse.uml2.codegen.ecore/model/GenModel.genmodel"
}
uriMap = {
from = "platform:/plugin/org.eclipse.uml2.uml/model/UML.genmodel"
to = "platform:/resource/org.eclipse.uml2.uml/model/UML.genmodel"
}
uriMap = {
from = "platform:/plugin/org.eclipse.emf.codegen.ecore/model/GenModel.ecore"
to = "platform:/resource/org.eclipse.emf.codegen.ecore/model/GenModel.ecore"
}
uriMap = {
from = "platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore"
to = "platform:/resource/org.eclipse.emf.ecore/model/Ecore.ecore"
}
uriMap = {
from = "platform:/plugin/org.eclipse.uml2.codegen.ecore/model/GenModel.ecore"
to = "platform:/resource/org.eclipse.uml2.codegen.ecore/model/GenModel.ecore"
}
uriMap = {
from = "platform:/plugin/org.eclipse.uml2.uml/model/UML.ecore"
to = "platform:/resource/org.eclipse.uml2.uml/model/UML.ecore"
}
uriMap = {
from = "platform:/plugin/org.eclipse.uml2.types/model/Types.genmodel"
to = "platform:/resource/org.eclipse.uml2.types/model/Types.genmodel"
}
registerGeneratedEPackage = "org.eclipse.emf.ecore.EcorePackage"
registerGeneratedEPackage = "org.eclipse.uml2.uml.UMLPackage"
registerGeneratedEPackage = "org.eclipse.emf.codegen.ecore.genmodel.GenModelPackage"
registerGeneratedEPackage = "org.eclipse.uml2.codegen.ecore.genmodel.GenModelPackage"
registerGenModelFile = "platform:/resource/org.eclipse.emf.ecore/model/Ecore.genmodel"
registerGenModelFile = "platform:/resource/org.eclipse.emf.codegen.ecore/model/GenModel.genmodel"
registerGenModelFile = "platform:/resource/org.eclipse.uml2.uml/model/UML.genmodel"
registerGenModelFile = "platform:/resource/org.eclipse.uml2.types/model/Types.genmodel"
registerGenModelFile = "platform:/resource/org.eclipse.uml2.codegen.ecore/model/GenModel.genmodel"
}
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04447 seconds