Home » Eclipse Projects » Eclipse Platform » FilteredItemsSelectionDialog - refreshing content provider
FilteredItemsSelectionDialog - refreshing content provider [message #328955] |
Sun, 08 June 2008 06:11  |
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 09:19   |
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 03:26   |
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] |
Thu, 12 June 2008 23:21   |
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 01:44   |
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...?
|
|
| |
Goto Forum:
Current Time: Sun May 04 16:23:43 EDT 2025
Powered by FUDForum. Page generated in 0.03075 seconds
|