Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » swt: how to add to a TableViewer
swt: how to add to a TableViewer [message #145727] Fri, 17 October 2003 10:03 Go to next message
Eclipse UserFriend
Originally posted by: tcn.spamgourmet.com

Hi!

How do I dynamically add lines to a TableViewer? I don't have to setInput()
an array with all lines everytime I want to add one, do I?

Timo
Re: swt: how to add to a TableViewer [message #145991 is a reply to message #145727] Fri, 17 October 2003 16:26 Go to previous messageGo to next message
Eclipse UserFriend
> How do I dynamically add lines to a TableViewer? I don't have to setInput()
> an array with all lines everytime I want to add one, do I?

Nope.

// Where
private StructuredViewer viewer;

// and
private List content;

// and you've initially done
viewer.setInput(content);

// thereafter doing
content.add("stuff");

//followed by a refresh
Display.getDefault().syncExec(
new Runnable() {
public void run() {
viewer.refresh();
}
}
);

// should work.

HTH
Rich
Re: swt: how to add to a TableViewer [message #146113 is a reply to message #145991] Sat, 18 October 2003 04:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tcn.spamgourmet.com

rich boakes wrote:
> // and you've initially done
> viewer.setInput(content);
>
> // thereafter doing
> content.add("stuff");

And what's content? setInput() requires a plain Object (something I yet
don't understand by the way :), the wizard per default passes
REsourcesPlugin.getWorkspace() to setInput().
Re: swt: how to add to a TableViewer [message #146131 is a reply to message #146113] Sat, 18 October 2003 05:44 Go to previous messageGo to next message
Eclipse UserFriend
Timo Nentwig wrote:

> And what's content? setInput() requires a plain Object (something I yet
> don't understand by the way :), the wizard per default passes
> REsourcesPlugin.getWorkspace() to setInput().

Hi Timo,

Pass it a List of Objects that you want it to show (or a list of any
subclass of Object) - keep a reference to that List (hence the...

private List content;

in the earlier snippet) so that changing the content of "content"
(combined with the rest of the earlier bits) will change the content of
your table.

rich
Re: swt: how to add to a TableViewer [message #146141 is a reply to message #146131] Sat, 18 October 2003 05:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tcn.spamgourmet.com

rich boakes wrote:
> in the earlier snippet) so that changing the content of "content"
> (combined with the rest of the earlier bits) will change the content of
> your table.

But this makes either the entire table to be redrawn or the content list to
be iterated for changes each time.
Re: swt: how to add to a TableViewer [message #148684 is a reply to message #145727] Thu, 23 October 2003 14:14 Go to previous message
Eclipse UserFriend
Originally posted by: John_Arthorne.oti.com_

Use TableViewer.add(Object) to add items to your table. This is usually
done from your content provider, whose job is to keep your domain model
in sync with the viewer.
-

Timo Nentwig wrote:
> Hi!
>
> How do I dynamically add lines to a TableViewer? I don't have to setInput()
> an array with all lines everytime I want to add one, do I?
>
> Timo
Previous Topic:catching output and displaying in a progress dialog
Next Topic:classloading error after defining package prefixes
Goto Forum:
  


Current Time: Mon Sep 22 08:10:05 EDT 2025

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

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

Back to the top