Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc) » EMF Model Synchrinization with Multipage Editor (Tree based Editor and Text Editor)
|
Re: EMF Model Synchrinization with Multipage Editor (Tree based Editor and Text Editor) [message #55188 is a reply to message #55158] |
Sat, 30 September 2006 13:50 |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
Kamesh,
Probably the best you will get is pointers to existing source code (Eric
Gamma's monkey-see-monkey-do principle) and it will typically be quite
complex. The XSDEditor is a relatively simple (i.e., crude) example.
It will reparse the text whenever the text changes. It uses an
IDocumentListener with a delay to avoid responding to every key stroke.
For the reverse, the command stack listener calls
handleStructuredModelChange whenever a command has been executed, which
serializes the resource in memory and updates the text in the text
editor. This is quite a brute force approach, but should serve as a
starting point.
Kamesh Sampath wrote:
> Folks,
>
> Am really trying hard to save a model by editing a raw text and there
> by updating the MODEL . All my attempts are in vain .
>
> My Scenario:
>
> The editing domain and model is same for both the editors i mean to
> say am sharing the same common EMF model.
>
> I have an Multipage editor with two pages 1. TreeViewer to edit the
> model 2. TextEditor to view the model source
>
>
> I am able to view the changes made to the TreeViewer in the TextEditor
>
> but am struck up with the reverse scenario i.e when i make any textual
> changes to the model in form text in TextEditor i should synchronize
> that with the underlying model file , I am using the XML editor
> created out of eclipse platform samples.
>
> My issues are ,
>
> 1. How to track the textual changes in the Text Editor?
> 2. How to fire the model commands based on the Textual Changes?
>
>
> I dont know how to do this ? can anyone help me please . I dont mind
> even the model file gets corrupted as am not enforcing any validations
> now , all that i want is to make both work in sync changes to Model
> reflected in Source and Changes to source should be reflected in model.
>
>
> I am trying to do exactly like the PDE editor. I even saw the PDE
> editor source but its really long and very confusing to me.
>
> Any pointers will be really helpful.
>
> Thanks.
|
|
|
Re: EMF Model Synchrinization with Multipage Editor (Tree based Editor and Text Editor) [message #55214 is a reply to message #55188] |
Sat, 30 September 2006 15:35 |
Kamesh Sampath Messages: 191 Registered: July 2009 |
Senior Member |
|
|
Ed,
Thats right ! thats y i sought to see the PDE Editor , but for my
requirement its quite complex hence i asked for somthing much simpler.
Will try the XSD editor.
Thanks .
Kamesh
Ed Merks wrote:
> Kamesh,
>
> Probably the best you will get is pointers to existing source code
> (Eric Gamma's monkey-see-monkey-do principle) and it will typically be
> quite complex. The XSDEditor is a relatively simple (i.e., crude)
> example. It will reparse the text whenever the text changes. It uses
> an IDocumentListener with a delay to avoid responding to every key
> stroke. For the reverse, the command stack listener calls
> handleStructuredModelChange whenever a command has been executed,
> which serializes the resource in memory and updates the text in the
> text editor. This is quite a brute force approach, but should serve
> as a starting point.
>
>
> Kamesh Sampath wrote:
>> Folks,
>>
>> Am really trying hard to save a model by editing a raw text and there
>> by updating the MODEL . All my attempts are in vain .
>>
>> My Scenario:
>>
>> The editing domain and model is same for both the editors i mean to
>> say am sharing the same common EMF model.
>>
>> I have an Multipage editor with two pages 1. TreeViewer to edit the
>> model 2. TextEditor to view the model source
>>
>>
>> I am able to view the changes made to the TreeViewer in the TextEditor
>>
>> but am struck up with the reverse scenario i.e when i make any
>> textual changes to the model in form text in TextEditor i should
>> synchronize that with the underlying model file , I am using the XML
>> editor created out of eclipse platform samples.
>>
>> My issues are ,
>>
>> 1. How to track the textual changes in the Text Editor?
>> 2. How to fire the model commands based on the Textual Changes?
>>
>>
>> I dont know how to do this ? can anyone help me please . I dont mind
>> even the model file gets corrupted as am not enforcing any
>> validations now , all that i want is to make both work in sync
>> changes to Model reflected in Source and Changes to source should be
>> reflected in model.
>>
>>
>> I am trying to do exactly like the PDE editor. I even saw the PDE
>> editor source but its really long and very confusing to me.
>>
>> Any pointers will be really helpful.
>>
>> Thanks.
--
Kamesh Sampath
|
|
|
Re: EMF Model Synchrinization with Multipage Editor (Tree based Editor and Text Editor) [message #55269 is a reply to message #55214] |
Sat, 30 September 2006 17:21 |
Eclipse User |
|
|
|
Originally posted by: stepper.sympedia.de
Kamesh Sampath schrieb:
> Ed,
> Thats right ! thats y i sought to see the PDE Editor , but for my
> requirement its quite complex hence i asked for somthing much
> simpler. Will try the XSD editor.
Doesn't WTP have an XML editor? I don't use it but I'd expect that they
have text/model sync...
Cheers
/Eike
>
> Thanks .
>
> Kamesh
>
> Ed Merks wrote:
>> Kamesh,
>>
>> Probably the best you will get is pointers to existing source code
>> (Eric Gamma's monkey-see-monkey-do principle) and it will typically
>> be quite complex. The XSDEditor is a relatively simple (i.e., crude)
>> example. It will reparse the text whenever the text changes. It
>> uses an IDocumentListener with a delay to avoid responding to every
>> key stroke. For the reverse, the command stack listener calls
>> handleStructuredModelChange whenever a command has been executed,
>> which serializes the resource in memory and updates the text in the
>> text editor. This is quite a brute force approach, but should serve
>> as a starting point.
>>
>>
>> Kamesh Sampath wrote:
>>> Folks,
>>>
>>> Am really trying hard to save a model by editing a raw text and
>>> there by updating the MODEL . All my attempts are in vain .
>>>
>>> My Scenario:
>>>
>>> The editing domain and model is same for both the editors i mean to
>>> say am sharing the same common EMF model.
>>>
>>> I have an Multipage editor with two pages 1. TreeViewer to edit the
>>> model 2. TextEditor to view the model source
>>>
>>>
>>> I am able to view the changes made to the TreeViewer in the TextEditor
>>>
>>> but am struck up with the reverse scenario i.e when i make any
>>> textual changes to the model in form text in TextEditor i should
>>> synchronize that with the underlying model file , I am using the XML
>>> editor created out of eclipse platform samples.
>>>
>>> My issues are ,
>>>
>>> 1. How to track the textual changes in the Text Editor?
>>> 2. How to fire the model commands based on the Textual Changes?
>>>
>>>
>>> I dont know how to do this ? can anyone help me please . I dont mind
>>> even the model file gets corrupted as am not enforcing any
>>> validations now , all that i want is to make both work in sync
>>> changes to Model reflected in Source and Changes to source should be
>>> reflected in model.
>>>
>>>
>>> I am trying to do exactly like the PDE editor. I even saw the PDE
>>> editor source but its really long and very confusing to me.
>>>
>>> Any pointers will be really helpful.
>>>
>>> Thanks.
>
>
|
|
|
Re: EMF Model Synchrinization with Multipage Editor (Tree based Editor and Text Editor) [message #55296 is a reply to message #55269] |
Sat, 30 September 2006 17:37 |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
Eike,
Yes, WTP has a very cool SED DOM that incrementally synchronizes a DOM
structure with the textual source view of it. This in combination with
something that incrementally synchronizes an EMF model with that DOM
would be an extremely cool combination. A generated EMF editor with a
source view would be possible...
Eike Stepper wrote:
>
>
> Kamesh Sampath schrieb:
>> Ed,
>> Thats right ! thats y i sought to see the PDE Editor , but for my
>> requirement its quite complex hence i asked for somthing much
>> simpler. Will try the XSD editor.
> Doesn't WTP have an XML editor? I don't use it but I'd expect that
> they have text/model sync...
>
> Cheers
> /Eike
>
>>
>> Thanks .
>>
>> Kamesh
>>
>> Ed Merks wrote:
>>> Kamesh,
>>>
>>> Probably the best you will get is pointers to existing source code
>>> (Eric Gamma's monkey-see-monkey-do principle) and it will typically
>>> be quite complex. The XSDEditor is a relatively simple (i.e.,
>>> crude) example. It will reparse the text whenever the text
>>> changes. It uses an IDocumentListener with a delay to avoid
>>> responding to every key stroke. For the reverse, the command stack
>>> listener calls handleStructuredModelChange whenever a command has
>>> been executed, which serializes the resource in memory and updates
>>> the text in the text editor. This is quite a brute force approach,
>>> but should serve as a starting point.
>>>
>>>
>>> Kamesh Sampath wrote:
>>>> Folks,
>>>>
>>>> Am really trying hard to save a model by editing a raw text and
>>>> there by updating the MODEL . All my attempts are in vain .
>>>>
>>>> My Scenario:
>>>>
>>>> The editing domain and model is same for both the editors i mean to
>>>> say am sharing the same common EMF model.
>>>>
>>>> I have an Multipage editor with two pages 1. TreeViewer to edit the
>>>> model 2. TextEditor to view the model source
>>>>
>>>>
>>>> I am able to view the changes made to the TreeViewer in the TextEditor
>>>>
>>>> but am struck up with the reverse scenario i.e when i make any
>>>> textual changes to the model in form text in TextEditor i should
>>>> synchronize that with the underlying model file , I am using the
>>>> XML editor created out of eclipse platform samples.
>>>>
>>>> My issues are ,
>>>>
>>>> 1. How to track the textual changes in the Text Editor?
>>>> 2. How to fire the model commands based on the Textual Changes?
>>>>
>>>>
>>>> I dont know how to do this ? can anyone help me please . I dont
>>>> mind even the model file gets corrupted as am not enforcing any
>>>> validations now , all that i want is to make both work in sync
>>>> changes to Model reflected in Source and Changes to source should
>>>> be reflected in model.
>>>>
>>>>
>>>> I am trying to do exactly like the PDE editor. I even saw the PDE
>>>> editor source but its really long and very confusing to me.
>>>>
>>>> Any pointers will be really helpful.
>>>>
>>>> Thanks.
>>
>>
|
|
|
Re: EMF Model Synchrinization with Multipage Editor (Tree based Editor and Text Editor) [message #55323 is a reply to message #55296] |
Sat, 30 September 2006 17:57 |
Eclipse User |
|
|
|
Originally posted by: stepper.sympedia.de
Ed Merks schrieb:
> Eike,
>
> Yes, WTP has a very cool SED DOM that incrementally synchronizes a DOM
> structure with the textual source view of it. This in combination
> with something that incrementally synchronizes an EMF model with that
> DOM would be an extremely cool combination. A generated EMF editor
> with a source view would be possible...
Indeed. But personally I'd prefer to see
https://bugs.eclipse.org/bugs/show_bug.cgi?id=108470 addressed before ;-)
Cheers
/Eike
>
>
> Eike Stepper wrote:
>>
>>
>> Kamesh Sampath schrieb:
>>> Ed,
>>> Thats right ! thats y i sought to see the PDE Editor , but for my
>>> requirement its quite complex hence i asked for somthing much
>>> simpler. Will try the XSD editor.
>> Doesn't WTP have an XML editor? I don't use it but I'd expect that
>> they have text/model sync...
>>
>> Cheers
>> /Eike
>>
>>>
>>> Thanks .
>>>
>>> Kamesh
>>>
>>> Ed Merks wrote:
>>>> Kamesh,
>>>>
>>>> Probably the best you will get is pointers to existing source code
>>>> (Eric Gamma's monkey-see-monkey-do principle) and it will typically
>>>> be quite complex. The XSDEditor is a relatively simple (i.e.,
>>>> crude) example. It will reparse the text whenever the text
>>>> changes. It uses an IDocumentListener with a delay to avoid
>>>> responding to every key stroke. For the reverse, the command stack
>>>> listener calls handleStructuredModelChange whenever a command has
>>>> been executed, which serializes the resource in memory and updates
>>>> the text in the text editor. This is quite a brute force approach,
>>>> but should serve as a starting point.
>>>>
>>>>
>>>> Kamesh Sampath wrote:
>>>>> Folks,
>>>>>
>>>>> Am really trying hard to save a model by editing a raw text and
>>>>> there by updating the MODEL . All my attempts are in vain .
>>>>>
>>>>> My Scenario:
>>>>>
>>>>> The editing domain and model is same for both the editors i mean
>>>>> to say am sharing the same common EMF model.
>>>>>
>>>>> I have an Multipage editor with two pages 1. TreeViewer to edit
>>>>> the model 2. TextEditor to view the model source
>>>>>
>>>>>
>>>>> I am able to view the changes made to the TreeViewer in the
>>>>> TextEditor
>>>>>
>>>>> but am struck up with the reverse scenario i.e when i make any
>>>>> textual changes to the model in form text in TextEditor i should
>>>>> synchronize that with the underlying model file , I am using the
>>>>> XML editor created out of eclipse platform samples.
>>>>>
>>>>> My issues are ,
>>>>>
>>>>> 1. How to track the textual changes in the Text Editor?
>>>>> 2. How to fire the model commands based on the Textual Changes?
>>>>>
>>>>>
>>>>> I dont know how to do this ? can anyone help me please . I dont
>>>>> mind even the model file gets corrupted as am not enforcing any
>>>>> validations now , all that i want is to make both work in sync
>>>>> changes to Model reflected in Source and Changes to source should
>>>>> be reflected in model.
>>>>>
>>>>>
>>>>> I am trying to do exactly like the PDE editor. I even saw the PDE
>>>>> editor source but its really long and very confusing to me.
>>>>>
>>>>> Any pointers will be really helpful.
>>>>>
>>>>> Thanks.
>>>
>>>
|
|
|
Re: EMF Model Synchrinization with Multipage Editor (Tree based Editor and Text Editor) [message #55350 is a reply to message #55269] |
Sat, 30 September 2006 18:05 |
Kamesh Sampath Messages: 191 Registered: July 2009 |
Senior Member |
|
|
Ed and Eike,
Thanks for further Information . Actually i thoght of looking in to that
.. Let me do it . If am successfull i shall contribue a patch to EMF
editor generation to have an Text editor that will edit the source .
Thanks for the info .
Kamesh
Eike Stepper wrote:
>
>
> Kamesh Sampath schrieb:
>> Ed,
>> Thats right ! thats y i sought to see the PDE Editor , but for my
>> requirement its quite complex hence i asked for somthing much
>> simpler. Will try the XSD editor.
> Doesn't WTP have an XML editor? I don't use it but I'd expect that
> they have text/model sync...
>
> Cheers
> /Eike
>
>>
>> Thanks .
>>
>> Kamesh
>>
>> Ed Merks wrote:
>>> Kamesh,
>>>
>>> Probably the best you will get is pointers to existing source code
>>> (Eric Gamma's monkey-see-monkey-do principle) and it will typically
>>> be quite complex. The XSDEditor is a relatively simple (i.e.,
>>> crude) example. It will reparse the text whenever the text
>>> changes. It uses an IDocumentListener with a delay to avoid
>>> responding to every key stroke. For the reverse, the command stack
>>> listener calls handleStructuredModelChange whenever a command has
>>> been executed, which serializes the resource in memory and updates
>>> the text in the text editor. This is quite a brute force approach,
>>> but should serve as a starting point.
>>>
>>>
>>> Kamesh Sampath wrote:
>>>> Folks,
>>>>
>>>> Am really trying hard to save a model by editing a raw text and
>>>> there by updating the MODEL . All my attempts are in vain .
>>>>
>>>> My Scenario:
>>>>
>>>> The editing domain and model is same for both the editors i mean to
>>>> say am sharing the same common EMF model.
>>>>
>>>> I have an Multipage editor with two pages 1. TreeViewer to edit the
>>>> model 2. TextEditor to view the model source
>>>>
>>>>
>>>> I am able to view the changes made to the TreeViewer in the TextEditor
>>>>
>>>> but am struck up with the reverse scenario i.e when i make any
>>>> textual changes to the model in form text in TextEditor i should
>>>> synchronize that with the underlying model file , I am using the
>>>> XML editor created out of eclipse platform samples.
>>>>
>>>> My issues are ,
>>>>
>>>> 1. How to track the textual changes in the Text Editor?
>>>> 2. How to fire the model commands based on the Textual Changes?
>>>>
>>>>
>>>> I dont know how to do this ? can anyone help me please . I dont
>>>> mind even the model file gets corrupted as am not enforcing any
>>>> validations now , all that i want is to make both work in sync
>>>> changes to Model reflected in Source and Changes to source should
>>>> be reflected in model.
>>>>
>>>>
>>>> I am trying to do exactly like the PDE editor. I even saw the PDE
>>>> editor source but its really long and very confusing to me.
>>>>
>>>> Any pointers will be really helpful.
>>>>
>>>> Thanks.
>>
>>
--
Kamesh Sampath
|
|
|
Re: EMF Model Synchrinization with Multipage Editor (Tree based Editor and Text Editor) [message #55378 is a reply to message #55350] |
Sat, 30 September 2006 18:57 |
Kamesh Sampath Messages: 191 Registered: July 2009 |
Senior Member |
|
|
Ed and Eike,
The WTP SED is cool one . We have something called the
StrucutredTextEditor , we can use that i guess. I am just looking in to
that option , once am successful i shall post the message.
Thanks.
Kamesh
Kamesh Sampath wrote:
> Ed and Eike,
>
> Thanks for further Information . Actually i thoght of looking in to
> that .. Let me do it . If am successfull i shall contribue a patch to
> EMF editor generation to have an Text editor that will edit the source .
>
> Thanks for the info .
>
> Kamesh
>
> Eike Stepper wrote:
>>
>>
>> Kamesh Sampath schrieb:
>>> Ed,
>>> Thats right ! thats y i sought to see the PDE Editor , but for my
>>> requirement its quite complex hence i asked for somthing much
>>> simpler. Will try the XSD editor.
>> Doesn't WTP have an XML editor? I don't use it but I'd expect that
>> they have text/model sync...
>>
>> Cheers
>> /Eike
>>
>>>
>>> Thanks .
>>>
>>> Kamesh
>>>
>>> Ed Merks wrote:
>>>> Kamesh,
>>>>
>>>> Probably the best you will get is pointers to existing source code
>>>> (Eric Gamma's monkey-see-monkey-do principle) and it will typically
>>>> be quite complex. The XSDEditor is a relatively simple (i.e.,
>>>> crude) example. It will reparse the text whenever the text
>>>> changes. It uses an IDocumentListener with a delay to avoid
>>>> responding to every key stroke. For the reverse, the command stack
>>>> listener calls handleStructuredModelChange whenever a command has
>>>> been executed, which serializes the resource in memory and updates
>>>> the text in the text editor. This is quite a brute force approach,
>>>> but should serve as a starting point.
>>>>
>>>>
>>>> Kamesh Sampath wrote:
>>>>> Folks,
>>>>>
>>>>> Am really trying hard to save a model by editing a raw text and
>>>>> there by updating the MODEL . All my attempts are in vain .
>>>>>
>>>>> My Scenario:
>>>>>
>>>>> The editing domain and model is same for both the editors i mean
>>>>> to say am sharing the same common EMF model.
>>>>>
>>>>> I have an Multipage editor with two pages 1. TreeViewer to edit
>>>>> the model 2. TextEditor to view the model source
>>>>>
>>>>>
>>>>> I am able to view the changes made to the TreeViewer in the
>>>>> TextEditor
>>>>>
>>>>> but am struck up with the reverse scenario i.e when i make any
>>>>> textual changes to the model in form text in TextEditor i should
>>>>> synchronize that with the underlying model file , I am using the
>>>>> XML editor created out of eclipse platform samples.
>>>>>
>>>>> My issues are ,
>>>>>
>>>>> 1. How to track the textual changes in the Text Editor?
>>>>> 2. How to fire the model commands based on the Textual Changes?
>>>>>
>>>>>
>>>>> I dont know how to do this ? can anyone help me please . I dont
>>>>> mind even the model file gets corrupted as am not enforcing any
>>>>> validations now , all that i want is to make both work in sync
>>>>> changes to Model reflected in Source and Changes to source should
>>>>> be reflected in model.
>>>>>
>>>>>
>>>>> I am trying to do exactly like the PDE editor. I even saw the PDE
>>>>> editor source but its really long and very confusing to me.
>>>>>
>>>>> Any pointers will be really helpful.
>>>>>
>>>>> Thanks.
>>>
>>>
>
>
--
Kamesh Sampath
|
|
|
Re: EMF Model Synchrinization with Multipage Editor (Tree based Editor and Text Editor) [message #55405 is a reply to message #55378] |
Sat, 30 September 2006 20:01 |
Kamesh Sampath Messages: 191 Registered: July 2009 |
Senior Member |
|
|
Ed and Eike,
I am able to successully integrate the WTP SED with my Editor . Lots of
redundant stuff has been removed from the common TextEditor that we
develop. But am facing a peculiar problem with the same , whenever we
want to fire the PROP_DIRTY with StructuredTextEditor(WTP Text Editor)
we need to implement the Property Change listener and register the same
with WTP SED , when i do a == comparison between the source and my
initialised text editor inside my propertyChanged(Object source, int
propId) is failing , though when i print the same in the console its
same object name
/*
* (non-Javadoc)
*
* @see
org.eclipse.ui.IPropertyListener#propertyChanged(java.lang.O bject,
* int)
*/
public void propertyChanged(Object source, int propId) {
System.out.println("Source : " + source + " propID :" + propId
+ "PROP_Dirty=" + IEditorPart.PROP_DIRTY);
System.out.println("Source Editor :" + sourceEditor);
switch (propId) {
case IEditorPart.PROP_DIRTY:
case IEditorPart.PROP_INPUT: {
if (source == sourceEditor) {
if (sourceEditor.getEditorInput() != getEditorInput()) {
System.out.println("2.1");
setInput(sourceEditor.getEditorInput());
Runnable runnable = new Runnable() {
public void run() {
firePropertyChange(IEditorPart.PROP_DIRTY);
}
};
postOnDisplayQue(runnable);
}
}
break;
}
}
}
Can you help me why its failing ??
Kamesh
Kamesh Sampath wrote:
> Ed and Eike,
>
> The WTP SED is cool one . We have something called the
> StrucutredTextEditor , we can use that i guess. I am just looking in
> to that option , once am successful i shall post the message.
>
> Thanks.
>
> Kamesh
>
> Kamesh Sampath wrote:
>> Ed and Eike,
>>
>> Thanks for further Information . Actually i thoght of looking in to
>> that .. Let me do it . If am successfull i shall contribue a patch to
>> EMF editor generation to have an Text editor that will edit the source .
>>
>> Thanks for the info .
>>
>> Kamesh
>>
>> Eike Stepper wrote:
>>>
>>>
>>> Kamesh Sampath schrieb:
>>>> Ed,
>>>> Thats right ! thats y i sought to see the PDE Editor , but for my
>>>> requirement its quite complex hence i asked for somthing much
>>>> simpler. Will try the XSD editor.
>>> Doesn't WTP have an XML editor? I don't use it but I'd expect that
>>> they have text/model sync...
>>>
>>> Cheers
>>> /Eike
>>>
>>>>
>>>> Thanks .
>>>>
>>>> Kamesh
>>>>
>>>> Ed Merks wrote:
>>>>> Kamesh,
>>>>>
>>>>> Probably the best you will get is pointers to existing source code
>>>>> (Eric Gamma's monkey-see-monkey-do principle) and it will
>>>>> typically be quite complex. The XSDEditor is a relatively simple
>>>>> (i.e., crude) example. It will reparse the text whenever the text
>>>>> changes. It uses an IDocumentListener with a delay to avoid
>>>>> responding to every key stroke. For the reverse, the command
>>>>> stack listener calls handleStructuredModelChange whenever a
>>>>> command has been executed, which serializes the resource in memory
>>>>> and updates the text in the text editor. This is quite a brute
>>>>> force approach, but should serve as a starting point.
>>>>>
>>>>>
>>>>> Kamesh Sampath wrote:
>>>>>> Folks,
>>>>>>
>>>>>> Am really trying hard to save a model by editing a raw text and
>>>>>> there by updating the MODEL . All my attempts are in vain .
>>>>>>
>>>>>> My Scenario:
>>>>>>
>>>>>> The editing domain and model is same for both the editors i mean
>>>>>> to say am sharing the same common EMF model.
>>>>>>
>>>>>> I have an Multipage editor with two pages 1. TreeViewer to edit
>>>>>> the model 2. TextEditor to view the model source
>>>>>>
>>>>>>
>>>>>> I am able to view the changes made to the TreeViewer in the
>>>>>> TextEditor
>>>>>>
>>>>>> but am struck up with the reverse scenario i.e when i make any
>>>>>> textual changes to the model in form text in TextEditor i should
>>>>>> synchronize that with the underlying model file , I am using the
>>>>>> XML editor created out of eclipse platform samples.
>>>>>>
>>>>>> My issues are ,
>>>>>>
>>>>>> 1. How to track the textual changes in the Text Editor?
>>>>>> 2. How to fire the model commands based on the Textual Changes?
>>>>>>
>>>>>>
>>>>>> I dont know how to do this ? can anyone help me please . I dont
>>>>>> mind even the model file gets corrupted as am not enforcing any
>>>>>> validations now , all that i want is to make both work in sync
>>>>>> changes to Model reflected in Source and Changes to source should
>>>>>> be reflected in model.
>>>>>>
>>>>>>
>>>>>> I am trying to do exactly like the PDE editor. I even saw the PDE
>>>>>> editor source but its really long and very confusing to me.
>>>>>>
>>>>>> Any pointers will be really helpful.
>>>>>>
>>>>>> Thanks.
>>>>
>>>>
>>
>>
>
>
--
Kamesh Sampath
|
|
|
Re: EMF Model Synchrinization with Multipage Editor (Tree based Editor and Text Editor) [message #55433 is a reply to message #55405] |
Sat, 30 September 2006 21:12 |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
Kamesh,
Should use be using .equals verses ==?
Kamesh Sampath wrote:
> Ed and Eike,
>
> I am able to successully integrate the WTP SED with my Editor . Lots of
> redundant stuff has been removed from the common TextEditor that we
> develop. But am facing a peculiar problem with the same , whenever we
> want to fire the PROP_DIRTY with StructuredTextEditor(WTP Text Editor)
> we need to implement the Property Change listener and register the same
> with WTP SED , when i do a == comparison between the source and my
> initialised text editor inside my propertyChanged(Object source, int
> propId) is failing , though when i print the same in the console its
> same object name
>
> /*
> * (non-Javadoc)
> *
> * @see
> org.eclipse.ui.IPropertyListener#propertyChanged(java.lang.O bject,
> * int)
> */
> public void propertyChanged(Object source, int propId) {
> System.out.println("Source : " + source + " propID :" + propId
> + "PROP_Dirty=" + IEditorPart.PROP_DIRTY);
> System.out.println("Source Editor :" + sourceEditor);
> switch (propId) {
> case IEditorPart.PROP_DIRTY:
> case IEditorPart.PROP_INPUT: {
> if (source == sourceEditor) {
> if (sourceEditor.getEditorInput() !=
> getEditorInput()) {
> System.out.println("2.1");
> setInput(sourceEditor.getEditorInput());
> Runnable runnable = new Runnable() {
> public void run() {
>
> firePropertyChange(IEditorPart.PROP_DIRTY);
> }
> };
> postOnDisplayQue(runnable);
>
> }
> }
> break;
> }
> }
> }
>
> Can you help me why its failing ??
>
> Kamesh
>
>
>
> Kamesh Sampath wrote:
>> Ed and Eike,
>>
>> The WTP SED is cool one . We have something called the
>> StrucutredTextEditor , we can use that i guess. I am just looking in
>> to that option , once am successful i shall post the message.
>>
>> Thanks.
>>
>> Kamesh
>>
>> Kamesh Sampath wrote:
>>> Ed and Eike,
>>>
>>> Thanks for further Information . Actually i thoght of looking in to
>>> that .. Let me do it . If am successfull i shall contribue a patch
>>> to EMF editor generation to have an Text editor that will edit the
>>> source .
>>>
>>> Thanks for the info .
>>>
>>> Kamesh
>>>
>>> Eike Stepper wrote:
>>>>
>>>>
>>>> Kamesh Sampath schrieb:
>>>>> Ed,
>>>>> Thats right ! thats y i sought to see the PDE Editor , but for my
>>>>> requirement its quite complex hence i asked for somthing much
>>>>> simpler. Will try the XSD editor.
>>>> Doesn't WTP have an XML editor? I don't use it but I'd expect that
>>>> they have text/model sync...
>>>>
>>>> Cheers
>>>> /Eike
>>>>
>>>>>
>>>>> Thanks .
>>>>>
>>>>> Kamesh
>>>>>
>>>>> Ed Merks wrote:
>>>>>> Kamesh,
>>>>>>
>>>>>> Probably the best you will get is pointers to existing source
>>>>>> code (Eric Gamma's monkey-see-monkey-do principle) and it will
>>>>>> typically be quite complex. The XSDEditor is a relatively simple
>>>>>> (i.e., crude) example. It will reparse the text whenever the
>>>>>> text changes. It uses an IDocumentListener with a delay to avoid
>>>>>> responding to every key stroke. For the reverse, the command
>>>>>> stack listener calls handleStructuredModelChange whenever a
>>>>>> command has been executed, which serializes the resource in
>>>>>> memory and updates the text in the text editor. This is quite a
>>>>>> brute force approach, but should serve as a starting point.
>>>>>>
>>>>>>
>>>>>> Kamesh Sampath wrote:
>>>>>>> Folks,
>>>>>>>
>>>>>>> Am really trying hard to save a model by editing a raw text and
>>>>>>> there by updating the MODEL . All my attempts are in vain .
>>>>>>>
>>>>>>> My Scenario:
>>>>>>>
>>>>>>> The editing domain and model is same for both the editors i mean
>>>>>>> to say am sharing the same common EMF model.
>>>>>>>
>>>>>>> I have an Multipage editor with two pages 1. TreeViewer to edit
>>>>>>> the model 2. TextEditor to view the model source
>>>>>>>
>>>>>>>
>>>>>>> I am able to view the changes made to the TreeViewer in the
>>>>>>> TextEditor
>>>>>>>
>>>>>>> but am struck up with the reverse scenario i.e when i make any
>>>>>>> textual changes to the model in form text in TextEditor i should
>>>>>>> synchronize that with the underlying model file , I am using the
>>>>>>> XML editor created out of eclipse platform samples.
>>>>>>>
>>>>>>> My issues are ,
>>>>>>>
>>>>>>> 1. How to track the textual changes in the Text Editor?
>>>>>>> 2. How to fire the model commands based on the Textual Changes?
>>>>>>>
>>>>>>>
>>>>>>> I dont know how to do this ? can anyone help me please . I dont
>>>>>>> mind even the model file gets corrupted as am not enforcing any
>>>>>>> validations now , all that i want is to make both work in sync
>>>>>>> changes to Model reflected in Source and Changes to source
>>>>>>> should be reflected in model.
>>>>>>>
>>>>>>>
>>>>>>> I am trying to do exactly like the PDE editor. I even saw the
>>>>>>> PDE editor source but its really long and very confusing to me.
>>>>>>>
>>>>>>> Any pointers will be really helpful.
>>>>>>>
>>>>>>> Thanks.
>>>>>
>>>>>
>>>
>>>
>>
>>
>
>
|
|
|
Re: EMF Model Synchrinization with Multipage Editor (Tree based Editor and Text Editor) [message #102857 is a reply to message #55405] |
Thu, 15 November 2007 23:19 |
Eclipse User |
|
|
|
Originally posted by: vasanthv16.yahoo.com
Kamesh, Ed,
I know it has been over a year since the last post on this topic, but,
any updates on this? As of now, the generated EMF multipage editor still
lacks a source editor.
Thanks,
Vasanth
Kamesh Sampath wrote:
> Ed and Eike,
>
> I am able to successully integrate the WTP SED with my Editor . Lots of
> redundant stuff has been removed from the common TextEditor that we
> develop. But am facing a peculiar problem with the same , whenever we
> want to fire the PROP_DIRTY with StructuredTextEditor(WTP Text Editor)
> we need to implement the Property Change listener and register the same
> with WTP SED , when i do a == comparison between the source and my
> initialised text editor inside my propertyChanged(Object source, int
> propId) is failing , though when i print the same in the console its
> same object name
>
> /*
> * (non-Javadoc)
> *
> * @see
> org.eclipse.ui.IPropertyListener#propertyChanged(java.lang.O bject,
> * int)
> */
> public void propertyChanged(Object source, int propId) {
> System.out.println("Source : " + source + " propID :" + propId
> + "PROP_Dirty=" + IEditorPart.PROP_DIRTY);
> System.out.println("Source Editor :" + sourceEditor);
> switch (propId) {
> case IEditorPart.PROP_DIRTY:
> case IEditorPart.PROP_INPUT: {
> if (source == sourceEditor) {
> if (sourceEditor.getEditorInput() != getEditorInput()) {
> System.out.println("2.1");
> setInput(sourceEditor.getEditorInput());
> Runnable runnable = new Runnable() {
> public void run() {
> firePropertyChange(IEditorPart.PROP_DIRTY);
> }
> };
> postOnDisplayQue(runnable);
>
> }
> }
> break;
> }
> }
> }
>
> Can you help me why its failing ??
>
> Kamesh
>
>
>
> Kamesh Sampath wrote:
>> Ed and Eike,
>>
>> The WTP SED is cool one . We have something called the
>> StrucutredTextEditor , we can use that i guess. I am just looking in
>> to that option , once am successful i shall post the message.
>>
>> Thanks.
>>
>> Kamesh
>>
>> Kamesh Sampath wrote:
>>> Ed and Eike,
>>>
>>> Thanks for further Information . Actually i thoght of looking in to
>>> that .. Let me do it . If am successfull i shall contribue a patch to
>>> EMF editor generation to have an Text editor that will edit the source .
>>>
>>> Thanks for the info .
>>>
>>> Kamesh
>>>
>>> Eike Stepper wrote:
>>>>
>>>>
>>>> Kamesh Sampath schrieb:
>>>>> Ed,
>>>>> Thats right ! thats y i sought to see the PDE Editor , but for my
>>>>> requirement its quite complex hence i asked for somthing much
>>>>> simpler. Will try the XSD editor.
>>>> Doesn't WTP have an XML editor? I don't use it but I'd expect that
>>>> they have text/model sync...
>>>>
>>>> Cheers
>>>> /Eike
>>>>
>>>>>
>>>>> Thanks .
>>>>>
>>>>> Kamesh
>>>>>
>>>>> Ed Merks wrote:
>>>>>> Kamesh,
>>>>>>
>>>>>> Probably the best you will get is pointers to existing source code
>>>>>> (Eric Gamma's monkey-see-monkey-do principle) and it will
>>>>>> typically be quite complex. The XSDEditor is a relatively simple
>>>>>> (i.e., crude) example. It will reparse the text whenever the text
>>>>>> changes. It uses an IDocumentListener with a delay to avoid
>>>>>> responding to every key stroke. For the reverse, the command
>>>>>> stack listener calls handleStructuredModelChange whenever a
>>>>>> command has been executed, which serializes the resource in memory
>>>>>> and updates the text in the text editor. This is quite a brute
>>>>>> force approach, but should serve as a starting point.
>>>>>>
>>>>>>
>>>>>> Kamesh Sampath wrote:
>>>>>>> Folks,
>>>>>>>
>>>>>>> Am really trying hard to save a model by editing a raw text and
>>>>>>> there by updating the MODEL . All my attempts are in vain .
>>>>>>>
>>>>>>> My Scenario:
>>>>>>>
>>>>>>> The editing domain and model is same for both the editors i mean
>>>>>>> to say am sharing the same common EMF model.
>>>>>>>
>>>>>>> I have an Multipage editor with two pages 1. TreeViewer to edit
>>>>>>> the model 2. TextEditor to view the model source
>>>>>>>
>>>>>>>
>>>>>>> I am able to view the changes made to the TreeViewer in the
>>>>>>> TextEditor
>>>>>>>
>>>>>>> but am struck up with the reverse scenario i.e when i make any
>>>>>>> textual changes to the model in form text in TextEditor i should
>>>>>>> synchronize that with the underlying model file , I am using the
>>>>>>> XML editor created out of eclipse platform samples.
>>>>>>>
>>>>>>> My issues are ,
>>>>>>>
>>>>>>> 1. How to track the textual changes in the Text Editor?
>>>>>>> 2. How to fire the model commands based on the Textual Changes?
>>>>>>>
>>>>>>>
>>>>>>> I dont know how to do this ? can anyone help me please . I dont
>>>>>>> mind even the model file gets corrupted as am not enforcing any
>>>>>>> validations now , all that i want is to make both work in sync
>>>>>>> changes to Model reflected in Source and Changes to source should
>>>>>>> be reflected in model.
>>>>>>>
>>>>>>>
>>>>>>> I am trying to do exactly like the PDE editor. I even saw the PDE
>>>>>>> editor source but its really long and very confusing to me.
>>>>>>>
>>>>>>> Any pointers will be really helpful.
>>>>>>>
>>>>>>> Thanks.
>>>>>
>>>>>
>>>
>>>
>>
>>
>
>
|
|
|
Re: EMF Model Synchrinization with Multipage Editor (Tree based Editor and Text Editor) [message #102889 is a reply to message #102857] |
Thu, 15 November 2007 23:33 |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
Vasanth,
It's highly unlikely that that without active contributors from the
community this issue will get addressed directly by the vanishingly
small EMF team. It would make a great EMFT component.
Vasanth Velusamy wrote:
> Kamesh, Ed,
>
> I know it has been over a year since the last post on this topic, but,
> any updates on this? As of now, the generated EMF multipage editor
> still lacks a source editor.
>
> Thanks,
> Vasanth
>
>
>
> Kamesh Sampath wrote:
>> Ed and Eike,
>>
>> I am able to successully integrate the WTP SED with my Editor . Lots of
>> redundant stuff has been removed from the common TextEditor that we
>> develop. But am facing a peculiar problem with the same , whenever we
>> want to fire the PROP_DIRTY with StructuredTextEditor(WTP Text Editor)
>> we need to implement the Property Change listener and register the same
>> with WTP SED , when i do a == comparison between the source and my
>> initialised text editor inside my propertyChanged(Object source, int
>> propId) is failing , though when i print the same in the console its
>> same object name
>>
>> /*
>> * (non-Javadoc)
>> *
>> * @see
>> org.eclipse.ui.IPropertyListener#propertyChanged(java.lang.O bject,
>> * int)
>> */
>> public void propertyChanged(Object source, int propId) {
>> System.out.println("Source : " + source + " propID :" + propId
>> + "PROP_Dirty=" + IEditorPart.PROP_DIRTY);
>> System.out.println("Source Editor :" + sourceEditor);
>> switch (propId) {
>> case IEditorPart.PROP_DIRTY:
>> case IEditorPart.PROP_INPUT: {
>> if (source == sourceEditor) {
>> if (sourceEditor.getEditorInput() !=
>> getEditorInput()) {
>> System.out.println("2.1");
>> setInput(sourceEditor.getEditorInput());
>> Runnable runnable = new Runnable() {
>> public void run() {
>>
>> firePropertyChange(IEditorPart.PROP_DIRTY);
>> }
>> };
>> postOnDisplayQue(runnable);
>>
>> }
>> }
>> break;
>> }
>> }
>> }
>>
>> Can you help me why its failing ??
>>
>> Kamesh
>>
>>
>>
>> Kamesh Sampath wrote:
>>> Ed and Eike,
>>>
>>> The WTP SED is cool one . We have something called the
>>> StrucutredTextEditor , we can use that i guess. I am just looking in
>>> to that option , once am successful i shall post the message.
>>>
>>> Thanks.
>>>
>>> Kamesh
>>>
>>> Kamesh Sampath wrote:
>>>> Ed and Eike,
>>>>
>>>> Thanks for further Information . Actually i thoght of looking in to
>>>> that .. Let me do it . If am successfull i shall contribue a patch
>>>> to EMF editor generation to have an Text editor that will edit the
>>>> source .
>>>>
>>>> Thanks for the info .
>>>>
>>>> Kamesh
>>>>
>>>> Eike Stepper wrote:
>>>>>
>>>>>
>>>>> Kamesh Sampath schrieb:
>>>>>> Ed,
>>>>>> Thats right ! thats y i sought to see the PDE Editor , but for my
>>>>>> requirement its quite complex hence i asked for somthing much
>>>>>> simpler. Will try the XSD editor.
>>>>> Doesn't WTP have an XML editor? I don't use it but I'd expect that
>>>>> they have text/model sync...
>>>>>
>>>>> Cheers
>>>>> /Eike
>>>>>
>>>>>>
>>>>>> Thanks .
>>>>>>
>>>>>> Kamesh
>>>>>>
>>>>>> Ed Merks wrote:
>>>>>>> Kamesh,
>>>>>>>
>>>>>>> Probably the best you will get is pointers to existing source
>>>>>>> code (Eric Gamma's monkey-see-monkey-do principle) and it will
>>>>>>> typically be quite complex. The XSDEditor is a relatively
>>>>>>> simple (i.e., crude) example. It will reparse the text whenever
>>>>>>> the text changes. It uses an IDocumentListener with a delay to
>>>>>>> avoid responding to every key stroke. For the reverse, the
>>>>>>> command stack listener calls handleStructuredModelChange
>>>>>>> whenever a command has been executed, which serializes the
>>>>>>> resource in memory and updates the text in the text editor.
>>>>>>> This is quite a brute force approach, but should serve as a
>>>>>>> starting point.
>>>>>>>
>>>>>>>
>>>>>>> Kamesh Sampath wrote:
>>>>>>>> Folks,
>>>>>>>>
>>>>>>>> Am really trying hard to save a model by editing a raw text and
>>>>>>>> there by updating the MODEL . All my attempts are in vain .
>>>>>>>>
>>>>>>>> My Scenario:
>>>>>>>>
>>>>>>>> The editing domain and model is same for both the editors i
>>>>>>>> mean to say am sharing the same common EMF model.
>>>>>>>>
>>>>>>>> I have an Multipage editor with two pages 1. TreeViewer to edit
>>>>>>>> the model 2. TextEditor to view the model source
>>>>>>>>
>>>>>>>>
>>>>>>>> I am able to view the changes made to the TreeViewer in the
>>>>>>>> TextEditor
>>>>>>>>
>>>>>>>> but am struck up with the reverse scenario i.e when i make any
>>>>>>>> textual changes to the model in form text in TextEditor i
>>>>>>>> should synchronize that with the underlying model file , I am
>>>>>>>> using the XML editor created out of eclipse platform samples.
>>>>>>>>
>>>>>>>> My issues are ,
>>>>>>>>
>>>>>>>> 1. How to track the textual changes in the Text Editor?
>>>>>>>> 2. How to fire the model commands based on the Textual Changes?
>>>>>>>>
>>>>>>>>
>>>>>>>> I dont know how to do this ? can anyone help me please . I dont
>>>>>>>> mind even the model file gets corrupted as am not enforcing any
>>>>>>>> validations now , all that i want is to make both work in sync
>>>>>>>> changes to Model reflected in Source and Changes to source
>>>>>>>> should be reflected in model.
>>>>>>>>
>>>>>>>>
>>>>>>>> I am trying to do exactly like the PDE editor. I even saw the
>>>>>>>> PDE editor source but its really long and very confusing to me.
>>>>>>>>
>>>>>>>> Any pointers will be really helpful.
>>>>>>>>
>>>>>>>> Thanks.
>>>>>>
>>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
|
|
| |
Re: EMF Model Synchrinization with Multipage Editor (Tree based Editor and Text Editor) [message #102935 is a reply to message #102902] |
Fri, 16 November 2007 10:56 |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
This is a multi-part message in MIME format.
--------------060404030403070404040004
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
David,
Trying to usurp EMFT contributors are you?! :-P
It would be very helpful for WTP to provide SSE in a form that's more
easily consumable (i.e., with minimal dependencies).
https://bugs.eclipse.org/bugs/show_bug.cgi?id=205892
I suspect that would require some fundamental restructuring that would
break APIs, so that's not so likely to happen even with contributor
involvement...
David Williams wrote:
> On Thu, 15 Nov 2007 18:33:53 -0500, Ed Merks <merks@ca.ibm.com> wrote:
>
>
>> Vasanth,
>>
>> It's highly unlikely that that without active contributors from the
>> community this issue will get addressed directly by the vanishingly
>> small EMF team. It would make a great EMFT component.
>>
>>
>>
>
> Well, it's make an even better component in the WTP Incubator! :)
> But Ed's point is just as valid. It will take someone from the community several
> months of full time work to put together all the pieces we have, which
> we know is no volunteer-in-your-free-time sort of effort.
>
>
--------------060404030403070404040004
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
David,<br>
<br>
Trying to usurp EMFT contributors are you?! :-P<br>
<br>
It would be very helpful for WTP to provide SSE in a form that's more
easily consumable (i.e., with minimal dependencies).<br>
<blockquote><a
href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=205892">https://bugs.eclipse.org/bugs/show_bug.cgi?id=205892</a><br>
</blockquote>
I suspect that would require some fundamental restructuring that would
break APIs, so that's not so likely to happen even with contributor
involvement...<br>
<br>
<br>
David Williams wrote:
<blockquote cite="mid:op.t1vih2otac05ss@dmw2t23.ibm.com" type="cite">
<pre wrap="">On Thu, 15 Nov 2007 18:33:53 -0500, Ed Merks <a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com"><merks@ca.ibm.com></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Vasanth,
It's highly unlikely that that without active contributors from the
community this issue will get addressed directly by the vanishingly
small EMF team. It would make a great EMFT component.
</pre>
</blockquote>
<pre wrap=""><!---->
Well, it's make an even better component in the WTP Incubator! :)
But Ed's point is just as valid. It will take someone from the community several
months of full time work to put together all the pieces we have, which
we know is no volunteer-in-your-free-time sort of effort.
</pre>
</blockquote>
<br>
</body>
</html>
--------------060404030403070404040004--
|
|
| |
Re: EMF Model Synchrinization with Multipage Editor (Tree based Editor and Text Editor) [message #102999 is a reply to message #102902] |
Fri, 16 November 2007 14:09 |
Eclipse User |
|
|
|
Originally posted by: vasanthv16.yahoo.com
Given that a generated Source Editor cannot be expected in the immediate
future, what would the best way for me to implement it myself? Earlier
in this thread, Ed mentioned using IDocumentListener. Is that the way to go?
Thanks,
Vasanth
David Williams wrote:
> On Thu, 15 Nov 2007 18:33:53 -0500, Ed Merks <merks@ca.ibm.com> wrote:
>
>> Vasanth,
>>
>> It's highly unlikely that that without active contributors from the
>> community this issue will get addressed directly by the vanishingly
>> small EMF team. It would make a great EMFT component.
>>
>>
>
> Well, it's make an even better component in the WTP Incubator! :)
> But Ed's point is just as valid. It will take someone from the community several
> months of full time work to put together all the pieces we have, which
> we know is no volunteer-in-your-free-time sort of effort.
>
|
|
|
Re: EMF Model Synchrinization with Multipage Editor (Tree based Editor and Text Editor) [message #103011 is a reply to message #102999] |
Fri, 16 November 2007 14:13 |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
Vasanth,
I think so.
Vasanth Velusamy wrote:
> Given that a generated Source Editor cannot be expected in the
> immediate future, what would the best way for me to implement it
> myself? Earlier in this thread, Ed mentioned using IDocumentListener.
> Is that the way to go?
>
> Thanks,
> Vasanth
>
>
> David Williams wrote:
>> On Thu, 15 Nov 2007 18:33:53 -0500, Ed Merks <merks@ca.ibm.com> wrote:
>>
>>> Vasanth,
>>>
>>> It's highly unlikely that that without active contributors from the
>>> community this issue will get addressed directly by the vanishingly
>>> small EMF team. It would make a great EMFT component.
>>>
>>>
>>
>> Well, it's make an even better component in the WTP Incubator! :)
>> But Ed's point is just as valid. It will take someone from the
>> community several
>> months of full time work to put together all the pieces we have, which
>> we know is no volunteer-in-your-free-time sort of effort.
>>
|
|
|
Re: EMF Model Synchrinization with Multipage Editor (Tree based Editor and Text Editor) [message #593017 is a reply to message #55158] |
Sat, 30 September 2006 13:50 |
Ed Merks Messages: 33264 Registered: July 2009 |
Senior Member |
|
|
Kamesh,
Probably the best you will get is pointers to existing source code (Eric
Gamma's monkey-see-monkey-do principle) and it will typically be quite
complex. The XSDEditor is a relatively simple (i.e., crude) example.
It will reparse the text whenever the text changes. It uses an
IDocumentListener with a delay to avoid responding to every key stroke.
For the reverse, the command stack listener calls
handleStructuredModelChange whenever a command has been executed, which
serializes the resource in memory and updates the text in the text
editor. This is quite a brute force approach, but should serve as a
starting point.
Kamesh Sampath wrote:
> Folks,
>
> Am really trying hard to save a model by editing a raw text and there
> by updating the MODEL . All my attempts are in vain .
>
> My Scenario:
>
> The editing domain and model is same for both the editors i mean to
> say am sharing the same common EMF model.
>
> I have an Multipage editor with two pages 1. TreeViewer to edit the
> model 2. TextEditor to view the model source
>
>
> I am able to view the changes made to the TreeViewer in the TextEditor
>
> but am struck up with the reverse scenario i.e when i make any textual
> changes to the model in form text in TextEditor i should synchronize
> that with the underlying model file , I am using the XML editor
> created out of eclipse platform samples.
>
> My issues are ,
>
> 1. How to track the textual changes in the Text Editor?
> 2. How to fire the model commands based on the Textual Changes?
>
>
> I dont know how to do this ? can anyone help me please . I dont mind
> even the model file gets corrupted as am not enforcing any validations
> now , all that i want is to make both work in sync changes to Model
> reflected in Source and Changes to source should be reflected in model.
>
>
> I am trying to do exactly like the PDE editor. I even saw the PDE
> editor source but its really long and very confusing to me.
>
> Any pointers will be really helpful.
>
> Thanks.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: EMF Model Synchrinization with Multipage Editor (Tree based Editor and Text Editor) [message #593032 is a reply to message #55188] |
Sat, 30 September 2006 15:35 |
Kamesh Sampath Messages: 191 Registered: July 2009 |
Senior Member |
|
|
Ed,
Thats right ! thats y i sought to see the PDE Editor , but for my
requirement its quite complex hence i asked for somthing much simpler.
Will try the XSD editor.
Thanks .
Kamesh
Ed Merks wrote:
> Kamesh,
>
> Probably the best you will get is pointers to existing source code
> (Eric Gamma's monkey-see-monkey-do principle) and it will typically be
> quite complex. The XSDEditor is a relatively simple (i.e., crude)
> example. It will reparse the text whenever the text changes. It uses
> an IDocumentListener with a delay to avoid responding to every key
> stroke. For the reverse, the command stack listener calls
> handleStructuredModelChange whenever a command has been executed,
> which serializes the resource in memory and updates the text in the
> text editor. This is quite a brute force approach, but should serve
> as a starting point.
>
>
> Kamesh Sampath wrote:
>> Folks,
>>
>> Am really trying hard to save a model by editing a raw text and there
>> by updating the MODEL . All my attempts are in vain .
>>
>> My Scenario:
>>
>> The editing domain and model is same for both the editors i mean to
>> say am sharing the same common EMF model.
>>
>> I have an Multipage editor with two pages 1. TreeViewer to edit the
>> model 2. TextEditor to view the model source
>>
>>
>> I am able to view the changes made to the TreeViewer in the TextEditor
>>
>> but am struck up with the reverse scenario i.e when i make any
>> textual changes to the model in form text in TextEditor i should
>> synchronize that with the underlying model file , I am using the XML
>> editor created out of eclipse platform samples.
>>
>> My issues are ,
>>
>> 1. How to track the textual changes in the Text Editor?
>> 2. How to fire the model commands based on the Textual Changes?
>>
>>
>> I dont know how to do this ? can anyone help me please . I dont mind
>> even the model file gets corrupted as am not enforcing any
>> validations now , all that i want is to make both work in sync
>> changes to Model reflected in Source and Changes to source should be
>> reflected in model.
>>
>>
>> I am trying to do exactly like the PDE editor. I even saw the PDE
>> editor source but its really long and very confusing to me.
>>
>> Any pointers will be really helpful.
>>
>> Thanks.
--
Kamesh Sampath
|
|
|
Re: EMF Model Synchrinization with Multipage Editor (Tree based Editor and Text Editor) [message #593053 is a reply to message #55214] |
Sat, 30 September 2006 17:21 |
|
Kamesh Sampath schrieb:
> Ed,
> Thats right ! thats y i sought to see the PDE Editor , but for my
> requirement its quite complex hence i asked for somthing much
> simpler. Will try the XSD editor.
Doesn't WTP have an XML editor? I don't use it but I'd expect that they
have text/model sync...
Cheers
/Eike
>
> Thanks .
>
> Kamesh
>
> Ed Merks wrote:
>> Kamesh,
>>
>> Probably the best you will get is pointers to existing source code
>> (Eric Gamma's monkey-see-monkey-do principle) and it will typically
>> be quite complex. The XSDEditor is a relatively simple (i.e., crude)
>> example. It will reparse the text whenever the text changes. It
>> uses an IDocumentListener with a delay to avoid responding to every
>> key stroke. For the reverse, the command stack listener calls
>> handleStructuredModelChange whenever a command has been executed,
>> which serializes the resource in memory and updates the text in the
>> text editor. This is quite a brute force approach, but should serve
>> as a starting point.
>>
>>
>> Kamesh Sampath wrote:
>>> Folks,
>>>
>>> Am really trying hard to save a model by editing a raw text and
>>> there by updating the MODEL . All my attempts are in vain .
>>>
>>> My Scenario:
>>>
>>> The editing domain and model is same for both the editors i mean to
>>> say am sharing the same common EMF model.
>>>
>>> I have an Multipage editor with two pages 1. TreeViewer to edit the
>>> model 2. TextEditor to view the model source
>>>
>>>
>>> I am able to view the changes made to the TreeViewer in the TextEditor
>>>
>>> but am struck up with the reverse scenario i.e when i make any
>>> textual changes to the model in form text in TextEditor i should
>>> synchronize that with the underlying model file , I am using the XML
>>> editor created out of eclipse platform samples.
>>>
>>> My issues are ,
>>>
>>> 1. How to track the textual changes in the Text Editor?
>>> 2. How to fire the model commands based on the Textual Changes?
>>>
>>>
>>> I dont know how to do this ? can anyone help me please . I dont mind
>>> even the model file gets corrupted as am not enforcing any
>>> validations now , all that i want is to make both work in sync
>>> changes to Model reflected in Source and Changes to source should be
>>> reflected in model.
>>>
>>>
>>> I am trying to do exactly like the PDE editor. I even saw the PDE
>>> editor source but its really long and very confusing to me.
>>>
>>> Any pointers will be really helpful.
>>>
>>> Thanks.
>
>
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Re: EMF Model Synchrinization with Multipage Editor (Tree based Editor and Text Editor) [message #593065 is a reply to message #55269] |
Sat, 30 September 2006 17:37 |
Ed Merks Messages: 33264 Registered: July 2009 |
Senior Member |
|
|
Eike,
Yes, WTP has a very cool SED DOM that incrementally synchronizes a DOM
structure with the textual source view of it. This in combination with
something that incrementally synchronizes an EMF model with that DOM
would be an extremely cool combination. A generated EMF editor with a
source view would be possible...
Eike Stepper wrote:
>
>
> Kamesh Sampath schrieb:
>> Ed,
>> Thats right ! thats y i sought to see the PDE Editor , but for my
>> requirement its quite complex hence i asked for somthing much
>> simpler. Will try the XSD editor.
> Doesn't WTP have an XML editor? I don't use it but I'd expect that
> they have text/model sync...
>
> Cheers
> /Eike
>
>>
>> Thanks .
>>
>> Kamesh
>>
>> Ed Merks wrote:
>>> Kamesh,
>>>
>>> Probably the best you will get is pointers to existing source code
>>> (Eric Gamma's monkey-see-monkey-do principle) and it will typically
>>> be quite complex. The XSDEditor is a relatively simple (i.e.,
>>> crude) example. It will reparse the text whenever the text
>>> changes. It uses an IDocumentListener with a delay to avoid
>>> responding to every key stroke. For the reverse, the command stack
>>> listener calls handleStructuredModelChange whenever a command has
>>> been executed, which serializes the resource in memory and updates
>>> the text in the text editor. This is quite a brute force approach,
>>> but should serve as a starting point.
>>>
>>>
>>> Kamesh Sampath wrote:
>>>> Folks,
>>>>
>>>> Am really trying hard to save a model by editing a raw text and
>>>> there by updating the MODEL . All my attempts are in vain .
>>>>
>>>> My Scenario:
>>>>
>>>> The editing domain and model is same for both the editors i mean to
>>>> say am sharing the same common EMF model.
>>>>
>>>> I have an Multipage editor with two pages 1. TreeViewer to edit the
>>>> model 2. TextEditor to view the model source
>>>>
>>>>
>>>> I am able to view the changes made to the TreeViewer in the TextEditor
>>>>
>>>> but am struck up with the reverse scenario i.e when i make any
>>>> textual changes to the model in form text in TextEditor i should
>>>> synchronize that with the underlying model file , I am using the
>>>> XML editor created out of eclipse platform samples.
>>>>
>>>> My issues are ,
>>>>
>>>> 1. How to track the textual changes in the Text Editor?
>>>> 2. How to fire the model commands based on the Textual Changes?
>>>>
>>>>
>>>> I dont know how to do this ? can anyone help me please . I dont
>>>> mind even the model file gets corrupted as am not enforcing any
>>>> validations now , all that i want is to make both work in sync
>>>> changes to Model reflected in Source and Changes to source should
>>>> be reflected in model.
>>>>
>>>>
>>>> I am trying to do exactly like the PDE editor. I even saw the PDE
>>>> editor source but its really long and very confusing to me.
>>>>
>>>> Any pointers will be really helpful.
>>>>
>>>> Thanks.
>>
>>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: EMF Model Synchrinization with Multipage Editor (Tree based Editor and Text Editor) [message #593077 is a reply to message #55296] |
Sat, 30 September 2006 17:57 |
|
Ed Merks schrieb:
> Eike,
>
> Yes, WTP has a very cool SED DOM that incrementally synchronizes a DOM
> structure with the textual source view of it. This in combination
> with something that incrementally synchronizes an EMF model with that
> DOM would be an extremely cool combination. A generated EMF editor
> with a source view would be possible...
Indeed. But personally I'd prefer to see
https://bugs.eclipse.org/bugs/show_bug.cgi?id=108470 addressed before ;-)
Cheers
/Eike
>
>
> Eike Stepper wrote:
>>
>>
>> Kamesh Sampath schrieb:
>>> Ed,
>>> Thats right ! thats y i sought to see the PDE Editor , but for my
>>> requirement its quite complex hence i asked for somthing much
>>> simpler. Will try the XSD editor.
>> Doesn't WTP have an XML editor? I don't use it but I'd expect that
>> they have text/model sync...
>>
>> Cheers
>> /Eike
>>
>>>
>>> Thanks .
>>>
>>> Kamesh
>>>
>>> Ed Merks wrote:
>>>> Kamesh,
>>>>
>>>> Probably the best you will get is pointers to existing source code
>>>> (Eric Gamma's monkey-see-monkey-do principle) and it will typically
>>>> be quite complex. The XSDEditor is a relatively simple (i.e.,
>>>> crude) example. It will reparse the text whenever the text
>>>> changes. It uses an IDocumentListener with a delay to avoid
>>>> responding to every key stroke. For the reverse, the command stack
>>>> listener calls handleStructuredModelChange whenever a command has
>>>> been executed, which serializes the resource in memory and updates
>>>> the text in the text editor. This is quite a brute force approach,
>>>> but should serve as a starting point.
>>>>
>>>>
>>>> Kamesh Sampath wrote:
>>>>> Folks,
>>>>>
>>>>> Am really trying hard to save a model by editing a raw text and
>>>>> there by updating the MODEL . All my attempts are in vain .
>>>>>
>>>>> My Scenario:
>>>>>
>>>>> The editing domain and model is same for both the editors i mean
>>>>> to say am sharing the same common EMF model.
>>>>>
>>>>> I have an Multipage editor with two pages 1. TreeViewer to edit
>>>>> the model 2. TextEditor to view the model source
>>>>>
>>>>>
>>>>> I am able to view the changes made to the TreeViewer in the
>>>>> TextEditor
>>>>>
>>>>> but am struck up with the reverse scenario i.e when i make any
>>>>> textual changes to the model in form text in TextEditor i should
>>>>> synchronize that with the underlying model file , I am using the
>>>>> XML editor created out of eclipse platform samples.
>>>>>
>>>>> My issues are ,
>>>>>
>>>>> 1. How to track the textual changes in the Text Editor?
>>>>> 2. How to fire the model commands based on the Textual Changes?
>>>>>
>>>>>
>>>>> I dont know how to do this ? can anyone help me please . I dont
>>>>> mind even the model file gets corrupted as am not enforcing any
>>>>> validations now , all that i want is to make both work in sync
>>>>> changes to Model reflected in Source and Changes to source should
>>>>> be reflected in model.
>>>>>
>>>>>
>>>>> I am trying to do exactly like the PDE editor. I even saw the PDE
>>>>> editor source but its really long and very confusing to me.
>>>>>
>>>>> Any pointers will be really helpful.
>>>>>
>>>>> Thanks.
>>>
>>>
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Re: EMF Model Synchrinization with Multipage Editor (Tree based Editor and Text Editor) [message #593086 is a reply to message #55269] |
Sat, 30 September 2006 18:05 |
Kamesh Sampath Messages: 191 Registered: July 2009 |
Senior Member |
|
|
Ed and Eike,
Thanks for further Information . Actually i thoght of looking in to that
.. Let me do it . If am successfull i shall contribue a patch to EMF
editor generation to have an Text editor that will edit the source .
Thanks for the info .
Kamesh
Eike Stepper wrote:
>
>
> Kamesh Sampath schrieb:
>> Ed,
>> Thats right ! thats y i sought to see the PDE Editor , but for my
>> requirement its quite complex hence i asked for somthing much
>> simpler. Will try the XSD editor.
> Doesn't WTP have an XML editor? I don't use it but I'd expect that
> they have text/model sync...
>
> Cheers
> /Eike
>
>>
>> Thanks .
>>
>> Kamesh
>>
>> Ed Merks wrote:
>>> Kamesh,
>>>
>>> Probably the best you will get is pointers to existing source code
>>> (Eric Gamma's monkey-see-monkey-do principle) and it will typically
>>> be quite complex. The XSDEditor is a relatively simple (i.e.,
>>> crude) example. It will reparse the text whenever the text
>>> changes. It uses an IDocumentListener with a delay to avoid
>>> responding to every key stroke. For the reverse, the command stack
>>> listener calls handleStructuredModelChange whenever a command has
>>> been executed, which serializes the resource in memory and updates
>>> the text in the text editor. This is quite a brute force approach,
>>> but should serve as a starting point.
>>>
>>>
>>> Kamesh Sampath wrote:
>>>> Folks,
>>>>
>>>> Am really trying hard to save a model by editing a raw text and
>>>> there by updating the MODEL . All my attempts are in vain .
>>>>
>>>> My Scenario:
>>>>
>>>> The editing domain and model is same for both the editors i mean to
>>>> say am sharing the same common EMF model.
>>>>
>>>> I have an Multipage editor with two pages 1. TreeViewer to edit the
>>>> model 2. TextEditor to view the model source
>>>>
>>>>
>>>> I am able to view the changes made to the TreeViewer in the TextEditor
>>>>
>>>> but am struck up with the reverse scenario i.e when i make any
>>>> textual changes to the model in form text in TextEditor i should
>>>> synchronize that with the underlying model file , I am using the
>>>> XML editor created out of eclipse platform samples.
>>>>
>>>> My issues are ,
>>>>
>>>> 1. How to track the textual changes in the Text Editor?
>>>> 2. How to fire the model commands based on the Textual Changes?
>>>>
>>>>
>>>> I dont know how to do this ? can anyone help me please . I dont
>>>> mind even the model file gets corrupted as am not enforcing any
>>>> validations now , all that i want is to make both work in sync
>>>> changes to Model reflected in Source and Changes to source should
>>>> be reflected in model.
>>>>
>>>>
>>>> I am trying to do exactly like the PDE editor. I even saw the PDE
>>>> editor source but its really long and very confusing to me.
>>>>
>>>> Any pointers will be really helpful.
>>>>
>>>> Thanks.
>>
>>
--
Kamesh Sampath
|
|
|
Re: EMF Model Synchrinization with Multipage Editor (Tree based Editor and Text Editor) [message #593094 is a reply to message #55350] |
Sat, 30 September 2006 18:57 |
Kamesh Sampath Messages: 191 Registered: July 2009 |
Senior Member |
|
|
Ed and Eike,
The WTP SED is cool one . We have something called the
StrucutredTextEditor , we can use that i guess. I am just looking in to
that option , once am successful i shall post the message.
Thanks.
Kamesh
Kamesh Sampath wrote:
> Ed and Eike,
>
> Thanks for further Information . Actually i thoght of looking in to
> that .. Let me do it . If am successfull i shall contribue a patch to
> EMF editor generation to have an Text editor that will edit the source .
>
> Thanks for the info .
>
> Kamesh
>
> Eike Stepper wrote:
>>
>>
>> Kamesh Sampath schrieb:
>>> Ed,
>>> Thats right ! thats y i sought to see the PDE Editor , but for my
>>> requirement its quite complex hence i asked for somthing much
>>> simpler. Will try the XSD editor.
>> Doesn't WTP have an XML editor? I don't use it but I'd expect that
>> they have text/model sync...
>>
>> Cheers
>> /Eike
>>
>>>
>>> Thanks .
>>>
>>> Kamesh
>>>
>>> Ed Merks wrote:
>>>> Kamesh,
>>>>
>>>> Probably the best you will get is pointers to existing source code
>>>> (Eric Gamma's monkey-see-monkey-do principle) and it will typically
>>>> be quite complex. The XSDEditor is a relatively simple (i.e.,
>>>> crude) example. It will reparse the text whenever the text
>>>> changes. It uses an IDocumentListener with a delay to avoid
>>>> responding to every key stroke. For the reverse, the command stack
>>>> listener calls handleStructuredModelChange whenever a command has
>>>> been executed, which serializes the resource in memory and updates
>>>> the text in the text editor. This is quite a brute force approach,
>>>> but should serve as a starting point.
>>>>
>>>>
>>>> Kamesh Sampath wrote:
>>>>> Folks,
>>>>>
>>>>> Am really trying hard to save a model by editing a raw text and
>>>>> there by updating the MODEL . All my attempts are in vain .
>>>>>
>>>>> My Scenario:
>>>>>
>>>>> The editing domain and model is same for both the editors i mean
>>>>> to say am sharing the same common EMF model.
>>>>>
>>>>> I have an Multipage editor with two pages 1. TreeViewer to edit
>>>>> the model 2. TextEditor to view the model source
>>>>>
>>>>>
>>>>> I am able to view the changes made to the TreeViewer in the
>>>>> TextEditor
>>>>>
>>>>> but am struck up with the reverse scenario i.e when i make any
>>>>> textual changes to the model in form text in TextEditor i should
>>>>> synchronize that with the underlying model file , I am using the
>>>>> XML editor created out of eclipse platform samples.
>>>>>
>>>>> My issues are ,
>>>>>
>>>>> 1. How to track the textual changes in the Text Editor?
>>>>> 2. How to fire the model commands based on the Textual Changes?
>>>>>
>>>>>
>>>>> I dont know how to do this ? can anyone help me please . I dont
>>>>> mind even the model file gets corrupted as am not enforcing any
>>>>> validations now , all that i want is to make both work in sync
>>>>> changes to Model reflected in Source and Changes to source should
>>>>> be reflected in model.
>>>>>
>>>>>
>>>>> I am trying to do exactly like the PDE editor. I even saw the PDE
>>>>> editor source but its really long and very confusing to me.
>>>>>
>>>>> Any pointers will be really helpful.
>>>>>
>>>>> Thanks.
>>>
>>>
>
>
--
Kamesh Sampath
|
|
|
Re: EMF Model Synchrinization with Multipage Editor (Tree based Editor and Text Editor) [message #593103 is a reply to message #55378] |
Sat, 30 September 2006 20:01 |
Kamesh Sampath Messages: 191 Registered: July 2009 |
Senior Member |
|
|
Ed and Eike,
I am able to successully integrate the WTP SED with my Editor . Lots of
redundant stuff has been removed from the common TextEditor that we
develop. But am facing a peculiar problem with the same , whenever we
want to fire the PROP_DIRTY with StructuredTextEditor(WTP Text Editor)
we need to implement the Property Change listener and register the same
with WTP SED , when i do a == comparison between the source and my
initialised text editor inside my propertyChanged(Object source, int
propId) is failing , though when i print the same in the console its
same object name
/*
* (non-Javadoc)
*
* @see
org.eclipse.ui.IPropertyListener#propertyChanged(java.lang.O bject,
* int)
*/
public void propertyChanged(Object source, int propId) {
System.out.println("Source : " + source + " propID :" + propId
+ "PROP_Dirty=" + IEditorPart.PROP_DIRTY);
System.out.println("Source Editor :" + sourceEditor);
switch (propId) {
case IEditorPart.PROP_DIRTY:
case IEditorPart.PROP_INPUT: {
if (source == sourceEditor) {
if (sourceEditor.getEditorInput() != getEditorInput()) {
System.out.println("2.1");
setInput(sourceEditor.getEditorInput());
Runnable runnable = new Runnable() {
public void run() {
firePropertyChange(IEditorPart.PROP_DIRTY);
}
};
postOnDisplayQue(runnable);
}
}
break;
}
}
}
Can you help me why its failing ??
Kamesh
Kamesh Sampath wrote:
> Ed and Eike,
>
> The WTP SED is cool one . We have something called the
> StrucutredTextEditor , we can use that i guess. I am just looking in
> to that option , once am successful i shall post the message.
>
> Thanks.
>
> Kamesh
>
> Kamesh Sampath wrote:
>> Ed and Eike,
>>
>> Thanks for further Information . Actually i thoght of looking in to
>> that .. Let me do it . If am successfull i shall contribue a patch to
>> EMF editor generation to have an Text editor that will edit the source .
>>
>> Thanks for the info .
>>
>> Kamesh
>>
>> Eike Stepper wrote:
>>>
>>>
>>> Kamesh Sampath schrieb:
>>>> Ed,
>>>> Thats right ! thats y i sought to see the PDE Editor , but for my
>>>> requirement its quite complex hence i asked for somthing much
>>>> simpler. Will try the XSD editor.
>>> Doesn't WTP have an XML editor? I don't use it but I'd expect that
>>> they have text/model sync...
>>>
>>> Cheers
>>> /Eike
>>>
>>>>
>>>> Thanks .
>>>>
>>>> Kamesh
>>>>
>>>> Ed Merks wrote:
>>>>> Kamesh,
>>>>>
>>>>> Probably the best you will get is pointers to existing source code
>>>>> (Eric Gamma's monkey-see-monkey-do principle) and it will
>>>>> typically be quite complex. The XSDEditor is a relatively simple
>>>>> (i.e., crude) example. It will reparse the text whenever the text
>>>>> changes. It uses an IDocumentListener with a delay to avoid
>>>>> responding to every key stroke. For the reverse, the command
>>>>> stack listener calls handleStructuredModelChange whenever a
>>>>> command has been executed, which serializes the resource in memory
>>>>> and updates the text in the text editor. This is quite a brute
>>>>> force approach, but should serve as a starting point.
>>>>>
>>>>>
>>>>> Kamesh Sampath wrote:
>>>>>> Folks,
>>>>>>
>>>>>> Am really trying hard to save a model by editing a raw text and
>>>>>> there by updating the MODEL . All my attempts are in vain .
>>>>>>
>>>>>> My Scenario:
>>>>>>
>>>>>> The editing domain and model is same for both the editors i mean
>>>>>> to say am sharing the same common EMF model.
>>>>>>
>>>>>> I have an Multipage editor with two pages 1. TreeViewer to edit
>>>>>> the model 2. TextEditor to view the model source
>>>>>>
>>>>>>
>>>>>> I am able to view the changes made to the TreeViewer in the
>>>>>> TextEditor
>>>>>>
>>>>>> but am struck up with the reverse scenario i.e when i make any
>>>>>> textual changes to the model in form text in TextEditor i should
>>>>>> synchronize that with the underlying model file , I am using the
>>>>>> XML editor created out of eclipse platform samples.
>>>>>>
>>>>>> My issues are ,
>>>>>>
>>>>>> 1. How to track the textual changes in the Text Editor?
>>>>>> 2. How to fire the model commands based on the Textual Changes?
>>>>>>
>>>>>>
>>>>>> I dont know how to do this ? can anyone help me please . I dont
>>>>>> mind even the model file gets corrupted as am not enforcing any
>>>>>> validations now , all that i want is to make both work in sync
>>>>>> changes to Model reflected in Source and Changes to source should
>>>>>> be reflected in model.
>>>>>>
>>>>>>
>>>>>> I am trying to do exactly like the PDE editor. I even saw the PDE
>>>>>> editor source but its really long and very confusing to me.
>>>>>>
>>>>>> Any pointers will be really helpful.
>>>>>>
>>>>>> Thanks.
>>>>
>>>>
>>
>>
>
>
--
Kamesh Sampath
|
|
|
Re: EMF Model Synchrinization with Multipage Editor (Tree based Editor and Text Editor) [message #593114 is a reply to message #55405] |
Sat, 30 September 2006 21:12 |
Ed Merks Messages: 33264 Registered: July 2009 |
Senior Member |
|
|
Kamesh,
Should use be using .equals verses ==?
Kamesh Sampath wrote:
> Ed and Eike,
>
> I am able to successully integrate the WTP SED with my Editor . Lots of
> redundant stuff has been removed from the common TextEditor that we
> develop. But am facing a peculiar problem with the same , whenever we
> want to fire the PROP_DIRTY with StructuredTextEditor(WTP Text Editor)
> we need to implement the Property Change listener and register the same
> with WTP SED , when i do a == comparison between the source and my
> initialised text editor inside my propertyChanged(Object source, int
> propId) is failing , though when i print the same in the console its
> same object name
>
> /*
> * (non-Javadoc)
> *
> * @see
> org.eclipse.ui.IPropertyListener#propertyChanged(java.lang.O bject,
> * int)
> */
> public void propertyChanged(Object source, int propId) {
> System.out.println("Source : " + source + " propID :" + propId
> + "PROP_Dirty=" + IEditorPart.PROP_DIRTY);
> System.out.println("Source Editor :" + sourceEditor);
> switch (propId) {
> case IEditorPart.PROP_DIRTY:
> case IEditorPart.PROP_INPUT: {
> if (source == sourceEditor) {
> if (sourceEditor.getEditorInput() !=
> getEditorInput()) {
> System.out.println("2.1");
> setInput(sourceEditor.getEditorInput());
> Runnable runnable = new Runnable() {
> public void run() {
>
> firePropertyChange(IEditorPart.PROP_DIRTY);
> }
> };
> postOnDisplayQue(runnable);
>
> }
> }
> break;
> }
> }
> }
>
> Can you help me why its failing ??
>
> Kamesh
>
>
>
> Kamesh Sampath wrote:
>> Ed and Eike,
>>
>> The WTP SED is cool one . We have something called the
>> StrucutredTextEditor , we can use that i guess. I am just looking in
>> to that option , once am successful i shall post the message.
>>
>> Thanks.
>>
>> Kamesh
>>
>> Kamesh Sampath wrote:
>>> Ed and Eike,
>>>
>>> Thanks for further Information . Actually i thoght of looking in to
>>> that .. Let me do it . If am successfull i shall contribue a patch
>>> to EMF editor generation to have an Text editor that will edit the
>>> source .
>>>
>>> Thanks for the info .
>>>
>>> Kamesh
>>>
>>> Eike Stepper wrote:
>>>>
>>>>
>>>> Kamesh Sampath schrieb:
>>>>> Ed,
>>>>> Thats right ! thats y i sought to see the PDE Editor , but for my
>>>>> requirement its quite complex hence i asked for somthing much
>>>>> simpler. Will try the XSD editor.
>>>> Doesn't WTP have an XML editor? I don't use it but I'd expect that
>>>> they have text/model sync...
>>>>
>>>> Cheers
>>>> /Eike
>>>>
>>>>>
>>>>> Thanks .
>>>>>
>>>>> Kamesh
>>>>>
>>>>> Ed Merks wrote:
>>>>>> Kamesh,
>>>>>>
>>>>>> Probably the best you will get is pointers to existing source
>>>>>> code (Eric Gamma's monkey-see-monkey-do principle) and it will
>>>>>> typically be quite complex. The XSDEditor is a relatively simple
>>>>>> (i.e., crude) example. It will reparse the text whenever the
>>>>>> text changes. It uses an IDocumentListener with a delay to avoid
>>>>>> responding to every key stroke. For the reverse, the command
>>>>>> stack listener calls handleStructuredModelChange whenever a
>>>>>> command has been executed, which serializes the resource in
>>>>>> memory and updates the text in the text editor. This is quite a
>>>>>> brute force approach, but should serve as a starting point.
>>>>>>
>>>>>>
>>>>>> Kamesh Sampath wrote:
>>>>>>> Folks,
>>>>>>>
>>>>>>> Am really trying hard to save a model by editing a raw text and
>>>>>>> there by updating the MODEL . All my attempts are in vain .
>>>>>>>
>>>>>>> My Scenario:
>>>>>>>
>>>>>>> The editing domain and model is same for both the editors i mean
>>>>>>> to say am sharing the same common EMF model.
>>>>>>>
>>>>>>> I have an Multipage editor with two pages 1. TreeViewer to edit
>>>>>>> the model 2. TextEditor to view the model source
>>>>>>>
>>>>>>>
>>>>>>> I am able to view the changes made to the TreeViewer in the
>>>>>>> TextEditor
>>>>>>>
>>>>>>> but am struck up with the reverse scenario i.e when i make any
>>>>>>> textual changes to the model in form text in TextEditor i should
>>>>>>> synchronize that with the underlying model file , I am using the
>>>>>>> XML editor created out of eclipse platform samples.
>>>>>>>
>>>>>>> My issues are ,
>>>>>>>
>>>>>>> 1. How to track the textual changes in the Text Editor?
>>>>>>> 2. How to fire the model commands based on the Textual Changes?
>>>>>>>
>>>>>>>
>>>>>>> I dont know how to do this ? can anyone help me please . I dont
>>>>>>> mind even the model file gets corrupted as am not enforcing any
>>>>>>> validations now , all that i want is to make both work in sync
>>>>>>> changes to Model reflected in Source and Changes to source
>>>>>>> should be reflected in model.
>>>>>>>
>>>>>>>
>>>>>>> I am trying to do exactly like the PDE editor. I even saw the
>>>>>>> PDE editor source but its really long and very confusing to me.
>>>>>>>
>>>>>>> Any pointers will be really helpful.
>>>>>>>
>>>>>>> Thanks.
>>>>>
>>>>>
>>>
>>>
>>
>>
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: EMF Model Synchrinization with Multipage Editor (Tree based Editor and Text Editor) [message #612551 is a reply to message #55405] |
Thu, 15 November 2007 23:19 |
Vasanth Velusamy Messages: 31 Registered: July 2009 |
Member |
|
|
Kamesh, Ed,
I know it has been over a year since the last post on this topic, but,
any updates on this? As of now, the generated EMF multipage editor still
lacks a source editor.
Thanks,
Vasanth
Kamesh Sampath wrote:
> Ed and Eike,
>
> I am able to successully integrate the WTP SED with my Editor . Lots of
> redundant stuff has been removed from the common TextEditor that we
> develop. But am facing a peculiar problem with the same , whenever we
> want to fire the PROP_DIRTY with StructuredTextEditor(WTP Text Editor)
> we need to implement the Property Change listener and register the same
> with WTP SED , when i do a == comparison between the source and my
> initialised text editor inside my propertyChanged(Object source, int
> propId) is failing , though when i print the same in the console its
> same object name
>
> /*
> * (non-Javadoc)
> *
> * @see
> org.eclipse.ui.IPropertyListener#propertyChanged(java.lang.O bject,
> * int)
> */
> public void propertyChanged(Object source, int propId) {
> System.out.println("Source : " + source + " propID :" + propId
> + "PROP_Dirty=" + IEditorPart.PROP_DIRTY);
> System.out.println("Source Editor :" + sourceEditor);
> switch (propId) {
> case IEditorPart.PROP_DIRTY:
> case IEditorPart.PROP_INPUT: {
> if (source == sourceEditor) {
> if (sourceEditor.getEditorInput() != getEditorInput()) {
> System.out.println("2.1");
> setInput(sourceEditor.getEditorInput());
> Runnable runnable = new Runnable() {
> public void run() {
> firePropertyChange(IEditorPart.PROP_DIRTY);
> }
> };
> postOnDisplayQue(runnable);
>
> }
> }
> break;
> }
> }
> }
>
> Can you help me why its failing ??
>
> Kamesh
>
>
>
> Kamesh Sampath wrote:
>> Ed and Eike,
>>
>> The WTP SED is cool one . We have something called the
>> StrucutredTextEditor , we can use that i guess. I am just looking in
>> to that option , once am successful i shall post the message.
>>
>> Thanks.
>>
>> Kamesh
>>
>> Kamesh Sampath wrote:
>>> Ed and Eike,
>>>
>>> Thanks for further Information . Actually i thoght of looking in to
>>> that .. Let me do it . If am successfull i shall contribue a patch to
>>> EMF editor generation to have an Text editor that will edit the source .
>>>
>>> Thanks for the info .
>>>
>>> Kamesh
>>>
>>> Eike Stepper wrote:
>>>>
>>>>
>>>> Kamesh Sampath schrieb:
>>>>> Ed,
>>>>> Thats right ! thats y i sought to see the PDE Editor , but for my
>>>>> requirement its quite complex hence i asked for somthing much
>>>>> simpler. Will try the XSD editor.
>>>> Doesn't WTP have an XML editor? I don't use it but I'd expect that
>>>> they have text/model sync...
>>>>
>>>> Cheers
>>>> /Eike
>>>>
>>>>>
>>>>> Thanks .
>>>>>
>>>>> Kamesh
>>>>>
>>>>> Ed Merks wrote:
>>>>>> Kamesh,
>>>>>>
>>>>>> Probably the best you will get is pointers to existing source code
>>>>>> (Eric Gamma's monkey-see-monkey-do principle) and it will
>>>>>> typically be quite complex. The XSDEditor is a relatively simple
>>>>>> (i.e., crude) example. It will reparse the text whenever the text
>>>>>> changes. It uses an IDocumentListener with a delay to avoid
>>>>>> responding to every key stroke. For the reverse, the command
>>>>>> stack listener calls handleStructuredModelChange whenever a
>>>>>> command has been executed, which serializes the resource in memory
>>>>>> and updates the text in the text editor. This is quite a brute
>>>>>> force approach, but should serve as a starting point.
>>>>>>
>>>>>>
>>>>>> Kamesh Sampath wrote:
>>>>>>> Folks,
>>>>>>>
>>>>>>> Am really trying hard to save a model by editing a raw text and
>>>>>>> there by updating the MODEL . All my attempts are in vain .
>>>>>>>
>>>>>>> My Scenario:
>>>>>>>
>>>>>>> The editing domain and model is same for both the editors i mean
>>>>>>> to say am sharing the same common EMF model.
>>>>>>>
>>>>>>> I have an Multipage editor with two pages 1. TreeViewer to edit
>>>>>>> the model 2. TextEditor to view the model source
>>>>>>>
>>>>>>>
>>>>>>> I am able to view the changes made to the TreeViewer in the
>>>>>>> TextEditor
>>>>>>>
>>>>>>> but am struck up with the reverse scenario i.e when i make any
>>>>>>> textual changes to the model in form text in TextEditor i should
>>>>>>> synchronize that with the underlying model file , I am using the
>>>>>>> XML editor created out of eclipse platform samples.
>>>>>>>
>>>>>>> My issues are ,
>>>>>>>
>>>>>>> 1. How to track the textual changes in the Text Editor?
>>>>>>> 2. How to fire the model commands based on the Textual Changes?
>>>>>>>
>>>>>>>
>>>>>>> I dont know how to do this ? can anyone help me please . I dont
>>>>>>> mind even the model file gets corrupted as am not enforcing any
>>>>>>> validations now , all that i want is to make both work in sync
>>>>>>> changes to Model reflected in Source and Changes to source should
>>>>>>> be reflected in model.
>>>>>>>
>>>>>>>
>>>>>>> I am trying to do exactly like the PDE editor. I even saw the PDE
>>>>>>> editor source but its really long and very confusing to me.
>>>>>>>
>>>>>>> Any pointers will be really helpful.
>>>>>>>
>>>>>>> Thanks.
>>>>>
>>>>>
>>>
>>>
>>
>>
>
>
|
|
|
Re: EMF Model Synchrinization with Multipage Editor (Tree based Editor and Text Editor) [message #612553 is a reply to message #102857] |
Thu, 15 November 2007 23:33 |
Ed Merks Messages: 33264 Registered: July 2009 |
Senior Member |
|
|
Vasanth,
It's highly unlikely that that without active contributors from the
community this issue will get addressed directly by the vanishingly
small EMF team. It would make a great EMFT component.
Vasanth Velusamy wrote:
> Kamesh, Ed,
>
> I know it has been over a year since the last post on this topic, but,
> any updates on this? As of now, the generated EMF multipage editor
> still lacks a source editor.
>
> Thanks,
> Vasanth
>
>
>
> Kamesh Sampath wrote:
>> Ed and Eike,
>>
>> I am able to successully integrate the WTP SED with my Editor . Lots of
>> redundant stuff has been removed from the common TextEditor that we
>> develop. But am facing a peculiar problem with the same , whenever we
>> want to fire the PROP_DIRTY with StructuredTextEditor(WTP Text Editor)
>> we need to implement the Property Change listener and register the same
>> with WTP SED , when i do a == comparison between the source and my
>> initialised text editor inside my propertyChanged(Object source, int
>> propId) is failing , though when i print the same in the console its
>> same object name
>>
>> /*
>> * (non-Javadoc)
>> *
>> * @see
>> org.eclipse.ui.IPropertyListener#propertyChanged(java.lang.O bject,
>> * int)
>> */
>> public void propertyChanged(Object source, int propId) {
>> System.out.println("Source : " + source + " propID :" + propId
>> + "PROP_Dirty=" + IEditorPart.PROP_DIRTY);
>> System.out.println("Source Editor :" + sourceEditor);
>> switch (propId) {
>> case IEditorPart.PROP_DIRTY:
>> case IEditorPart.PROP_INPUT: {
>> if (source == sourceEditor) {
>> if (sourceEditor.getEditorInput() !=
>> getEditorInput()) {
>> System.out.println("2.1");
>> setInput(sourceEditor.getEditorInput());
>> Runnable runnable = new Runnable() {
>> public void run() {
>>
>> firePropertyChange(IEditorPart.PROP_DIRTY);
>> }
>> };
>> postOnDisplayQue(runnable);
>>
>> }
>> }
>> break;
>> }
>> }
>> }
>>
>> Can you help me why its failing ??
>>
>> Kamesh
>>
>>
>>
>> Kamesh Sampath wrote:
>>> Ed and Eike,
>>>
>>> The WTP SED is cool one . We have something called the
>>> StrucutredTextEditor , we can use that i guess. I am just looking in
>>> to that option , once am successful i shall post the message.
>>>
>>> Thanks.
>>>
>>> Kamesh
>>>
>>> Kamesh Sampath wrote:
>>>> Ed and Eike,
>>>>
>>>> Thanks for further Information . Actually i thoght of looking in to
>>>> that .. Let me do it . If am successfull i shall contribue a patch
>>>> to EMF editor generation to have an Text editor that will edit the
>>>> source .
>>>>
>>>> Thanks for the info .
>>>>
>>>> Kamesh
>>>>
>>>> Eike Stepper wrote:
>>>>>
>>>>>
>>>>> Kamesh Sampath schrieb:
>>>>>> Ed,
>>>>>> Thats right ! thats y i sought to see the PDE Editor , but for my
>>>>>> requirement its quite complex hence i asked for somthing much
>>>>>> simpler. Will try the XSD editor.
>>>>> Doesn't WTP have an XML editor? I don't use it but I'd expect that
>>>>> they have text/model sync...
>>>>>
>>>>> Cheers
>>>>> /Eike
>>>>>
>>>>>>
>>>>>> Thanks .
>>>>>>
>>>>>> Kamesh
>>>>>>
>>>>>> Ed Merks wrote:
>>>>>>> Kamesh,
>>>>>>>
>>>>>>> Probably the best you will get is pointers to existing source
>>>>>>> code (Eric Gamma's monkey-see-monkey-do principle) and it will
>>>>>>> typically be quite complex. The XSDEditor is a relatively
>>>>>>> simple (i.e., crude) example. It will reparse the text whenever
>>>>>>> the text changes. It uses an IDocumentListener with a delay to
>>>>>>> avoid responding to every key stroke. For the reverse, the
>>>>>>> command stack listener calls handleStructuredModelChange
>>>>>>> whenever a command has been executed, which serializes the
>>>>>>> resource in memory and updates the text in the text editor.
>>>>>>> This is quite a brute force approach, but should serve as a
>>>>>>> starting point.
>>>>>>>
>>>>>>>
>>>>>>> Kamesh Sampath wrote:
>>>>>>>> Folks,
>>>>>>>>
>>>>>>>> Am really trying hard to save a model by editing a raw text and
>>>>>>>> there by updating the MODEL . All my attempts are in vain .
>>>>>>>>
>>>>>>>> My Scenario:
>>>>>>>>
>>>>>>>> The editing domain and model is same for both the editors i
>>>>>>>> mean to say am sharing the same common EMF model.
>>>>>>>>
>>>>>>>> I have an Multipage editor with two pages 1. TreeViewer to edit
>>>>>>>> the model 2. TextEditor to view the model source
>>>>>>>>
>>>>>>>>
>>>>>>>> I am able to view the changes made to the TreeViewer in the
>>>>>>>> TextEditor
>>>>>>>>
>>>>>>>> but am struck up with the reverse scenario i.e when i make any
>>>>>>>> textual changes to the model in form text in TextEditor i
>>>>>>>> should synchronize that with the underlying model file , I am
>>>>>>>> using the XML editor created out of eclipse platform samples.
>>>>>>>>
>>>>>>>> My issues are ,
>>>>>>>>
>>>>>>>> 1. How to track the textual changes in the Text Editor?
>>>>>>>> 2. How to fire the model commands based on the Textual Changes?
>>>>>>>>
>>>>>>>>
>>>>>>>> I dont know how to do this ? can anyone help me please . I dont
>>>>>>>> mind even the model file gets corrupted as am not enforcing any
>>>>>>>> validations now , all that i want is to make both work in sync
>>>>>>>> changes to Model reflected in Source and Changes to source
>>>>>>>> should be reflected in model.
>>>>>>>>
>>>>>>>>
>>>>>>>> I am trying to do exactly like the PDE editor. I even saw the
>>>>>>>> PDE editor source but its really long and very confusing to me.
>>>>>>>>
>>>>>>>> Any pointers will be really helpful.
>>>>>>>>
>>>>>>>> Thanks.
>>>>>>
>>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
| |
Re: EMF Model Synchrinization with Multipage Editor (Tree based Editor and Text Editor) [message #612559 is a reply to message #102902] |
Fri, 16 November 2007 10:56 |
Ed Merks Messages: 33264 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------060404030403070404040004
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
David,
Trying to usurp EMFT contributors are you?! :-P
It would be very helpful for WTP to provide SSE in a form that's more
easily consumable (i.e., with minimal dependencies).
https://bugs.eclipse.org/bugs/show_bug.cgi?id=205892
I suspect that would require some fundamental restructuring that would
break APIs, so that's not so likely to happen even with contributor
involvement...
David Williams wrote:
> On Thu, 15 Nov 2007 18:33:53 -0500, Ed Merks <merks@ca.ibm.com> wrote:
>
>
>> Vasanth,
>>
>> It's highly unlikely that that without active contributors from the
>> community this issue will get addressed directly by the vanishingly
>> small EMF team. It would make a great EMFT component.
>>
>>
>>
>
> Well, it's make an even better component in the WTP Incubator! :)
> But Ed's point is just as valid. It will take someone from the community several
> months of full time work to put together all the pieces we have, which
> we know is no volunteer-in-your-free-time sort of effort.
>
>
--------------060404030403070404040004
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
David,<br>
<br>
Trying to usurp EMFT contributors are you?! :-P<br>
<br>
It would be very helpful for WTP to provide SSE in a form that's more
easily consumable (i.e., with minimal dependencies).<br>
<blockquote><a
href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=205892">https://bugs.eclipse.org/bugs/show_bug.cgi?id=205892</a><br>
</blockquote>
I suspect that would require some fundamental restructuring that would
break APIs, so that's not so likely to happen even with contributor
involvement...<br>
<br>
<br>
David Williams wrote:
<blockquote cite="mid:op.t1vih2otac05ss@dmw2t23.ibm.com" type="cite">
<pre wrap="">On Thu, 15 Nov 2007 18:33:53 -0500, Ed Merks <a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com"><merks@ca.ibm.com></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Vasanth,
It's highly unlikely that that without active contributors from the
community this issue will get addressed directly by the vanishingly
small EMF team. It would make a great EMFT component.
</pre>
</blockquote>
<pre wrap=""><!---->
Well, it's make an even better component in the WTP Incubator! :)
But Ed's point is just as valid. It will take someone from the community several
months of full time work to put together all the pieces we have, which
we know is no volunteer-in-your-free-time sort of effort.
</pre>
</blockquote>
<br>
</body>
</html>
--------------060404030403070404040004--
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
| | |
Re: EMF Model Synchrinization with Multipage Editor (Tree based Editor and Text Editor) [message #612572 is a reply to message #102999] |
Fri, 16 November 2007 14:13 |
Ed Merks Messages: 33264 Registered: July 2009 |
Senior Member |
|
|
Vasanth,
I think so.
Vasanth Velusamy wrote:
> Given that a generated Source Editor cannot be expected in the
> immediate future, what would the best way for me to implement it
> myself? Earlier in this thread, Ed mentioned using IDocumentListener.
> Is that the way to go?
>
> Thanks,
> Vasanth
>
>
> David Williams wrote:
>> On Thu, 15 Nov 2007 18:33:53 -0500, Ed Merks <merks@ca.ibm.com> wrote:
>>
>>> Vasanth,
>>>
>>> It's highly unlikely that that without active contributors from the
>>> community this issue will get addressed directly by the vanishingly
>>> small EMF team. It would make a great EMFT component.
>>>
>>>
>>
>> Well, it's make an even better component in the WTP Incubator! :)
>> But Ed's point is just as valid. It will take someone from the
>> community several
>> months of full time work to put together all the pieces we have, which
>> we know is no volunteer-in-your-free-time sort of effort.
>>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Goto Forum:
Current Time: Sun Dec 22 06:18:54 GMT 2024
Powered by FUDForum. Page generated in 0.35027 seconds
|