Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » SourceViewer with StructuredTextViewerConfigurationXML - Exception
SourceViewer with StructuredTextViewerConfigurationXML - Exception [message #170025] Wed, 24 May 2006 12:04 Go to next message
Eclipse UserFriend
Originally posted by: sparky.flo.com

hy!

currently, i am developing my first application with the eclipse-api. so
far, everything worked fine, but now i have a problem, i could not solve on
my own:

i have a SourceViewer and i want to show xml-content. i would like the
content to be syntax highlighted, so i searched the web and found the
StructuredTextViewerConfigurationXml

i tried to do something like that:


this.view_xml = new SourceViewer(this.shell, null, SWT.BORDER);
this.view_xml.setEditable(false);
this.view_xml.setDocument(new Document(xml_content));

StructuredTextViewerConfigurationXML conf = new
StructuredTextViewerConfigurationXML();
this.view_xml.configure(conf);


i tried it in two ways:
--- application as an applet ---

whenever i create an instance of StructuredTextViewerConfigurationXML,
it throws a null-pointer exception (in the constructor).

Exception in thread "main" java.lang.NullPointerException
at
org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration.cre ateCombinedPreferenceStore(StructuredTextViewerConfiguration .java:96)
at
org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration.<init >(StructuredTextViewerConfiguration.java:86)
at
org.eclipse.wst.xml.ui.StructuredTextViewerConfigurationXML. <init>(StructuredTextViewerConfigurationXML.java:78)


--- application as an eclipse plugin ---

I am able to create an instance, but if i try to configure my source-viewer,
it throws an exception

java.lang.ClassCastException: org.eclipse.jface.text.source.SourceViewer
at
org.eclipse.wst.sse.ui.StructuredTextViewerUndoManager.conne ct(StructuredTextViewerUndoManager.java:73)
at org.eclipse.jface.text.TextViewer.activatePlugins(TextViewer .java:1525)
at
org.eclipse.jface.text.source.SourceViewer.activatePlugins(S ourceViewer.java:414)
at
org.eclipse.jface.text.source.SourceViewer.configure(SourceV iewer.java:385)


i should work both ways: as plugin as well as an applet ...
can anybody help me with that?

thanks in advance!
florian
Re: SourceViewer with StructuredTextViewerConfigurationXML - Exception [message #171280 is a reply to message #170025] Thu, 15 June 2006 07:49 Go to previous message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4435
Registered: July 2009
Senior Member

The StructuredTextViewerConfiguration* classes expect only to be
used with the SSE StructuredTextViewer, and that in turn with an
IStructuredDocument. Without all 3 in place, you're likely to
continue running into odd exceptions along the way. We haven't
placed much focus in allowing what you seem to be attempting (hence
the viewer class remaining internal), so your mileage may vary.

--
- Nitin


_
Nitin Dahyabhai
Eclipse Web Tools Platform
Previous Topic:EMF2DOMSSE Adapter does get proper notifications
Next Topic:Rough idea for JSP code completion?
Goto Forum:
  


Current Time: Fri Apr 26 14:08:16 GMT 2024

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

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

Back to the top