Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » The Outline view and XML Editor are not kept in sync
The Outline view and XML Editor are not kept in sync [message #225268] Tue, 16 December 2008 13:34 Go to next message
Jawher Moussa is currently offline Jawher MoussaFriend
Messages: 10
Registered: July 2009
Junior Member
Hello,
In order to simplify the editing of a particular XML format, I've
created an EditorConfiguration by extending the
StructuredTextViewerConfigurationXML, and providing my custom
ContentAssist processors.

I've also added an OutlineConfiguration (by extending
XMLContentOutlineConfiguration).

But I've noticed that the Outline view does not remain in sync with hte
XML editor (after editing the XML).

I've managed to fix this by adding a ModelStateListenr to the IDOMModel
(through addModelStateListener) from the OutlineContentProvider and
refreshing the viewer when IModelStateListener.modelChanged is fired.

But I was wondering if this might be a bug ? Or if not is the workaround
I described the correct one ?

Thanks.
Re: The Outline view and XML Editor are not kept in sync [message #225278 is a reply to message #225268] Tue, 16 December 2008 18:22 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4434
Registered: July 2009
Senior Member

Jawher Moussa wrote:
> I've also added an OutlineConfiguration (by extending
> XMLContentOutlineConfiguration).
>
> But I've noticed that the Outline view does not remain in sync with hte
> XML editor (after editing the XML).
>
> I've managed to fix this by adding a ModelStateListenr to the IDOMModel
> (through addModelStateListener) from the OutlineContentProvider and
> refreshing the viewer when IModelStateListener.modelChanged is fired.
>
> But I was wondering if this might be a bug ? Or if not is the
> workaround I described the correct one ?

First thing to do is double check which methods you've overridden in
your outline configuration, as well as if you've replaced the
content or label providers. The default content and label providers
rely on the IJFaceNodeAdapters, and they're ultimately responsible
for updating the content viewer. Replacing the provider entirely
would remove this update notification.

--
---
Nitin Dahyabhai
Eclipse WTP Source Editing
IBM Rational


_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: The Outline view and XML Editor are not kept in sync [message #225286 is a reply to message #225278] Tue, 16 December 2008 18:31 Go to previous messageGo to next message
Jawher Moussa is currently offline Jawher MoussaFriend
Messages: 10
Registered: July 2009
Junior Member
Hi and thanks for the reply.

Yes, I've indeed provided my own label and content providers (by
overriding the corresponding methods).

So in this case, is using a ModelStateListener and refreshing the viewer
on modelChange the correct way to keeping the editor and outline in sync ?

Cheers.
Re: The Outline view and XML Editor are not kept in sync [message #225309 is a reply to message #225286] Tue, 16 December 2008 19:27 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4434
Registered: July 2009
Senior Member

Jawher Moussa wrote:
> Hi and thanks for the reply.
>
> Yes, I've indeed provided my own label and content providers (by
> overriding the corresponding methods).
>
> So in this case, is using a ModelStateListener and refreshing the viewer
> on modelChange the correct way to keeping the editor and outline in sync ?

It would work, but the mechanism of using an adapter that's
listening for changes lets us refresh just the section of the DOM
that's been changed ().

You should look at
org.eclipse.wst.xml.ui.internal.contentoutline.JFaceNodeCont entProvider.inputChanged(Viewer,
Object, Object) for an example of how to install your own adapter
factory when the viewer input is changed, and then create an adapter
of your own to do the same. Your adapter wouldn't have to handle
the content and label provider responsibilities, but please don't
replace the existing IJFaceNodeAdapter and factory as they are
required to keep the Design page up to date in the same way.

--
---
Nitin Dahyabhai
Eclipse WTP Source Editing
IBM Rational


_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: The Outline view and XML Editor are not kept in sync [message #225425 is a reply to message #225309] Thu, 18 December 2008 17:55 Go to previous message
Jawher Moussa is currently offline Jawher MoussaFriend
Messages: 10
Registered: July 2009
Junior Member
Okey, thanks a lot Nitin for the help.
I'm using a JFaceNodeAdapter now (as in the CheatSheet Editor example
editor) and I got it to work (with some tweaking).

Still, there is a problem : deleting an element from the outline viw
(right clic, remove) rcorrectly updates the XML editor, but not the
outline view.

I'll try to dig further into it.

Thanks again :)
Previous Topic:about "org.eclipse.jst.pagedesigner.jsp.core.pageVar" extension point
Next Topic:Can't get the XML editor to work
Goto Forum:
  


Current Time: Fri Apr 19 19:39:01 GMT 2024

Powered by FUDForum. Page generated in 0.03213 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top