Skip to main content



      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 08:34 Go to next message
Eclipse UserFriend
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 13:22 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: The Outline view and XML Editor are not kept in sync [message #225286 is a reply to message #225278] Tue, 16 December 2008 13:31 Go to previous messageGo to next message
Eclipse UserFriend
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 14:27 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: The Outline view and XML Editor are not kept in sync [message #225425 is a reply to message #225309] Thu, 18 December 2008 12:55 Go to previous message
Eclipse UserFriend
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: Tue Jul 08 12:07:33 EDT 2025

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

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

Back to the top