[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: TableTreeItem and setData() -method

The storing of the TableTreeItem in the data field of the associated
TableItem is an implementation detail which you can not rely on.

> - is this the way the 'data' should be fetched nowadays ?
Both getData() and getData(String) have existed since 1.0  - the
getData(String) is a better choice because you can ensure that your use of
the data field does not collide with someone else.

> - are these kind of changes documented somewhere (elsewhere than in the
source code) ?
No.  This is an implementation detail that you should not have been relying
on.  It is quite posible that the use of "setData/getData" for mapping from
TableItem to TableTreeItem could be replaced by an internal private field in
the future and the data should be treated as such.

> - is Eclipse going to support using of own images in the first column in
the TableTrees ?
See the project plan item regarding an enhanced Table widget (Provide
improved table and table tree widgets).


"JR" <juha.rajakari@xxxxxxxxxxxxxxx> wrote in message
news:baa8ss$plh$1@xxxxxxxxxxxxxxxx
> Hi,
>
> I have pondered several days why my ExtendedTableTreeViewer does not work
> under Eclipse 2.1.0,
> although it worked well under 2.0.2.
>
> This ExtendedTableTreeViewer extends the usual TableTreeViewer providing
> extra support for using own images
> in the first column (besides [+] and [-] images). It contains also an
inner
> class (ExtendedTableTreeItem)
> which extends the usual TableTreeItem.
>
> The problem came out when I tried to fetch the 'data' for the tableItem:
>
> ExtendedTableTreeItem extendedTableTreeItem =
> (ExtendedTableTreeItem)tableItem.getData();
>
> which returned 'null' under 2.1.0, but worked under 2.0.2.
>
> After looking at the Eclipse 2.1.0 source codes I found out that
> TableTreeItem stores the 'data'
> in its constructor using a key (TableTree.ITEMID = "TableTreeItemID") :
>
>  tableItem.setData(TableTree.ITEMID, this);
>
> whereas in 2.0.2 it did it with
>
>  tableItem.setData(this);
>
> This change meant that I also had to change my code like this:
>
> ExtendedTableTreeItem extendedTableTreeItem =
> (ExtendedTableTreeItem)tableItem.getData("TableTreeItemID");
>
> in order to get it working.
>
> My questions are:
> - is this the way the 'data' should be fetched nowadays ?
> - are these kind of changes documented somewhere (elsewhere than in the
> source code) ?
> - is Eclipse going to support using of own images in the first column in
the
> TableTrees ?
>
> Regards,
> Juha
>
>