Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » implementing MVC on textviewers
implementing MVC on textviewers [message #302666] Thu, 27 April 2006 01:26 Go to next message
Eclipse UserFriend
i have used MVC with other viewer such as treeViewer, tableViewer.
They support contentProvider, labelProviders.

But i have seen textViewers mostly used inside textEditors and to provide
contents to textViewer, one just need to type there.

BUt is it not possible to have some model which will, through some adapter
inbetween (may be content provider for textViewer),writing on textViewer
after some events.

IS there API support for this?

-- mithun
Re: implementing MVC on textviewers [message #302750 is a reply to message #302666] Fri, 28 April 2006 01:46 Go to previous messageGo to next message
Eclipse UserFriend
It's annoying for me to see nobody answers this question about textViewers.
This is my third mail on this newsgroup about same problem.
I posted on this group because my question was on jFace.

If it is not possible to get answer to this question here,
please specify me some other newsgroup.

thank you.

-- mithun
Re: implementing MVC on textviewers [message #302754 is a reply to message #302666] Fri, 28 April 2006 03:05 Go to previous messageGo to next message
Eclipse UserFriend
mithun wrote:
> BUt is it not possible to have some model which will, through some
> adapter inbetween (may be content provider for textViewer),writing on
> textViewer after some events.

Mithun,

Text Viewers use IDocument as their text model; if you look at
ISourceViewer, you can see that in addition to IDocument it uses
IAnnotationModel to manage positional information.

So, you can simply modify your viewer's document to modify the text
displayed in the viewer.

-tom
Re: implementing MVC on textviewers [message #302767 is a reply to message #302754] Fri, 28 April 2006 10:17 Go to previous messageGo to next message
Eclipse UserFriend
Tom Eicher wrote:
> Text Viewers use IDocument as their text model; if you look at
> ISourceViewer, you can see that in addition to IDocument it uses
> IAnnotationModel to manage positional information.

> So, you can simply modify your viewer's document to modify the text
> displayed in the viewer.

> -tom

Thank you for your reply.

How to modify viewer's document? As i have seen there is only support for
writing totally new content to document by set method. replace method is
there but i think it only allows to change content set by set().

I want to append content already present.
So replace is only way to modify document?

-- mithun
Re: implementing MVC on textviewers [message #302769 is a reply to message #302767] Fri, 28 April 2006 10:41 Go to previous messageGo to next message
Eclipse UserFriend
mithun wrote:
> How to modify viewer's document? As i have seen there is only support
> for writing totally new content to document by set method. replace
> method is there but i think it only allows to change content set by set().
>
> I want to append content already present.
> So replace is only way to modify document?

Yes:

void append(IDocument doc, String s) {
doc.replace(doc.getLength(), 0, s);
}

-tom
Re: implementing MVC on textviewers [message #302799 is a reply to message #302769] Sat, 29 April 2006 06:33 Go to previous message
Eclipse UserFriend
Tom Eicher wrote:

> mithun wrote:
>> How to modify viewer's document? As i have seen there is only support
>> for writing totally new content to document by set method. replace
>> method is there but i think it only allows to change content set by set().
>>
>> I want to append content already present.
>> So replace is only way to modify document?

> Yes:

> void append(IDocument doc, String s) {
> doc.replace(doc.getLength(), 0, s);
> }

> -tom

Thanks for information, I can use this.

But i think that using replace method in this way doesnt match semantics
of replace. Working with treeviewer, tableviewer i can say that they form
part good MVC pattern with support model and contentproviders.

Then why such a difference with textviewer? As IDocument is supposed to
model for textviewer it should have support to plugin our content provider
which will automatically update viewer with changes in model.

Yes we can code that for our needs, But why this adapter support is not
their in textviewer?

-- mithun
Previous Topic:what's the memory view ?
Next Topic:Focus on hover info / one keyevent fired twice?
Goto Forum:
  


Current Time: Sat May 31 05:18:35 EDT 2025

Powered by FUDForum. Page generated in 0.03234 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top