Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

  1. 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.

  2. 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.

  3. 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.

like image 618
javalympics Avatar asked Jun 02 '10 11:06

javalympics


People also ask

How do I run an XSD file in eclipse?

To create it, select New -> Examples... to launch the wizard. Follow the instructions described in the wizard, then click Finish to create the example project. Once created, under the PublicationCatalogue folder, locate the Catalogue. xsd file and double click the file to open it in the XML Schema Editor.


1 Answers

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.

like image 142
gamerson Avatar answered Oct 19 '22 17:10

gamerson