0

I need your help concerning xtext programmation !
I have a diagramme (sysml model "xmi file") I want to use its elements (name of elements actions ...) to build a new editor using xtext.
I'm a beginner I wonder how to start and how to import the xmi file to explore it contents.

Venkata Krishna
  • 1,768
  • 2
  • 14
  • 21
abdozmeir
  • 11
  • 2
  • did you have a look at sysml tools like papyrus or the proprietary tool your company uses? – Christian Dietrich Feb 18 '15 at 10:50
  • I'm using polarsys Eclipse Industry Working Group I ve created the xmi file (activity diagramme) with it but now I want to use xtext to define an editor using that file (its contents) – abdozmeir Feb 18 '15 at 11:18
  • that makes no sense to me. xtext i textual dsls based on ecore. so can you exactly describe what you want to do? you you want to have a textual dsl for SysML Models or do you want to have a DSL for the Concepts you Described in the SysML model. Neither way there is no automation for that – Christian Dietrich Feb 18 '15 at 11:44
  • I just want to parse the file to use its contents using xtext I'm sure there is some way to do it for example : I want to get those attribute 'a1' id .. on the editor and to be similar to a1.b4.fonction() to use this syntaxe later I hope you understand what I mean – abdozmeir Feb 18 '15 at 16:13
  • so you want to reference from your dsl to elements from the xmi? – Christian Dietrich Feb 18 '15 at 17:16
  • yes I want the user of my editor do like this import model.xmi act1.actb.fonction() act1 and actb exist on the file model.xmi like in java whene you put import Strings and you use its fonctions Strings.length().... but here not a class it's an xmi file but the probleme is that I don't know how to access to its contents using xtext – abdozmeir Feb 18 '15 at 19:03

1 Answers1

0

you can reference non xtext (but ecore based) models if you provide a resourceserviceprovider for them.

  • i dont know if the eclipse sysml tooling you use is ecore based - you have to digg into the plugins or tell how to get them - it would be helpful using a file extension != xmi
  • if it is provide a resourceserviceprovider for that language (alternatively you can load the model in the global scope provider as well)
  • use the ecore based metamodel to define cross references in your dsl

i have described that for uml some years ago here https://christiandietrich.wordpress.com/2011/07/17/xtext-2-0-and-uml/

Christian Dietrich
  • 11,778
  • 4
  • 24
  • 32
  • that's what I'm talking about but I have problems (Error) whene I generate because if this import "http://www.eclipse.org/uml2/3.0.0/UML" as uml can't work I don't know why I'm trying to implement your example I have problem in the first generation – abdozmeir Feb 19 '15 at 11:29
  • you have to replace all UML Stuff it with the stuff from the tooling you use. sry but if you dont give any specific hints that cannot be helped with – Christian Dietrich Feb 19 '15 at 11:37
  • what does this mean error Caused by: java.lang.IllegalStateException: Problem parsing 'classpath:/org/xtext/example/umldsl/UmlDsl.xtext':[XtextLinkingDiagnostic: null:4 Couldn't resolve reference to EPackage 'http://www.eclipse.org/uml2/3.0.0/UML'., XtextLinkingDiagnostic: null:12 Couldn't resolve reference to EClassifier 'Class'., TransformationDiagnostic: null:12 Cannot find type for '[uml::Class]'. (ErrorCode: NoSuchTypeAvailable)] – abdozmeir Feb 19 '15 at 12:06
  • it means it cannot find the ecore package with that namespace. it is added in the workflow – Christian Dietrich Feb 19 '15 at 12:22
  • I'm testing the example in your blog I have errors please help me to solve them. when I write [class::.. I can find options and there is no syntaxing errors but when I generate mwe2 I have an exeption : [XtextLinkingDiagnostic: null:4 Couldn't resolve reference to EPackage 'http://www.eclipse.org/uml2/3.0.0/UML'.] what can I do ? – abdozmeir Feb 22 '15 at 01:07
  • hi which version of eclipse uml2 tools do you use. did you adapt the manifest? since the blog is some years old the uri might be uml2/4.0.0/UML or uml2/5.0.0/UML (if you have uml installed and added it as dependency to the manifest you can search for a class `org.eclipse.uml2.uml.UMLPackage` and have a look at eNsUri field – Christian Dietrich Feb 22 '15 at 10:41
  • the version of eclipse uml2 tools is 4.1.2 how to adapt it ? – abdozmeir Feb 22 '15 at 22:10
  • as i said: have a look at that `org.eclipse.uml2.uml.UMLPackage` class. i dont have the time to redo the whole thing. if you want to get this running with sysml you need to understand what is done anyway. and if you understand what is done you will get it running. – Christian Dietrich Feb 23 '15 at 07:43