SourceViewer with StructuredTextViewerConfigurationXSL not editable [message #1277792] |
Wed, 26 March 2014 09:26  |
Eclipse User |
|
|
|
Hi,
I have a small test RCP application with one view containing one source viewer. On application load source viewer is shown on the view but it is not editable even though i have used the method setEditable(true) and when i close the rcp application i get folling messages on the console.
!ENTRY org.eclipse.ui 4 4 2014-03-26 14:20:02.081
!MESSAGE Invalid preference page path: XML Syntax
!ENTRY org.eclipse.ui 4 4 2014-03-26 14:20:02.088
!MESSAGE Invalid preference page path: XSLT Validation
Folling is the code used to create source viewer.
CompositeRuler ruler = new CompositeRuler();
LineNumberRulerColumn lnrc = new LineNumberRulerColumn(); lnrc.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_GRAY));
lnrc.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE));
ruler.addDecorator(0,lnrc);
SourceViewer viewer = new StructuredTextViewer(parent, ruler, null, true, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
((StructuredTextViewer) viewer).getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont"));
viewer.configure(new StructuredTextViewerConfigurationXSL());
viewer.setEditable(true);
Do you have any idea why source viewer is not editable?
Cheers
|
|
|
|
Re: SourceViewer with StructuredTextViewerConfigurationXSL not editable [message #1282732 is a reply to message #1277895] |
Wed, 02 April 2014 14:21  |
Eclipse User |
|
|
|
Ha, you beat me to it. You can find an example of this being done for the templates preference pages in WTP, e.g. org.eclipse.wst.xml.ui.internal.preferences.XMLTemplatePreferencePage.doCreateViewer(Composite, SourceViewerConfiguration) for the XML editor templates.
Also, be sure to call IStructuredModel.releaseFromEdit() when you're done--it's like a reference counted resource.
|
|
|
Powered by
FUDForum. Page generated in 0.04489 seconds