How to get hold of appropriate Document object for XML Content Assist ? [message #532138] |
Fri, 07 May 2010 06:06  |
Eclipse User |
|
|
|
Hi:
I am trying to embed StructuredTextViewer in a dialog for editing XML code. I am facing problems with getting content assist to work in a particular scenario - when the XML code in the dialog does not correspond to any external file. Getting hold of a proper document and model has been a problem in such a scenario.
Content assist would work fine only if a proper document is provided to StructuredTextViewer.
If I intend to edit a existing XML file in my dialog I can get hold of the appropriate document this way:
IStructuredModel scratchModel = StructuredModelManager.getModelManager() .getModelForEdit(ContentTypeIdForXML.ContentTypeID_XML,new FileInputStream(new File(<FILE PATH>)), null);
IDocument document = scratchModel.getStructuredDocument();
StructuredTextViewer structuredViewer = new StructuredTextViewer(composite, null, null, false, SWT.NONE);
StructuredTextViewerConfigurationXML sourceViewerConfiguration = new StructuredTextViewerConfigurationXML();
structuredViewer.configure(sourceViewerConfiguration);
structuredViewer.setDocument(document);
But the idea is to open up the dialog, take users input in form of XML and do further processing on the input XML - nowhere the input XML code is written to a file. How do I create a Document/Model for such a case so that contents assist works fine ?
Will appreciate any help on this!
Cheers,
Ankit
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04746 seconds