### Eclipse Workspace Patch 1.0 #P org.eclipse.platform.doc.isv Index: guide/dialogs_FilteredItemsSelectionDialog_example.htm =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.platform.doc.isv/guide/dialogs_FilteredItemsSelectionDialog_example.htm,v retrieving revision 1.5 diff -u -r1.5 dialogs_FilteredItemsSelectionDialog_example.htm --- guide/dialogs_FilteredItemsSelectionDialog_example.htm 8 Jun 2007 14:20:30 -0000 1.5 +++ guide/dialogs_FilteredItemsSelectionDialog_example.htm 11 Jun 2007 15:45:21 -0000 @@ -13,13 +13,16 @@
-In this example, we will contribute a basic search dialog to illustrate the steps needed to create a custom subclass of FilteredItemsSelectionDialog.
private static ArrayList resources = new ArrayList(); + static { generateRescourcesTestCases('A', 'C', 8, ""); //$NON-NLS-1$ generateRescourcesTestCases('a', 'c', 4, ""); //$NON-NLS-1$ @@ -91,6 +95,8 @@ information about how the dialog information is persisted. This method can't return null, so we'll just return a simple settings object:+ private static final String DIALOG_SETTINGS = "FilteredResourcesSelectionDialogExampleSettings"; + protected IDialogSettings getDialogSettings() { IDialogSettings settings = Activator.getDefault().getDialogSettings() .getSection(DIALOG_SETTINGS); @@ -126,7 +132,34 @@ - +
+ public FilteredResourcesSelectionDialogExample(Shell shell, boolean multi) { + super(shell, multi); + setTitle("Filtered Resources Selection Dialog Example"); + setSelectionHistory(new ResourceSelectionHistory()); + } + + private class ResourceSelectionHistory extends SelectionHistory { + protected Object restoreItemFromMemento(IMemento element) { + return null; + } + protected void storeItemToMemento(Object item, IMemento element) { + } + }
+ public void run(IAction action) { + Shell shell = new Shell(); + Dialog dialog = new FilteredResourcesSelectionDialogExample(shell, true); + dialog.open(); + }
-
- setSelectionHistory(new ResourceSelectionHistory()); -
+ private Action showOnlyLowerCaseStringsAction = new ShowOnlyLowerCaseStringsAction(); + private class ShowOnlyLowerCaseStringsAction extends Action { /** * Creates a new instance of the action. @@ -145,12 +146,20 @@ applyFilter(); } } - } + } + protected void fillViewMenu(IMenuManager menuManager) { super.fillViewMenu(menuManager); menuManager.add(showOnlyLowerCaseStringsAction); }
+ protected void applyFilter() { + super.applyFilter(); + checkButton.setSelection(onlyLowerCase); + showOnlyLowerCaseStringsAction.setChecked(onlyLowerCase); + }+