Reading data stored in model objects and displaying the data [message #1071527] |
Sat, 20 July 2013 07:00  |
Eclipse User |
|
|
|
hello, I have a scenario. I created the ecore model and I have an class named Reports. This contains certain field like date, some strings.
Is there a possibility to read the contents of the Reports (Model Object)and display the contents (in the client environment)
Its like Reports-> Right click -> a menu is generated and a sub item is like (read this report). On click this should read the contents of the model object(Reading logic resides in some class).
I skimmed through the book and it suggests to create wizards and wizard pages for the UI.
P.S: I can export it as a xmi file and read through the data. but I want it to be done like this.
Any suggestions.
Thanks
[Updated on: Sat, 20 July 2013 07:08] by Moderator
|
|
|
|
|
|
|
Re: Reading data stored in model objects and displaying the data [message #1071556 is a reply to message #1071545] |
Sat, 20 July 2013 08:51  |
Eclipse User |
|
|
|
Bim,
Comments below.
On 20/07/2013 2:07 PM, bim boh wrote:
> Ed,
>
> <?xml version="1.0" encoding="ASCII"?>
> <ReportModel:ReportContainer xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI">
> <Reports xsi:type="SampleReportModel:Report" Date=10:01:2013,
> ReportName = SampleReport>
> </Reports>
> </ReportModel:ReportContainer>
>
>
> And is that what you want to display?
> > yes this is what I want to display.
So you load the model into a resource and use something like to write it
to a string representation:
StringWriter writer = new StringWriter();
OutputStream out = new
URIConverter.WriteableOutputStream(writer, "UTF-8");
resource.save(out, null);
System.err.println(writer.toString());
You can invoke Generate Test Code to generate an XyzExample.java in the
*.tests project showing how to load a resource in a stand alone
application. If you're running in the Eclipse IDE, you don't need any
of the registration code, just a resource set to load the resource. Or
if you already have the model loaded, you can use eObject.eResource() to
get at the resource and use the code I show above write the whole thing
to a string.
>
> There's a generated editor for the model that you can use to open a
> file and display its contents in an outline view and then see the
> properties in the properties view. Why don't you just use the editor?
>> yes I know this properties view, but actually I am using an extension
>> on EMF called EMFTrace. I do not get data in the properties view :(.
|
|
|
Powered by
FUDForum. Page generated in 0.31147 seconds