Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Label/Content Provider for XML Editor's content outline?
Label/Content Provider for XML Editor's content outline? [message #203003] Wed, 24 October 2007 20:32 Go to next message
Eclipse UserFriend
Originally posted by: italdesign99.hotmail.com

I am looking for the code for the label and content providers for the xml
editor's content outline.

I found the JFaceNodeLabelProvider and JFaceNodeContentprovider, found in
org.eclipse.wst.xml.ui.internal.contentoutline, but they don't seem to be
parsing out Attribute Nodes from the DOM model when I try to use those
classes with MY editor.

However, the content outline view in WTP's xml editor does show attribute
nodes, and they seem to be displaying correctly.

My treeviewer, uses the JFaceNodeLabelProvider and
JFaceNodeContentprovider, however it doesn't recognize attribute nodes
from the DOM model.

Any ideas?

Thanks!
Re: Label/Content Provider for XML Editor's content outline? [message #203014 is a reply to message #203003] Wed, 24 October 2007 21:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: italdesign99.hotmail.com

Muneer wrote:

> I am looking for the code for the label and content providers for the xml
> editor's content outline.

> I found the JFaceNodeLabelProvider and JFaceNodeContentprovider, found in
> org.eclipse.wst.xml.ui.internal.contentoutline, but they don't seem to be
> parsing out Attribute Nodes from the DOM model when I try to use those
> classes with MY editor.

> However, the content outline view in WTP's xml editor does show attribute
> nodes, and they seem to be displaying correctly.

> My treeviewer, uses the JFaceNodeLabelProvider and
> JFaceNodeContentprovider, however it doesn't recognize attribute nodes
> from the DOM model.

> Any ideas?

> Thanks!


Here's some info on the model:

The following method is found in my editor which generates the model from
the xml input.

IStructuredModel, StructuredModelManager, FactoryRegistry, and
IStructuredDocument are in org.eclipse.wst.sse.core.

private void getModelFromInput(IEditorInput newInput) {

IStructuredModel model = null;
if (newInput != null && editor != null && mainDesignViewer != null) {
IDocument textDocument =
editor.getDocumentProvider().getDocument(newInput);
model =
StructuredModelManager.getModelManager().getModelForRead((IS tructuredDocument)textDocument);

if (model != null) {
/* Register the refresh factory */
FactoryRegistry factoryRegistry = model.getFactoryRegistry();
if (factoryRegistry.getFactoryFor(RefreshOnNotifyChangedAdapter .class)
== null) {
factoryRegistry.addFactory(new
RefreshOnNotifyChangedAdapterFactory(mainDesignViewer));
}
}

mainDesignViewer.setInput(model);
}
mainStructuredModel = model;
}


supplementary methods:


protected void setInput(IEditorInput newInput) {
releaseModel();

super.setInput(newInput);

if (editor != null) {
editor.setInput(newInput);
getModelFromInput(newInput);
}
}


private void releaseModel() {
if (mainStructuredModel != null) {
mainStructuredModel.releaseFromRead();
//mainStructuredModel.
}
}
Re: Label/Content Provider for XML Editor's content outline? [message #203040 is a reply to message #203003] Thu, 25 October 2007 05:22 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4434
Registered: July 2009
Senior Member

Muneer wrote:
> I am looking for the code for the label and content providers for the
> xml editor's content outline.
>
> I found the JFaceNodeLabelProvider and JFaceNodeContentprovider, found
> in org.eclipse.wst.xml.ui.internal.contentoutline, but they don't seem
> to be parsing out Attribute Nodes from the DOM model when I try to use
> those classes with MY editor.
>
> However, the content outline view in WTP's xml editor does show
> attribute nodes, and they seem to be displaying correctly.
> My treeviewer, uses the JFaceNodeLabelProvider and
> JFaceNodeContentprovider, however it doesn't recognize attribute nodes
> from the DOM model.

The outline's not showing attribute nodes in the tree, it is instead
including specific attribute names and values in the *label* for
elements. You're not missing any functionality by the sounds of it,
but if you want Attr Nodes to be their own tree items, you'll have
to extend or reuse the content provider in your own outline
configuration class (subclassing the
XMLContentOutlineConfiguration). Then you can assign that outline
configuration class to be used with your editor part ID or content
type ID as the target:

<extension point="org.eclipse.wst.sse.ui.editorConfiguration">
<contentOutlineConfiguration
class="MuneerContentOutlineConfiguration"
target="muneer" />
</extension>

--
Nitin Dahyabhai
Structured Source Editing


_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Label/Content Provider for XML Editor's content outline? [message #203081 is a reply to message #203040] Thu, 25 October 2007 20:51 Go to previous message
Eclipse UserFriend
Originally posted by: italdesign99.hotmail.com

> The outline's not showing attribute nodes in the tree, it is instead
> including specific attribute names and values in the *label* for
> elements. You're not missing any functionality by the sounds of it,
> but if you want Attr Nodes to be their own tree items, you'll have
> to extend or reuse the content provider in your own outline
> configuration class (subclassing the
> XMLContentOutlineConfiguration). Then you can assign that outline
> configuration class to be used with your editor part ID or content
> type ID as the target:

> <extension point="org.eclipse.wst.sse.ui.editorConfiguration">
> <contentOutlineConfiguration
> class="MuneerContentOutlineConfiguration"
> target="muneer" />
> </extension>

> --
> Nitin Dahyabhai
> Structured Source Editing


Thanks so much!

I looked at the AttributeShowingLabelProvider in the XMLConfiguration
class and in my own code, ended up taking the attribute nodes out of each
element node.
Previous Topic:J2EE module dependency on classes
Next Topic:unable to .wtpmodules file
Goto Forum:
  


Current Time: Fri Apr 19 15:06:40 GMT 2024

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

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

Back to the top