eclipse-emf

What are the main differences between Jetbrains' MPS and Eclipse Xtext?

断了今生、忘了曾经 提交于 2019-12-20 08:24:03
问题 I have used Eclipse Xtext in several projects. I loved the ease of defining a grammar over an Ecore (meta)model and letting everything generated for you including awesome Eclipse plugin editor, but I was quite uncomfortable with the underlying EMF framework with everything hard-wired in static fields. Lately I came across Jetbrains' MPS (Meta Programming System). It's based on completely different philosophy. While Xtext is for creating text-based DSLs generating a parser for you (and

How to convert XSD to Ecore (EMF)

五迷三道 提交于 2019-12-18 16:31:32
问题 What is the best way to convert .xsd -files into .ecore -files? Is there an Eclipse plugin for that? 回答1: That's what worked for me: New -> Project... Eclipse Modeling Framework -> EMF Project Model Importers: XML Schema Model URIs : [Select xsd-File] To revalidate the .ecore-File when xsd has changed: Right-Click on .genmodel -File Reload... 回答2: If you do not want to create a new MDT project every time you want to import a schema as ECore model then there is also another way to do this: New

Where can I find a valid SVG XML Schema (for ecore generation)?

浪子不回头ぞ 提交于 2019-12-18 05:57:06
问题 I tried importing the SVG XML Schema into EMF, to obtain the SVG metamodel in ecore. However, the import failed due to the schema not being valid: indeed, svg.xsd references XMLSchema.dtd, which itself references datatypes.dtd, which does not exist! Consequently, I tried downloading the necessary files from the svg website (svg.xsd, XMLSchema.dtd, xlink.xsd, xml.xsd), and the missing datatypes.dtd, from another location. However, I keep getting many errors when validating the schema, e.g.

How to use EMF to read XML file?

有些话、适合烂在心里 提交于 2019-12-18 01:22:08
问题 EMF = Eclipse Modeling Framework I have to use EMF in one of my class projects. I am trying to understand how to use EMF to do the following: Read XML, Get the values into objects. Use ORM to persist the values in objects to database. - Done Get data from database using ORM and generate XML. I need to do all of that using: EMF (no idea what so ever) and JPA (DONE). I have used JAXB and I know, this can be done using JAXB, but how is (EMF == JAXB)?! I have created many java classes using EMF,

Why use a factory instead of 'new'?

谁说我不能喝 提交于 2019-12-14 01:42:31
问题 I am reading the book EMF: Eclipse Modeling Framework where its stated: The EMF programming model strongly encourages, but doesn’t require, the use of factories for creating objects. Instead of simply using the new operator to create [an object]... Why is the use of factories encouraged over new ? Your answer does not have to be EMF specific, as long as it has to do with Java. 回答1: You can read Effective Java Item 1: Consider static factory methods instead of constructors. It describes

Eclipse EMF: How to get access EAttribute by name?

风格不统一 提交于 2019-12-12 14:26:51
问题 I have a Java method that is passed a String and an EMF EObject. The String is meant to be the name of an attribute of the EObject. For example, if it were passed "foo" and EObject eobj, it would need to access eobj.getFoo(). I know how to get the value of an EAttibute from its featureID, but can't seem to find a way to get it by attribute name. Is this even possible? 回答1: The following should do the trick, but it is not elegant at all . It obtains the eClass of your eObject , finds a

Loading same plugin twice with different version in Eclipse

孤街浪徒 提交于 2019-12-11 23:58:44
问题 I have two different versions of an EMF plugin which loads a certain .xmi. The latter version has been changed so that the xmi from the previous version is incompatible. What I want to do is to load the xmi's with the first plugin and then programatically build a model using the newer plugin thus migrating older models. They are identical apart from some changes within an EMF model. How do I load these plugins? Is it possible? Are there better strategies? 回答1: I suggest changing the id of the

GMF display diagram example

二次信任 提交于 2019-12-11 11:35:49
问题 How can I display a GMF diagram, with the file format "*.ecorediag" in Eclipse in a View? The diagram should not be editable. Is there a simple sample view that loads a diagram from say "/home/diagrams/test.ecorediag" 回答1: The GMF diagrams (including ecorediag) are rendered on the editor with the help of "org.eclipse.gmf.runtime.diagram.ui.parts.DiagramGraphicalViewer". So the bare minimum code to make this work DiagramGraphicalViewer viewer = new DiagramGraphicalViewer(); viewer

Workspace is closed error

大憨熊 提交于 2019-12-11 07:44:02
问题 I have created a EMF model and generated a model code for that. I have created one plugin project and i have created one class named as 'CommandTest' which is having "public static void main()" method which reads mymodel resource file. Its working fine in eclipse 3.5.2. There is no issues am able to read the contents. But same thing am running through command prompt, am getting error "Workspace is closed". I have included my plugin folder in my classpath. I have used one statement resource

Java source code editor as an Eclipse view

*爱你&永不变心* 提交于 2019-12-11 05:05:35
问题 I have defined an EMF metamodel in which some elements have a String field which will contain some Java code. I am trying to create/reuse a (Java) source code editor as part of the tabbed properties view to be able to edit that field with some IDE-like functionality. It would be great to adapt the JDT editor to use it here, but for I have read, it is not feasible. Extending org.eclipse.swt.widgets.Text to provide all that functionality seems to be too much of an overkill for this simple