[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.webtools] Re: StructuredModelManager

Klausing wrote:
I have a question concerning the StructuredTextViewer. I'm using it to display some piece of HTML. Since I only have the html in form of a String, I put it into an ByteArrayStream and use this stream to load the structured model. But I have to big problem.

1) Caching. The ModelManager seens to have some cache. How can I force it to reload the model?

I have used teh fllowing approach:

structuredModel = modelManager.getModelForEdit("xxx.xxx.xxx.xxx", inputStream, null);
modelManager.reinitialize(structuredModel);


But this does not solve the problem.

2) Internationalization. No matter how I convert the Stream (UTF-8, ...) chinse characters are broken every time. Does anybody know how to solve this issue?

For your usage you're better off calling IModelManager.createUnManagedStructuredModelFor(String) where the String is the HTML Content Type ID. From there you can just set your HTML into the document. It should help to avoid any encoding pitfalls. You can find a similar usage in the HTMLTemplatePreferencePage.


--
Nitin Dahyabhai
Structured Source Editing