Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » FilteredItemsSelectionDialog - refreshing content provider
FilteredItemsSelectionDialog - refreshing content provider [message #328955] Sun, 08 June 2008 10:11 Go to next message
Eclipse User
Originally posted by: fraserofthenight.gmail.com

Hi all,

I have a filtered content selection dialog, and in the extended content
area I have a checkbox that adds an extra filter. I added a selection
listener to the checkbox so that whenever the user selects/deselects it,
I want the dialog to empty its content and re-call
fillContentProvider(). However, I can't seem to make it do this (I've
tried refesh(), scheduleRefresh() and reloadCache()).

Is there any way to force the dialog to call fillContentProvider().
Short of that, I can't even seem to make it call matches() on every
item, so is there a way to force it to do that and re-match the items?

Thanks,
Robert
Re: FilteredItemsSelectionDialog - refreshing content provider [message #328966 is a reply to message #328955] Mon, 09 June 2008 13:19 Go to previous messageGo to next message
Eclipse User
Originally posted by: eclipse-news.rizzoweb.com

Robert Fraser wrote:
> Hi all,
>
> I have a filtered content selection dialog, and in the extended content
> area I have a checkbox that adds an extra filter. I added a selection
> listener to the checkbox so that whenever the user selects/deselects it,
> I want the dialog to empty its content and re-call
> fillContentProvider(). However, I can't seem to make it do this (I've
> tried refesh(), scheduleRefresh() and reloadCache()).
>
> Is there any way to force the dialog to call fillContentProvider().
> Short of that, I can't even seem to make it call matches() on every
> item, so is there a way to force it to do that and re-match the items?

Have you tried calling applyFilter()? In order for that to work, the new
filter will have to be different from the previous one.

Hope this helps,
Eric
Re: FilteredItemsSelectionDialog - refreshing content provider [message #328994 is a reply to message #328966] Tue, 10 June 2008 07:26 Go to previous messageGo to next message
Eclipse User
Originally posted by: fraserofthenight.gmail.com

Eric Rizzo wrote:
> Robert Fraser wrote:
>> Hi all,
>>
>> I have a filtered content selection dialog, and in the extended
>> content area I have a checkbox that adds an extra filter. I added a
>> selection listener to the checkbox so that whenever the user
>> selects/deselects it, I want the dialog to empty its content and
>> re-call fillContentProvider(). However, I can't seem to make it do
>> this (I've tried refesh(), scheduleRefresh() and reloadCache()).
>>
>> Is there any way to force the dialog to call fillContentProvider().
>> Short of that, I can't even seem to make it call matches() on every
>> item, so is there a way to force it to do that and re-match the items?
>
> Have you tried calling applyFilter()? In order for that to work, the new
> filter will have to be different from the previous one.
>
> Hope this helps,
> Eric

Okay, this is really weird. I'm initializing the dialog with "**" and at
that point if I check/uncheck the box in the extended content area,
nothing happens. But if I change the filter text to something else &
then go back to ** and check/uncheck the box which is supposed to change
the filter, it works fine.

Relevant code (I've tried to remove everything not relevant to this
particular issue):
==============
private abstract class AbstractModuleFilter extends ItemsFilter
{
public boolean isConsistentItem(Object item)
{
return true;
}

public boolean matchItem(Object item)
{
return matches(getName(item));
}
}

private final class AllModulesFilter extends AbstractModuleFilter
{
@Override
public boolean equalsFilter(ItemsFilter filter)
{
return filter instanceof AllModulesFilter &&
super.equalsFilter(filter);
}
}

private final class OnlyMainFilter extends AbstractModuleFilter
{
@Override
public boolean matchItem(Object item)
{
return isMainModule(item) && super.matchItem(item);
}

@Override
public boolean equalsFilter(ItemsFilter filter)
{
return filter instanceof OnlyMainFilter &&
super.equalsFilter(filter);
}
}

@Override
protected Control createExtendedContentArea(Composite parent)
{
// ...[snip creating a composite with fOnlyMainCheckbox]...

fOnlyMainCheckbox.addSelectionListener(new SelectionAdapter()
{
@Override
public void widgetSelected(SelectionEvent e)
{
fOnlyMain = fOnlyMainCheckbox.getSelection();
applyFilter();
}
});

return comp;
}

@Override
protected ItemsFilter createFilter()
{
return fOnlyMain ? new OnlyMainFilter() : new AllModulesFilter();
}
======

Than you so much for your help,
Robert
Re: FilteredItemsSelectionDialog - refreshing content provider [message #329116 is a reply to message #328994] Fri, 13 June 2008 03:21 Go to previous messageGo to next message
Eclipse User
Originally posted by: fraserofthenight.gmail.com

Robert Fraser wrote:
> Eric Rizzo wrote:
>> Robert Fraser wrote:
>>> Hi all,
>>>
>>> I have a filtered content selection dialog, and in the extended
>>> content area I have a checkbox that adds an extra filter. I added a
>>> selection listener to the checkbox so that whenever the user
>>> selects/deselects it, I want the dialog to empty its content and
>>> re-call fillContentProvider(). However, I can't seem to make it do
>>> this (I've tried refesh(), scheduleRefresh() and reloadCache()).
>>>
>>> Is there any way to force the dialog to call fillContentProvider().
>>> Short of that, I can't even seem to make it call matches() on every
>>> item, so is there a way to force it to do that and re-match the items?
>>
>> Have you tried calling applyFilter()? In order for that to work, the
>> new filter will have to be different from the previous one.
>>
>> Hope this helps,
>> Eric
>
> Okay, this is really weird. I'm initializing the dialog with "**" and at
> that point if I check/uncheck the box in the extended content area,
> nothing happens. But if I change the filter text to something else &
> then go back to ** and check/uncheck the box which is supposed to change
> the filter, it works fine.
>
> Relevant code (I've tried to remove everything not relevant to this
> particular issue):
> ==============
> private abstract class AbstractModuleFilter extends ItemsFilter
> {
> public boolean isConsistentItem(Object item)
> {
> return true;
> }
>
> public boolean matchItem(Object item)
> {
> return matches(getName(item));
> }
> }
>
> private final class AllModulesFilter extends AbstractModuleFilter
> {
> @Override
> public boolean equalsFilter(ItemsFilter filter)
> {
> return filter instanceof AllModulesFilter &&
> super.equalsFilter(filter);
> }
> }
>
> private final class OnlyMainFilter extends AbstractModuleFilter
> {
> @Override
> public boolean matchItem(Object item)
> {
> return isMainModule(item) && super.matchItem(item);
> }
>
> @Override
> public boolean equalsFilter(ItemsFilter filter)
> {
> return filter instanceof OnlyMainFilter &&
> super.equalsFilter(filter);
> }
> }
>
> @Override
> protected Control createExtendedContentArea(Composite parent)
> {
> // ...[snip creating a composite with fOnlyMainCheckbox]...
>
> fOnlyMainCheckbox.addSelectionListener(new SelectionAdapter()
> {
> @Override
> public void widgetSelected(SelectionEvent e)
> {
> fOnlyMain = fOnlyMainCheckbox.getSelection();
> applyFilter();
> }
> });
>
> return comp;
> }
>
> @Override
> protected ItemsFilter createFilter()
> {
> return fOnlyMain ? new OnlyMainFilter() : new AllModulesFilter();
> }
> ======
>
> Than you so much for your help,
> Robert

Anyone know...?

Thanks,
Robert
Re: FilteredItemsSelectionDialog - refreshing content provider [message #329396 is a reply to message #328994] Mon, 23 June 2008 05:44 Go to previous messageGo to next message
Eclipse User
Originally posted by: fraserofthenight.gmail.com

Robert Fraser wrote:
> Eric Rizzo wrote:
>> Robert Fraser wrote:
>>> Hi all,
>>>
>>> I have a filtered content selection dialog, and in the extended
>>> content area I have a checkbox that adds an extra filter. I added a
>>> selection listener to the checkbox so that whenever the user
>>> selects/deselects it, I want the dialog to empty its content and
>>> re-call fillContentProvider(). However, I can't seem to make it do
>>> this (I've tried refesh(), scheduleRefresh() and reloadCache()).
>>>
>>> Is there any way to force the dialog to call fillContentProvider().
>>> Short of that, I can't even seem to make it call matches() on every
>>> item, so is there a way to force it to do that and re-match the items?
>>
>> Have you tried calling applyFilter()? In order for that to work, the
>> new filter will have to be different from the previous one.
>>
>> Hope this helps,
>> Eric
>
> Okay, this is really weird. I'm initializing the dialog with "**" and at
> that point if I check/uncheck the box in the extended content area,
> nothing happens. But if I change the filter text to something else &
> then go back to ** and check/uncheck the box which is supposed to change
> the filter, it works fine.
>
> Relevant code (I've tried to remove everything not relevant to this
> particular issue):
> ==============
> private abstract class AbstractModuleFilter extends ItemsFilter
> {
> public boolean isConsistentItem(Object item)
> {
> return true;
> }
>
> public boolean matchItem(Object item)
> {
> return matches(getName(item));
> }
> }
>
> private final class AllModulesFilter extends AbstractModuleFilter
> {
> @Override
> public boolean equalsFilter(ItemsFilter filter)
> {
> return filter instanceof AllModulesFilter &&
> super.equalsFilter(filter);
> }
> }
>
> private final class OnlyMainFilter extends AbstractModuleFilter
> {
> @Override
> public boolean matchItem(Object item)
> {
> return isMainModule(item) && super.matchItem(item);
> }
>
> @Override
> public boolean equalsFilter(ItemsFilter filter)
> {
> return filter instanceof OnlyMainFilter &&
> super.equalsFilter(filter);
> }
> }
>
> @Override
> protected Control createExtendedContentArea(Composite parent)
> {
> // ...[snip creating a composite with fOnlyMainCheckbox]...
>
> fOnlyMainCheckbox.addSelectionListener(new SelectionAdapter()
> {
> @Override
> public void widgetSelected(SelectionEvent e)
> {
> fOnlyMain = fOnlyMainCheckbox.getSelection();
> applyFilter();
> }
> });
>
> return comp;
> }
>
> @Override
> protected ItemsFilter createFilter()
> {
> return fOnlyMain ? new OnlyMainFilter() : new AllModulesFilter();
> }
> ======
>
> Than you so much for your help,
> Robert

Might anyone have an example of how FliteredItemsSelectionDialog is
used, perhaps with an additional filter like this...?
Re: FilteredItemsSelectionDialog - refreshing content provider [message #894458 is a reply to message #328955] Mon, 09 July 2012 10:01 Go to previous message
Shiyam Hoda is currently offline Shiyam Hoda
Messages: 4
Registered: June 2012
Junior Member
Hi Robert Fraser
Have you figured out how to do this?
I have to do the same and stuck.
Help Please.
Question same as OP.
Previous Topic:Is it possible to debug a GPU code with Eclipse ?
Next Topic:Question about FilteredItemsSelectionDialog
Goto Forum:
  


Current Time: Tue Sep 23 00:32:14 GMT 2014

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

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