Is it possible to generate XML file in gef - eclipse-plugin

Is it possible to generate XML file from Shape example in GEF,Same as its getting generated in GMF?
Like in GMF if we select GMF Design page and open it with XML file,it provides all external information about model figures,same like i want to generate with GEF.

There is really no connections between the GEF and the way of persistance of it's domain model.
Here is two possible solutions:
1. If you domain model are plain java objects (POJOs) try using JAXB, and annotate them with JAXB annotations.Then use JAXB to persist them.
2. Switch to using EMF (which will provide you XML serrialization out of the box) and probably to GMF.
For just Shapes Example - there is a EMF - driven Shapes Example which will serrialize model to XMI, but that can be easily changed to XML.

In GMF you get automatic XML serialization since GMF is build on top EMF and GMF, using EMF as the model and GEF as the MVC framework. Editors that use GEF only must take care of serialization however they like.

Related

How to set custom name, suffix for mapper files and interfaces in mybatis generator?

Can you set custom suffix and naming rule mapper xml and interfaces in MyBatis Generator (MBG)?
For example, When generating mapper files for class Book. MBG generates mapper file BookMapper.xml and interface PartnerDao.java. However, I wish to change the suffix to something else, like BookMapperBase.xml or BookDaoBase.xml, and PartnerMapperBase.java or PartnerDaoBase.java.
The reason is, former colleagues were using BookMapper.xml for their hand-written sql statements and using the same name would cause confusion. Moreover, I do not wish to use generated mappers directly, but use custom mapper files that extend BookMapperBase.xml.
I have searched online and found some github projects and hot rod ORM, but is it really not supported by official Mybatis Generator? If not, what is your recommended alternative?
There are a couple of options.
You could use a domain object renaming rule as documented here: http://www.mybatis.org/generator/configreference/domainObjectRenamingRule.html
If that doesn't work the way you want it to, you could write a MyBatis Generator plugin to change the names of the generated artifacts. There is an example here: https://github.com/mybatis/generator/blob/master/core/mybatis-generator-core/src/main/java/org/mybatis/generator/plugins/RenameExampleClassPlugin.java

How to listen for "Example EMF Model Creation Wizards"?

I am developing a plugin for Eclipse Mars.2. I want to know if it is possible to create Example EMF Model Creation Wizards file programmatically and add data to the generated model file. Is it possible ?
EDIT
I have defined an ecore model that I use to create an Example EMF Model Creation Wizards file but I would like to do that automatically. My problem is that when I generate a file with all the correct data in it, I can't use it and navigate through the data. I have to copy the text data into a file created with the Eclipse wizard to make it work. This file is then interpreted by a Sirius diagram/table definition to create a graphical view.
Not sure what the question actually is, so taking it literally I say you can use the EMF APIs to create models programmatically. This has nothing to do with the wizards though.

Multiple Ecore/EMF models in Eclipse plugin

Begin relative new to EMF I can only give sketch of what I want to do. The end product is a eclipse plug-in that have access to at least two EMF models. The first model is created by using Xtext to defined DSL. The second EMF is created using xtend code based on a ecore model.
My questions:
How to create a ecore model that will be visible in the plug in?
How to create an EMF instance of the ecore model using java/xtend when the code is executed in the plug in. The code snippets I find look like
val resourceSet = new ResourceSetImpl
val resource = resourceSet.getResource(URI.createURI(file), true)
but have no idea what the value of file must be to reference the ecore model.
any suggestion of how to translate the one EMF model to the other EMF model.
If I understand correctly, what you want to have is a model in your plug-in that's deployed in your end product. In that case you probably want to look at "platform:/plugin/..." URIs which you can probably use to retrieve artefacts from the running platform.
See URI.createURI(String) although you may want to look at URI.createPlatformPluginURI in your case
Search for Model-to-Model transformations, which you can specify with a variety of technologies (including Java, Xtend, ATL, etc.)

Modelio and Overture, does it work separately?

So.. I’m trying to work with both Modelio and Overture but both programs is really new to me.
I want to make a model in Modelio as a first, and then export it to Overture.
But is it supposed to work this way, or am I supposed to make it separately?
I suppose that you intend to use Modelio to create a Class Diagram with some classes and then export this diagram to EMF UML which can be imported in Overture. Overture will then create VDM classes matching the class defined in the class diagram.
To convert a UML class diagram model to a VDM++ model, you first need to export the UML
model from Modelio to the Eclipse XMI format, called UML using the EMF UML3.0.0 format.
At the moment, Modelio is the only UML tool supported. In particular, the exported UML models
have been tested using Modelio 3.3.1.
Exporting: Right-click a VDM++ or VDM-RT project to access a submenu for UML Transformation.
From here it is possible to Convert to UML. The resulting .uml file will be saved
to the generated folder of your project.
Importing: To perform a UML import you must have the .uml file in the relevant project folder.
You can either copy it manually or use the Eclipse Import - File System feature. Afterwards,
it is possible to right-click the .uml file and choose the submenu for UML Transformation
and then select Convert to VDM
See the Overture userguide for further information
I guess that you want to use both Modelio and Overture for vdmrt coding.
In this case the ideal way to work would be to make a model in Modelio and then export it as vdmrt classes and use them in Overture as Modelio works with Eclipse/Java. Unfortunatly Mdoelio doesn not provide any generation/reverse facilities for vdmrt...
But Modelio and Overture can work together for CPS modelling. This is INTO-CPS project aim. In this project, both Modelio and Overture provide FMI facilities which allow them to define CPS simulation. If you want more info please let me know.

XNA Automatic XNB Serialization: what can it do and what is it best used for?

I've seen some small examples posted by Shawn Hargreaves showing manually defining some xml content with the intent to create and populate instances of c# classes, which get loaded through the content pipeline.
I can see that this would be useful if you had an editor capable of writing the file, allowing you to load a level or whatever.
But, I'm curious... does it only do read operations? Can you use this concept to save game data?
What else might it be used for?
Automatic XNB Serialization (details) is simply the ability for the content pipeline to read/write data without needing a ContentTypeWriter or ContentTypeReader. It doesn't actually provide any new features, besides reducing the amount of code you have to write to use the content pipeline.
Loading from XML (using IntermediateSerializer or through the content pipeline using the XML importer) is a separate thing.
IntermediateSerializer automatically converts .NET object instances to/from XML using reflection.
The content pipeline (whether you are using automatic XNB serialization or not) converts .NET object instances to/from binary XNB files.
The content pipeline also provides an extensible importer/processor system, on the content-build side, for generating the .NET objects in the first place (and it includes various built-in importers/processors). The built-in XML importer just uses IntermediateSerializer to go from XML to a .NET object instance.
The reason why you can't use these in your game to perform write operation (eg: saving the game state, a built-in level editor, etc) is that IntermediateSerializer (both read and write) and the writing-XNB half of the content pipeline require XNA Game Studio to be installed.
XNA Game Studio is not a redistributable. (Only the XNA runtime is redistributable.)