Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-ui-dev] Feedback on FilteredItemsSelectionDialog

I've been wanting an equivalent to the Open Resource dialog and
JDT's Open Type dialog, but for for searching on methods.  I took
a couple of hours out to see what I could hack up, and came across
the FilteredItemsSelectionDialog.  It's mostly worked out fine,
but I've had to hack around a set of assumptions.

In terms of appearance, the dialog looks great.  Two notes:

  * It would be nice to be able to customize the pattern label (created
    in createHeader(Composite)).  The text currently use isn't
    appropriate for supporting CamelCase matching, for example.

  * The details TableViewer becomes occluded by a horizontal scroll bar
    if the detalis text exceeds the width.  This *may* be a GTK-only
    issue: I can't test it under Windows.  You can see this in the
    Open Resources dialog (FilteredResourcesSelectionDialog) if
    you shrink the dialog to a small size.  I've hacked around this
    by setting the heightHint to be a minimum of 20 pixels.  It's
    gross.

In terms of design, my one design criticism is the exclusive use
of the pattern text for building the ItemsFilter, and that the
ItemsFilter is responsible for any filtering of results.  This
makes it difficult to integrate an searching model where the pattern
text is to be directly used to condition the search.  In my scenario,
I'm using the JDT's SearchEngine to find all methods matching a
pattern -- and I want to use the pattern text to feed into the
SearchEngine, rather than use it to filter the results of the
SearchEngine on "*".  My work-around for now is to use a DummyFilter,
which does nothing, and make createFilter() something like the
following

    protected ItemsFilter createFilter() {
	methodPattern = new DummyFilter().getPattern();
	return new DummyFilter("*");
    }

That stashes away the pattern text for my own use.  Since the
returned filter has the same pattern text, my DummyFilter.isSubFilter()
always returns false.

Brian.

-- 
  Brian de Alwis | Software Practices Lab | UBC | http://www.cs.ubc.ca/~bsd/
      "Amusement to an observing mind is study." - Benjamin Disraeli


Back to the top