[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: TableViewer.setSelection() -> update/redraw/layout table

Marcel Hoetter schrieb:
Hi!

while experimenting with JFace, i extended the TableViewer class and overrode the remove() method like this (this is only for demonstration purposes):


Good because we clearly state that we won't support subclassing :-)

public void remove(Object[] elements) {
        super.remove(elements);
        setSelection(new StructuredSelection(getElementAt(0)),true);
}


Code looks ok. Can you by chance modify one of our snippets [1] and attach it so that I can reproduce and fix the bug if there's one though only removing a node from a viewer is not enough you'll also have to remove it from the underlying input because when ever a refresh() is done the node is added back.


The problem i found here is that the new selection is not shown immediatly. Instead, i have to click in the table or resize the table-window.

I already tried the following (didn't help, though):

getTable().layout(true, true);
getTable().getShell().layout(true, true);
refresh(true);

A dirty hack did help:
ViewerComparator comp = getComparator();
setComparator(null);
setComparator(comp);

But obviously, this is not a nice solution.

What am i doing wrong?

Well we simply need a snippet to reproduce the problem.

Tom

[1] http://wiki.eclipse.org/JFaceSnippets