Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » treeview with different classes
treeview with different classes [message #216934] Wed, 20 June 2007 08:31 Go to next message
Eclipse UserFriend
Originally posted by: karl.lindsten.com

Trying too biuld a treeview and its okej when its only one class in the
hiraky. But the thing is that the children is of another classtype and
this cant my labelProvider handle. Someone know a solution?

public class ProfilerDataListLabelProvider extends LabelProvider{

public String getText(Object elem){
System.out.println("get text");

classOne c1 = (classOne) elem;

// should also be able to handle this of elem = classTwo
// classTwo c2 = (classTwo) elem;


return profilerData.date;
}
}
Re: treeview with different classes [message #216977 is a reply to message #216934] Wed, 20 June 2007 10:30 Go to previous message
Eclipse UserFriend
Originally posted by: nugaee.SPAMtlen.pl

karl wrote:
> Trying too biuld a treeview and its okej when its only one class in the
> hiraky. But the thing is that the children is of another classtype and
> this cant my labelProvider handle. Someone know a solution?
>
> public class ProfilerDataListLabelProvider extends LabelProvider{
>
> public String getText(Object elem){
> System.out.println("get text");
>
> classOne c1 = (classOne) elem;
> // should also be able to handle this of elem = classTwo
> // classTwo c2 = (classTwo) elem;
>
>
> return profilerData.date;
> }
> }
>

public String getText(Object item) {
if(item instanceof Sth) {
...
} else if(item instanceof SthElse) {
...
} else {
return item.toString();
}

}

you can also use adapters but i don't know if this is suitable for your
purpose

best regards
bartek michalik
Previous Topic:CDT-problems using Solaris
Next Topic:Accessing the Oracle source for BIRT Report Design.
Goto Forum:
  


Current Time: Tue Apr 23 11:17:33 GMT 2024

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

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

Back to the top