Textfield with Xml-Syntax Highlighting [message #154067] |
Fri, 26 May 2006 01:34  |
Eclipse User |
|
|
|
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? (OR: is there another way to highlight
Xml-Syntax ???)
thanks in advance!
florian
|
|
|
Re: Textfield with Xml-Syntax Highlighting [message #154100 is a reply to message #154067] |
Fri, 26 May 2006 05:13  |
Eclipse User |
|
|
|
Florian Schöllhammer wrote:
>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:
>
>
It looks like you're using WTP. You'd better ask on eclipse.webtools
Dani
>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? (OR: is there another way to highlight
>Xml-Syntax ???)
>
>thanks in advance!
>florian
>
>
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.08993 seconds