|
Re: StructuredModelManager [message #202928 is a reply to message #202898] |
Tue, 23 October 2007 17:59 |
|
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
_
Nitin Dahyabhai
Eclipse Web Tools Platform
|
|
|
|
Re: StructuredModelManager [message #203022 is a reply to message #202963] |
Wed, 24 October 2007 22:08 |
|
Yes, unmanaged models don't need to be released. You do, however,
need to take care to not otherwise leak them somehow.
--
Nitin Dahyabhai
Structured Source Editing
_
Nitin Dahyabhai
Eclipse Web Tools Platform
|
|
|
|
Re: StructuredModelManager [message #203378 is a reply to message #203346] |
Tue, 30 October 2007 17:01 |
|
Klaus Schaefers wrote:
> Hi, I have changed to way the model is handled now in the way you
> suggested. This works fine, but now the html content assitant fails Here
> is the stacktrace. What have I done wrong.
>
>
> java.lang.IllegalStateException: problem getting model
> at
> org.eclipse.wst.xml.ui.internal.contentassist.AbstractConten tAssistProcessor.computeCompletionProposals(AbstractContentA ssistProcessor.java:1283)
Nothing, content assist requires a managed model so it can go from
the source viewer's document to that model.
--
Nitin Dahyabhai
Structured Source Editing
_
Nitin Dahyabhai
Eclipse Web Tools Platform
|
|
|
Re: StructuredModelManager [message #203418 is a reply to message #203378] |
Thu, 01 November 2007 05:56 |
|
Nitin Dahyabhai wrote:
> Klaus Schaefers wrote:
>> Hi, I have changed to way the model is handled now in the way you
>> suggested. This works fine, but now the html content assitant fails
>> Here is the stacktrace. What have I done wrong.
>>
>>
>> java.lang.IllegalStateException: problem getting model
>> at
>> org.eclipse.wst.xml.ui.internal.contentassist.AbstractConten tAssistProcessor.computeCompletionProposals(AbstractContentA ssistProcessor.java:1283)
>
>
> Nothing, content assist requires a managed model so it can go from the
> source viewer's document to that model.
Just to followup on this, you'd want to go back to the original
method you posted about since the model is shared in that case.
You can try using IStructuredModel.reload(InputStream), or just set
the text into the document as indicated previously.
--
Nitin Dahyabhai
Structured Source Editing
_
Nitin Dahyabhai
Eclipse Web Tools Platform
|
|
|
Powered by
FUDForum. Page generated in 0.03172 seconds