How to refresh a FilteredItemsSelectionDialog
<p>I have a <code>FilteredItemsSelectionDialog</code> shose underlying <em>data model</em> may change while the dialog is open. If there are structural changes, i.e. elements are added or removed, I am unable to tell the dialog to update its filtered list.</p>

<p>I tried calling <code>refresh()</code> and <code>reloadCache()</code> and also <code>scheduleRefresh()</code> (which essentially runs <code>reloadCache()</code> in a Job), but all methods re-use the elements that were initially added to the content provider.</p>

<p>What I think would solve the problem is a way to reset the content provider and have it call <code>fillContentProvider()</code> again. Then I could re-populate the content provider with the current state of the model. While preserving the current filter and selection, of course.</p>

<p>[BEGIN EDIT]</p>

<p>Based on Greg's answer here is what I also tried:</p>

<pre class="lang-java prettyprint-override"><code>ItemsFilter overrideFilter;

@Override
protected ItemsFilter createFilter() {  
  if( overrideFilter != null ) {
    return overrideFilter;
  }
  return new LaunchConfigItemsFilter();
}

public void forceRefresh() {
  overrideFilter = new ItemsFilter() {
    @Override
    public boolean matchItem( Object item ) {
      return false;
    }

    @Override
    public boolean isConsistentItem( Object item ) {
      return false;
    }

    @Override
    public boolean equalsFilter( ItemsFilter filter ) {
      return false;
    }

    @Override
    public boolean isSubFilter( ItemsFilter filter ) {
      return false;
    }
  };
  applyFilter();
  overrideFilter = null;
  applyFilter();
}
</code></pre>

<p><code>forceRefresh()</code> is called whenever the model structure changes. The intention is to first call <code>applyFilter()</code> with a filter that will never match the existing one and thus triggers <code>fillContentProider()</code> and then again call <code>applyFilter()</code> with the current filter to restore the elements that match.</p>

<p>But when an element is added and another is removed, the outcome is that the deleted element is still visible.</p>

<p>What I also tried is to let <code>createFilter()</code> return <code>null</code> for the first call to <code>applyFilter()</code>. This again leaves the deleted element visible.</p>

<p>Irrespective of whether a fitler was set or not before the elments were added and removed, at its best, the list is in a meaningful state only after I cleared and (re-)entered a filter.</p>

<p>[END EDIT]</p>

<p>To give some context, the dialog in question lists launch configurations, the code can be found here: 
<a href="https://github.com/rherrmann/eclipse-extras/blob/master/com.codeaffine.extras.launch/src/com/codeaffine/extras/launch/internal/dialog/LaunchSelectionDialog.java" rel="nofollow">https://github.com/rherrmann/eclipse-extras/blob/master/com.codeaffine.extras.launch/src/com/codeaffine/extras/launch/internal/dialog/LaunchSelectionDialog.java</a></p>

<p>Does anyone know a way to force the <code>FilteredItemsSelectionDialog</code> to reset and refill its content provider?</p>