|
Re: Example for serialization to plain text file [message #418048 is a reply to message #418047] |
Thu, 03 April 2008 18:15 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
Bernd,
ResourceImpl's doSave and doLoad methods throw exceptions. You'd
literally just have to override those two methods. You might look at
https://bugs.eclipse.org/bugs/show_bug.cgi?id=206267 as an example;
though it does the opposite, i.e., makes it as unreadable as possible
(short of encryption). The doSave method will be responsible for
walking your containment tree and converting it to text. The doLoad
method must do the inverse. The TMF project is starting up to support
Xtext, which lets you define a grammar for your model's serialization
and generates parsers, printers for it, and other cool stuff for it.
I'll bet that would be really useful for what you're trying to do.
Bernd Mühlböck wrote:
> Are there any (good) examples for customizing the serialization of the
> editor to produce plain text?
> All I know so far is that I have to override the save() and load()
> methods, but didn't quite get how to.
>
> The target is to make the syntax as simple as possible, e.g.:
> A->B
> B->C
> D->C
> ....
>
>
> Thanks,
> Bernd
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.02780 seconds