Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Changing labels in TreeViewer on node expansion/collapse
icon5.gif  Changing labels in TreeViewer on node expansion/collapse [message #543682] Wed, 30 June 2010 09:45
Alexey Romanov is currently offline Alexey RomanovFriend
Messages: 263
Registered: May 2010
Senior Member
I have a TreeViewer where some nodes represent folders, so I wanted to show the icon of an open folder when the node is expanded and a closed folder when it is collapsed. Sounds easy, I just need to add a tree listener (the code is in Scala, but Java equivalent should be easy to imagine):
  val tree = new TreeViewer(contents)

  private def folderIconFixingListener = new ITreeViewerListener {
    def treeCollapsed(event: TreeExpansionEvent) {
      tree.update(event.getElement, null)

    def treeExpanded(event: TreeExpansionEvent) {
      tree.update(event.getElement, null)      

Unfortunately, this gives me an exception:
Ignored reentrant call while viewer is busy. This is only logged once per viewer instance, but similar calls will still be ignored.
	at org.eclipse.jface.viewers.ColumnViewer.checkBusy(
	at org.eclipse.jface.viewers.ColumnViewer.update(
	at scsadmin.NodesTreeScreen$$anon$1.treeExpanded(NodesTreeScreen.scala:64)
	at org.eclipse.jface.viewers.AbstractTreeViewer$
	at org.eclipse.jface.util.SafeRunnable$
	at org.eclipse.jface.viewers.AbstractTreeViewer.fireTreeExpanded(
	at org.eclipse.jface.viewers.AbstractTreeViewer.handleTreeExpand(
	at org.eclipse.jface.viewers.TreeViewer.handleTreeExpand(
	at org.eclipse.jface.viewers.AbstractTreeViewer$4.treeExpanded(
	at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
	at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
	at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
	at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
	at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
	at org.eclipse.swt.widgets.Tree.gtk_test_expand_row(Unknown Source)
	at org.eclipse.swt.widgets.Widget.windowProc(Unknown Source)
	at org.eclipse.swt.widgets.Display.windowProc(Unknown Source)
	at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method)
	at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(Unknown Source)
	at org.eclipse.swt.widgets.Display.eventProc(Unknown Source)
	at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method)
	at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(Unknown Source)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
	at org.eclipse.jface.window.Window.runEventLoop(
	at scsadmin.BootStrapper$.main(BootStrapper.scala:64)
	at scsadmin.BootStrapper.main(BootStrapper.scala)

How can I fix this?

Asked on StackOverflow as well.

[Updated on: Wed, 30 June 2010 09:52]

Report message to a moderator

Previous Topic:multiple selection widget ("FilteredCheckBoxTreeViewer")
Next Topic:Setting a child of SashForm to a desired size
Goto Forum:

Current Time: Tue Apr 24 07:11:29 GMT 2018

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

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