Bug 144406 - [Viewers] Virtual TableViewer cache is not cleaned-up when removing items
Summary: [Viewers] Virtual TableViewer cache is not cleaned-up when removing items
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2   Edit
Hardware: PC All
: P3 major with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard: stalebug haspatch
Keywords:
Depends on:
Blocks: 154755
  Show dependency tree
 
Reported: 2006-05-30 06:13 EDT by Thomas Schindl CLA
Modified: 2021-09-14 14:12 EDT (History)
3 users (show)

See Also:


Attachments
Fixes clean up of cache when items removed from viewer (1.56 KB, patch)
2006-05-30 07:29 EDT, Thomas Schindl CLA
no flags Details | Diff
This also fixes problems with insert (2.57 KB, patch)
2006-05-30 08:01 EDT, Thomas Schindl CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Schindl CLA 2006-05-30 06:13:50 EDT
When adding new items after having removed all others you'll run into an exception because when removing items the cache-size is not reduced:
--------------------8<--------------------
Shell shell=new Shell(Display.getCurrent());
    shell.setLayout(new FillLayout());
        
    final TableViewer table=new TableViewer(shell,SWT.VIRTUAL);
    final Object item="item1";
    final Object item2="item2";
    final Object item3="item3";
    final Object item4="item3";

    table.add(item);
    table.add(item2);
    table.add(item3);
    
    Button b = new Button(shell,SWT.PUSH);
    b.addSelectionListener(new SelectionListener() {

		public void widgetDefaultSelected(SelectionEvent arg0) {
			
		}

		public void widgetSelected(SelectionEvent arg0) {
			table.remove(item);
			table.remove(item2);
			table.remove(item3);
		}
    	
    });
    b.setText("Remove");
    
    b = new Button(shell,SWT.PUSH);
    b.addSelectionListener(new SelectionListener() {

		public void widgetDefaultSelected(SelectionEvent arg0) {
			
		}

		public void widgetSelected(SelectionEvent arg0) {
			 table.add(item);
			 table.add(item2);
			 table.add(item3);
			 table.add(item4);
		}
    	
    });
    b.setText("Add");
    
    shell.setVisible(true);

    
    
    while(!shell.isDisposed())
    {
      shell.getDisplay().readAndDispatch();
    }
--------------------8<--------------------
Comment 1 Thomas Schindl CLA 2006-05-30 06:31:39 EDT
If I'm not completely mistaken the cache can not work the way it is implemented for now. it will also fail when calling insert(Object element, int position). I ask myself if it wouldn't be wiser to use an arraylist?
Comment 2 Thomas Schindl CLA 2006-05-30 07:29:10 EDT
Created attachment 42939 [details]
Fixes clean up of cache when items removed from viewer

This patch fixes the first problem with virtual-tables because it syncs the cache with the table
Comment 3 Thomas Schindl CLA 2006-05-30 08:01:42 EDT
Created attachment 42943 [details]
This also fixes problems with insert

I'm sure there's a better solution but its working ;-)
Comment 4 Boris Bokowski CLA 2006-05-30 08:49:07 EDT
3.2.1 candidate. Thanks Tom!
Comment 5 Thomas Schindl CLA 2006-05-31 11:30:31 EDT
Well Boris, I think the provided patch is nonsense because it doesn't work when using a ILazyContentProvider. I'll think I need to bang my head against this once more.

(In reply to comment #4)
> 3.2.1 candidate. Thanks Tom!
> 

Comment 6 Tod Creasey CLA 2006-08-16 13:06:59 EDT
Boris if you are not planning to address this for 3.2.1 you should remove the tag. The release candidates start next week.
Comment 7 Boris Bokowski CLA 2006-08-22 16:52:04 EDT
I will attach a patch to bug 154755 but leave this one open to track the particular issue reported here.  Note that the patch attached to this bugzilla has a bug in the remove case.

Unfortunately, there are just too many changes required to fix the problems with VIRTUAL TableViewer so we have to move this to 3.3.
Comment 8 Boris Bokowski CLA 2007-05-28 23:27:50 EDT
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.
Comment 9 Boris Bokowski CLA 2008-05-21 12:44:00 EDT
Tom, are you still interested in this?
Comment 10 Thomas Schindl CLA 2008-05-21 13:14:05 EDT
yes move it over to me
Comment 11 Thomas Schindl CLA 2010-01-28 17:11:35 EST
multi change because of intenion of stepping back as platform-ui committer
Comment 12 Eclipse Webmaster CLA 2019-09-06 16:11:27 EDT
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.
Comment 13 Eclipse Genie CLA 2021-09-14 14:12:59 EDT
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.