Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Listen to changes in position of TreeItem
Listen to changes in position of TreeItem [message #442893] Tue, 14 September 2004 16:46 Go to next message
Eclipse UserFriend
Originally posted by: roman.korf.web.de

I implement a viewpart with a treeviewer and another graphical viewer from
GEF.

I want to get notified when the position of an item in the tree was
changed, e.g. when expanding another item.

How can I do this? I tried the listener for the TreeItem but it did not
work. I don't get any event fired.

Any ideas?


Thanks
Roman
Re: Listen to changes in position of TreeItem [message #442901 is a reply to message #442893] Tue, 14 September 2004 20:51 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
You can get notified of when items are expanded in a tree by calling
Tree.addTreeListener().

"Roman Korf" <roman.korf@web.de> wrote in message
news:ci7793$63t$1@eclipse.org...
>I implement a viewpart with a treeviewer and another graphical viewer from
> GEF.
>
> I want to get notified when the position of an item in the tree was
> changed, e.g. when expanding another item.
>
> How can I do this? I tried the listener for the TreeItem but it did not
> work. I don't get any event fired.
>
> Any ideas?
>
>
> Thanks
> Roman
>
Re: Listen to changes in position of TreeItem [message #442911 is a reply to message #442901] Wed, 15 September 2004 07:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: roman.korf.web.de

Thanks for the quick answer.

The problem with this is that the notification comes before the tree is
actually updated. I need to be notidfied when the tree was updated.

Let me explain a bit better:

I have a treeviewer and a second viewer. The second viewer should update
its content according to the tree items in the tree. Lets say the user
expands an item then the items below this item will move down in the tree.
According to this I want to update my other view. This view actually
contains nodes which should be at the same position as the items in the
tree.

When listening to the tree as you supposed (Tree.addTreeListener()) I will
get notified before the tree item expands. Therefore I can not update the
positions of the nodes in the second view since the tree items have not
been updated at this state.

Anyone any other suggestions?

Thanks
Roman

Veronika Irvine wrote:

> You can get notified of when items are expanded in a tree by calling
> Tree.addTreeListener().

> "Roman Korf" <roman.korf@web.de> wrote in message
> news:ci7793$63t$1@eclipse.org...
> >I implement a viewpart with a treeviewer and another graphical viewer from
> > GEF.
> >
> > I want to get notified when the position of an item in the tree was
> > changed, e.g. when expanding another item.
> >
> > How can I do this? I tried the listener for the TreeItem but it did not
> > work. I don't get any event fired.
> >
> > Any ideas?
> >
> >
> > Thanks
> > Roman
> >
Re: Listen to changes in position of TreeItem [message #442916 is a reply to message #442911] Wed, 15 September 2004 11:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: roman.korf.web.de

I think I solved the problem.

To do some work after the tree actually has been updated someone has to
call the bit of work in an:

Display.getCurrent().asyncExec(new Runnable() {
public void run() {
List mappings = mappingManager.getMappings();
for(int i = 0; i < mappings.size(); i++)
addMapping((IMapping)mappings.get(i));
}
});

Roman Korf wrote:

> Thanks for the quick answer.

> The problem with this is that the notification comes before the tree is
> actually updated. I need to be notidfied when the tree was updated.

> Let me explain a bit better:

> I have a treeviewer and a second viewer. The second viewer should update
> its content according to the tree items in the tree. Lets say the user
> expands an item then the items below this item will move down in the tree.
> According to this I want to update my other view. This view actually
> contains nodes which should be at the same position as the items in the
> tree.

> When listening to the tree as you supposed (Tree.addTreeListener()) I will
> get notified before the tree item expands. Therefore I can not update the
> positions of the nodes in the second view since the tree items have not
> been updated at this state.

> Anyone any other suggestions?

> Thanks
> Roman

> Veronika Irvine wrote:

> > You can get notified of when items are expanded in a tree by calling
> > Tree.addTreeListener().

> > "Roman Korf" <roman.korf@web.de> wrote in message
> > news:ci7793$63t$1@eclipse.org...
> > >I implement a viewpart with a treeviewer and another graphical viewer from
> > > GEF.
> > >
> > > I want to get notified when the position of an item in the tree was
> > > changed, e.g. when expanding another item.
> > >
> > > How can I do this? I tried the listener for the TreeItem but it did not
> > > work. I don't get any event fired.
> > >
> > > Any ideas?
> > >
> > >
> > > Thanks
> > > Roman
> > >
Re: Listen to changes in position of TreeItem [message #442917 is a reply to message #442911] Wed, 15 September 2004 11:58 Go to previous message
Eclipse UserFriend
Originally posted by: roman.korf.web.de

I think I solved the problem.

To do some work after the tree actually has been updated someone has to
call the bit of work in an:

Display.getCurrent().asyncExec(new Runnable() {
public void run() {
// do the work here
}
});

Roman Korf wrote:

> Thanks for the quick answer.

> The problem with this is that the notification comes before the tree is
> actually updated. I need to be notidfied when the tree was updated.

> Let me explain a bit better:

> I have a treeviewer and a second viewer. The second viewer should update
> its content according to the tree items in the tree. Lets say the user
> expands an item then the items below this item will move down in the tree.
> According to this I want to update my other view. This view actually
> contains nodes which should be at the same position as the items in the
> tree.

> When listening to the tree as you supposed (Tree.addTreeListener()) I will
> get notified before the tree item expands. Therefore I can not update the
> positions of the nodes in the second view since the tree items have not
> been updated at this state.

> Anyone any other suggestions?

> Thanks
> Roman

> Veronika Irvine wrote:

> > You can get notified of when items are expanded in a tree by calling
> > Tree.addTreeListener().

> > "Roman Korf" <roman.korf@web.de> wrote in message
> > news:ci7793$63t$1@eclipse.org...
> > >I implement a viewpart with a treeviewer and another graphical viewer from
> > > GEF.
> > >
> > > I want to get notified when the position of an item in the tree was
> > > changed, e.g. when expanding another item.
> > >
> > > How can I do this? I tried the listener for the TreeItem but it did not
> > > work. I don't get any event fired.
> > >
> > > Any ideas?
> > >
> > >
> > > Thanks
> > > Roman
> > >
Previous Topic:TableTree inside an Eclipse Forms section
Next Topic:How to CUT files to clipboard and paste them
Goto Forum:
  


Current Time: Fri Apr 26 22:31:35 GMT 2024

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

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

Back to the top