problems were detected while vaidating & converting Ecore models. The names are not well formed for model objects in diagram - eclipse

I tried to install the EMF plugin inside eclipse but some of the default Ecore diagram and EMF Generator Model projects were not available.
So downloaded a different eclipse installer for modelling i.e. Eclipse Modeling Tools (275 MB ) and found all the relevant model related & diagram based project now.
I have followed the same tutorial http://www.vogella.com/articles/EclipseEMF/article.html .
I was able to create the webpage model diagram & then the webpage.ecore file but then the webpage.genmodel the model generator file was giving errors like the ” names used in the diagrams for the objects are not well formed ” in webpage model diagram .
I googled for these errors which according to me mean that the names are not proper according to the given language for modeling constraints & no resolution to these errors were found.
then tried to ignore the errors and tried Generating the domain classes for java code, java code is generated but then the other following modules Create your model & Edit your model under Run your plugins category does not work further due to the previous errors on this link http://www.vogella.com/articles/EclipseEMF/article.html.
Please help me debug these errors

check if Name property is not null , you need to fill it
http://emftools.tuxfamily.org/wiki/doku.php?id=emfvb:quickstart

You need to set the name of Epackage and also prefix and URI
[1
[2

Related

How to create a custom annotation processor for Eclipse

I'm trying to create a custom annotation processor that generates code at compilation time (as hibernate-jpamodelgen does). I've looked in the web, and I find custom annotation processors that works with maven, but do nothing when added to the Annotation Processing > Factory Path option. How could I create a processor compatible in this way? I have not found a tutorial that works.
My idea is to, for example, annotate an entity to generate automatically a base DTO, a base mapper, etc that can be extended to use in the final code.
Thank you all
OK, Already found out the problem. The tutorial I hda found out dint't specified that, in order to the compiler to be able to apply the annotation processor, there must be a META-INF/services/javax.annotation.processing.Processor file that contains the qualified class name of the processor (or processors).
I created the file pointing to my processor class, generated the jar and added it to Annotation Processing > Factory Path and all worked correctly.
Just be careful to keep the order of the processors correctly (for example, hibernate model generator claims the classes, so no more generation will be made after it), and change the jar file name each time you want to replace the library (it seems eclipse keeps a cache). These two things have given me a good headache.
Thanks all

Generate code from Use Case Diagram creates lots of empty classes

In a Papyrus Model, I clicked the Use Case Diagram (which is quite simple - contains about 5 use-cases), and selected "Designer -> Generate Java Code".
In response, I got hundreds of new packages, each of which contains hundreds of empty classes, with strange names such as "Aaixixnrpr", "Aclywqwwlr", etc...
What is happening?!
Papyrus SW designer does not have a particular code generation support for "use case" elements, i.e. it will treat an Actor or a Use Case just as a UML class. This means that it will create an empty Java class, unless you add operations/opaque behaviors.
But the Java code generator should not create classes for elements that are not in the model. Can you please double check via the model explorer that elements such as "Aaixixnrpr" do not exist in the model?
Which version are you using? (I recommend to use version 1.0.5 from this update site on an Eclipse oxygen). Btw, I also recommend to use the Papyrus forum for questions like this.

Acceleo: The generation failed to generate any file

First of all , I am new to Acceleo and the modeling features of eclipse. What I am trying to do is just to create a simple test file. So for starters, I created a main module:
comment encoding = UTF-8 /]
[module generate('file:/C:/Users/maria/Documents/workspace/org.eclipse.acceleo.module.m2tTransformation/model/PSMMetamodel.ecore')]
[template public generateElement( aServicePSM : ServicePSM)]
[comment #main/]
[file ('test.java', false, 'UTF-8')]
Test
[/file]
[/template]
When i run this I get:
The generation failed to generate any file because there are no model elements that matches at least the type of the first parameter of one of your main templates.
The problem may be caused by a problem with the registration of your metamodel, please see the method named "registerPackages" in the Java launcher of your generator. It could also come from a missing [comment #main/] in the template used as the entry point of the generation.
Also the URI I use is the nsURI attribute value I set to the root of metamodel. I am sure that my input model does contain ServicePSM elements.
What am i doing wrong?
Thanks in advance.
This issue will arise in two cases
You do not have an element of the proper type in your model
The metamodel cannot be resolved
From your message I think we can safely ignore 1. since it seems you have at least one ServicePSM in your model, so we need to address 2.
If you look at your module, you've declared it to generate on metamodel file:/C:/Users/maria/Documents/workspace/org.eclipse.acceleo.module.m2tTransformation/model/PSMMetamodel.ecore. However, EMF rarely, if ever, uses this kind of URIs to refer to its metamodels. If you open your actual model with the text editor (right click > Open With > Text Editor), you can look at the URI that's actually been used to reference the metamodel with the "xmlns" tags at the start.
For example, if I open a model that references OCL elements, I can see xmlns:ocl.ecore="http://www.eclipse.org/ocl/1.1.0/Ecore". You have to make sure you use the same URI in your module file as what you see EMF using in the model file, in this case, it would be http://www.eclipse.org/ocl/1.1.0/Ecore.

GMF live constraints - validation

I have an emf model and i'd like to make a GMF editor to create instances of this metamodel.I'd like also some live constraints to avoid some connections between the components of my EMF model.e.g:My EMF consists of A,B,C,D components which derive from a General class called F and there is reference within F which connects F->F,as such this is able to provide me with connections in between the A,B,C,D components.
But when i am at the GMF editor i'd like a mechanism to avoid connection A->B and allow only connection A->C.
I read that this is able to be achieved with OCL language and link constraints that are able to be added at the gmfmap file.
But i couldn't find any tutorial with the vocabulary of OCL and examples doing that live validation
Any directions from someone?
After a deeper search I found a very useful and fast framework for validation. It is called Eugenia from the Epsilon group.
Eugenia lets you create all the appropriate files for the final GMF editor through a single file (extremely awesome,because otherwise you have to declare gfmtool, gmfgraph, etc by your own) and afterwards you can create a new EVL file which holds the constraints and the invariants of your model.The mapping is been doing easily by providing and extension point at your metamodel URI and all you have to do is to include your new plugin which containts the evl file at your final Eclipse configuration. http://www.eclipse.org/gmt/epsilon/doc/articles/evl-gmf-integration/
(Be careful, do not generate the diagram code as an RPC application because the RPC is not going to work. For any further information have a look here : http://giampow.blogspot.com/2010/06/eclipse-rcp-application-custom-problems.html )

Create and bind a GUI from xsd file automatically in eclipse rcp app

I want to create GUI components from XSD files. The generated GUIs should be used for concrete xml instances of the corresponding schema with databinding to "interesting" elements or attributes content.
I have considered these solutions:
jaxfront. (commercial tool). This does not generate source code. This is important for me because I want communication between the generated GUIs and other components of the GUI.
Use xsd2emf and try to generate an editor from that. The generated model is to complex, as well as the generated editor and it is buggy.
Do it myself e.g. generate an xml from the xsd, load xml as dom, select the interessting parts and generate data binding using one method described at http://www.vogella.de/eclipse.html.
Has anyone another idea or already successfully solved that problem? I would prefer a free open source solution which generates a SWT GUI.
Have you looked at the Sapphire framework at eclipse?
With it you have to create a model based on a few simple java interface files with some annotations that would model your XSD. Then once you have the model defined, you create the SWT GUI with a single xml file (sdef file) that wires various property editors to your model. The property editors can be simple widgets like label, text, lists, combo boxes but also it can be complex editors like a GEF-based diagram editor. So basically if you have a few interfaces that describe your model, then can have a graphical editor for editing nodes in that model with less than 100 lines of XML.
See lines 22 to 121 of this sample file.