Thank you very much for sharing definitely interesting use-case.
>From DLTK standpoint changes propagation from graphical editor back to
the source should be done via the mechanism similar to JDT's AST
Rewrite. AST Rewrite allows you to change AST nodes (corresponding to
your graphical element(s)) and changes to AST transforms source code
accordingly. This would allow you fine-grained modifications of the
sources.
Unfortunately DLTK do not support AST Rewrite yet, moreover
you'd need some support for this mechanism from your language-specific
plugin since DLTK is language-independent framework. AFAIK PDT guys
have some work done in this area so you may try to look at PDT sources.
Anyway, AST rewrite implementation is a challenging task, so for
now the only way we can suggest is to regenerate source code completely
using your graphical information. Of course this solution is far from
good, since a) you'd need to keep all the information within graphical
parts (including comments) b) you'd loose source code formatting,
etc... But I hope such approach may work for you as a proof of two-way
editing concept.
Please let me know if you need more information/thoughts.
----- Original Message -----
From: "Raman Grover"
<ramang@xxxxxxx>
To: "Andrey Platov"
<andrey@xxxxxxxxx>
Cc: "Michael Carey"
<mjcarey@xxxxxxxxxxx>,
gabipetrovay@xxxxxxxxx, "aatish mandelecha"
<aatish.mandelecha@xxxxxxxxx>
Sent: Tuesday, April 28, 2009 1:42:41 AM GMT +06:00 Almaty, Novosibirsk
Subject: Re: DLTK Editor Interaction
Hi ,
Please find attached a document that elaborates the use case (discussed
previously in the thread).
Please suggest as to how the DLTK-team feels about the use case and what
can be a way ahead ?
> Raman, could you please elaborate on your language nature, and
which
> technologies you're using to build graphical editor for the
project?
Answers:
The Editor described is primarily for XQuery.For the Graphical Editor,
GEF
would be be used. The work is part of Open II project, headed by
Professor
Michael Carey at UCI.
Regards,
Raman
On Tue, April 21, 2009 11:26 am, Andrey Platov wrote:
> Hi Folks,
>
> I guess such a use-case would be interested to DLTK, however I'd
also
> like to point Raman to Xtext project. Also Webtools' Structured
Text
> Editor + GMF-based editor could be a great solution for XML-based
> languages.
>
> Raman, could you please elaborate on your language nature, and
which
> technologies you're using to build graphical editor for the
project?
>
> Thank you very much, and
> Kind Regards,
> Andrey
>
>
>
> On Apr 20, 2009, at 2:46 PM, Raman Grover wrote:
>
>> Hi
>>
>> I am Raman Grover, a graduate student at the University of
California,
>> Irvine. I have a small question in relation to Eclipse DLTK.
Please
>> help
>> me in answering this.
>>
>> Consider a case where one needs to have a graphical editor and
a text
>> editor for a language. The text editor is implemented using
DLTK. The
>> graphical editor must generate source code which is editable
from
>> the text
>> editor and vice versa.
>>
>> Since DLTK monitors the text editor, it calls the parse method
>> (implemented by the editor developer) to check for syntax
errors. The
>> graphical editor needs to communicate with the text editor and
feed it
>> with the generated source code. The text editor gets notified
>> whenever the
>> source code changes as the parse( ) method is called. However,
the
>> source
>> code can also change when graphical editor changes the source
code and
>> hence DLTK must be informed so that it can update its internal
data
>> structures holding information about the source file contents.
>>
>>
>> Please suggest !
>>
>> Thank You !
>>
>> Raman Grover
>> I love Eclipse !
>>
>>
>> ModuleDecleration parse(char[] filename[], char [] source,
IReporter
>> reporter) so
>> that DLTK framework gets to call the parse method, whenever
the source
>> code in the
>> editor changes.
>> I need to build a graphical editor which generates source code
and
>> feeds
>> into the
>> DLTK framework instead of user typing the source code by hand.
>>
>>
>>
>
>