Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Is this a bug about setFilter method in TableViewer?
Is this a bug about setFilter method in TableViewer? [message #721517] Thu, 01 September 2011 21:13 Go to next message
dean3514 is currently offline dean3514
Messages: 10
Registered: July 2011
Junior Member
Hello~! Thank you for your interest.
Sorry for my poor English.


I have some problem using setFilter in TableViewer.

Please see below code :

// Make Filter Code
filters = new ViewerFilter() {
public boolean select(Viewer viewer, Object parentElement, Object element) {
Test t = (Test)element;

switch(s){
case 1:

if (t.value) >= 80)
return true;
else
return false;


case 2:

if (t.value) >= 80)
return false;
else
return true;

default:
return true;
}
}

's' is just value for selection from option dialog.
it is to be 0, 1, 2 for filter. 0 is ALL. 1 is over 88, 2 is under 88.

When below code was executed, the result has some problem about refresh.

// Code
tableViewer.setFilters(filters);

When I select option for case 1 in dialog (over 88),
If data is only 1 and data has value 88, I can see 1 row in tableviewer. (it's good)

I select option for case 2 immediately (under 88),
I respect that I can see empty table.
But, 1 row is still displyaed in tableviewer.

When I try same action after I close view and reopen it, It works fine.
I can see empty table.

So, I guess that tableviewer has bug about refresh when setFilter result's size is 0.

Is this a bug? If not, how can I solve this problem?

Please advise me.

Thank for your kind answer.

Have a nice day.




(no subject) [message #721565 is a reply to message #721517] Fri, 02 September 2011 02:28 Go to previous messageGo to next message
Eclipse User
Originally posted by:

On 2011-09-02 03:13, dean3514 wrote:
> Hello~! Thank you for your interest.
> Sorry for my poor English.
>
>
> I have some problem using setFilter in TableViewer.
>
> Please see below code :
> // Make Filter Code
> filters = new ViewerFilter() {
> public boolean select(Viewer viewer, Object parentElement, Object
> element) {
> Test t = (Test)element;
>
> switch(s){
> case 1:
>
> if (t.value) >= 80)
> return true;
> else return false;
>
>
> case 2:
>
> if (t.value) >= 80)
> return false;
> else return true;
>
> default:
> return true;
> }
> }
>
> 's' is just value for selection from option dialog.
> it is to be 0, 1, 2 for filter. 0 is ALL. 1 is over 88, 2 is under 88.

This does not match with what your code says. It says that for s == 1
Test elements with the member value >= 80 are accepted and for s == 2
Test element with the member value < 80 are accepted.

> When below code was executed, the result has some problem about refresh.
>
> // Code tableViewer.setFilters(filters);
>
> When I select option for case 1 in dialog (over 88), If data is only 1

What is "data" in this context? Do you mean s?

> and data has value 88, I can see 1 row in tableviewer. (it's good)

Maybe, because you don't say anything about the data contents.

> I select option for case 2 immediately (under 88), I respect that I can
> see empty table.

Why? Is it, because you know, that there is Test element with value < 80?

> But, 1 row is still displyaed in tableviewer.

You did not explain what you think should trigger the refresh. How
should the TableViewer know that you have changed "s"? Do you have a
dialog for selecting the option? If so, what is your code doing after
closing the dialog? Do you call a refresh? When did you have your filter
set?

> When I try same action after I close view and reopen it, It works fine.
> I can see empty table.
>
> So, I guess that tableviewer has bug about refresh when setFilter
> result's size is 0.
>
> Is this a bug? If not, how can I solve this problem?

I cannot say, but I doubt it. Please provide a minimum example to
demonstrate the problem. I have not understood what you are actually doing.

Greetings from Bremen,

- Daniel Kr├╝gler
Re: Is this a bug about setFilter method in TableViewer? [message #722193 is a reply to message #721517] Sun, 04 September 2011 22:32 Go to previous message
dean3514 is currently offline dean3514
Messages: 10
Registered: July 2011
Junior Member
Thank you very much, sir!!

As I said before, my poor English is not enough to explain my problem to other person.

I am really sorry for that.

I made dialog for changing option 's'.
The dialog has radio button group which has 3 radio button.
(ALL, >= 80, < 80)
After I select option, it works find when I push "OK" button,

In case statement, I use same condition, but use different result.
It was checked in debug mode. It works normally when option is changed.

Therefore, I think that it's correct.

"Data" means object row that made from TEST class.
TEST class has only public "value" field.


Anyway, I say to you "Thank you very much and really sorry".
I found other code which reconstruct search result.
That code was made by other person, I could not find that easily.

I am really sorry for careless.

As you said, It is refresh problem. It's my mistake.

The setFilter method in tableViewer works well.


Thank you for your advice.

Have a nice day!!!
Previous Topic:Adding icons to standard menu contribution extensions
Next Topic:Help menu in RCP application not displaying
Goto Forum:
  


Current Time: Thu Jul 24 19:07:06 EDT 2014

Powered by FUDForum. Page generated in 0.02408 seconds