Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Re: 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 #180332] Sat, 30 September 2006 16:01 Go to previous message
Kamesh Sampath is currently offline 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
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:Eclipse 3.4 M2 and WTP 3.0 M2 Update Manager Issues
Next Topic:Creating EJB project from EAR
Goto Forum:
  


Current Time: Wed May 22 18:05:45 EDT 2013

Powered by FUDForum. Page generated in 0.07822 seconds