Community
Participate
Working Groups
In the doc of org.eclipse.jface.viewers.TableViewer.remove(Object element) you read this note "removing an object from a virtual table will decrement the itemCount" but in the following sample code this doesn't work System.out.println("Item Count before delete: "+ viewer.getTable().getItemCount()); ... code to remove the item from my model viewer.remove(obj); viewer.refresh(); System.out.println("Item Count after delete: "+ viewer.getTable().getItemCount()); I've downloaded eclipse-SDK-N20060709-0010-win32.zip.
(In reply to comment #0) > In the doc of org.eclipse.jface.viewers.TableViewer.remove(Object element) > you read this note > "removing an object from a virtual table will decrement the itemCount" > but in the following sample code this doesn't work > System.out.println("Item Count before delete: "+ > viewer.getTable().getItemCount()); > ... code to remove the item from my model > viewer.remove(obj); > viewer.refresh(); > System.out.println("Item Count after delete: "+ > viewer.getTable().getItemCount()); > I've downloaded eclipse-SDK-N20060709-0010-win32.zip. Then I tried to set itemcount manually. Consider now a model with one element and the following code ... code to remove the item from my model viewer.remove(selection.toArray()); viewer.setItemCount(itemCount); //in this case itemcount=0 viewer.refresh(); A call to updateElement(0) is generated but element 0 has just been removed from my model so I have error. I tried then ... code to remove the item from my model viewer.setItemCount(itemCount); //in this case itemcount=0 viewer.remove(selection.toArray()); viewer.refresh(); But the setItemCount disposes the widget and the remove fails. Then I replaced viewer.remove with viewer.getTable().remove and it works, now I deleted viewer.getTable().remove and it works the same, maybe by the viewer.refresh. So with virtual tables is it better to don't use the viewer.remove?
This is a bug (see also bug 97786 for another problem with viewer.remove()).
(In reply to comment #2) > This is a bug (see also bug 97786 for another problem with viewer.remove()). Now I used ... code to remove the item from my model viewer.setItemCount(newitemCount); viewer.refresh(); Consider a simple case: one item to remove (newitemCount=itemCount-1) item 0 - selected item 1 item 2 If I remove item 0, I have: item 0 ex item 1 item 1 ex item 2 - selected If I remove Item 0, I think that the next item should be selected. The next item is item 1, but without item 0, item 1 become item 0, so the selection shouldn't change at all. So I manually set the desidered selection with viewer.getTable().setSelection(nextSelectedIndex), but now I submit the bug 153669.
I hope we can get to this in 3.4. In 3.3, I ended up spending so much time on the virtual tree (which is used by Debug) that I never got to look at virtual tables.
Mass update - removing 3.4 target. This was one of the bugs I marked for investigation (and potential fixing) in 3.4 but I ran out of time. Please ping on the bug if fixing it would be really important for 3.4, and does not require API changes or feature work.
Hitesh is now responsible for watching bugs in the [Viewers] component area.
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.