[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.webtools] Re: Label/Content Provider for XML Editor's content outline?

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((IStructuredDocument)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. } }