|
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 |
|
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 #225309 is a reply to message #225286] |
Tue, 16 December 2008 19:27 |
|
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
|
|
|
|
Powered by
FUDForum. Page generated in 0.03213 seconds