Lines 115-121
Link Here
|
115 |
import org.eclipse.ui.commands.ICommandService; |
115 |
import org.eclipse.ui.commands.ICommandService; |
116 |
import org.eclipse.ui.contexts.IContextService; |
116 |
import org.eclipse.ui.contexts.IContextService; |
117 |
import org.eclipse.ui.dialogs.FilteredTree; |
117 |
import org.eclipse.ui.dialogs.FilteredTree; |
118 |
import org.eclipse.ui.dialogs.PatternFilter; |
|
|
119 |
import org.eclipse.ui.internal.WorkbenchPlugin; |
118 |
import org.eclipse.ui.internal.WorkbenchPlugin; |
120 |
import org.eclipse.ui.internal.commands.ICommandImageService; |
119 |
import org.eclipse.ui.internal.commands.ICommandImageService; |
121 |
import org.eclipse.ui.internal.misc.Policy; |
120 |
import org.eclipse.ui.internal.misc.Policy; |
Lines 399-478
Link Here
|
399 |
* display elements in the tree according to the selected criteria. |
398 |
* display elements in the tree according to the selected criteria. |
400 |
* |
399 |
* |
401 |
*/ |
400 |
*/ |
402 |
protected class GroupedFilteredTree extends FilteredTree { |
401 |
protected class CategoryFilterTree extends FilteredTree { |
|
|
402 |
|
403 |
private CategoryPatternFilter filter; |
403 |
|
404 |
|
404 |
/** |
405 |
/** |
405 |
* Constructor for GroupedFilteredTree. |
406 |
* Constructor for PatternFilteredTree. |
406 |
* |
407 |
* |
407 |
* @param parent |
408 |
* @param parent |
408 |
* @param treeStyle |
409 |
* @param treeStyle |
409 |
* @param filter |
410 |
* @param filter |
410 |
*/ |
411 |
*/ |
411 |
protected GroupedFilteredTree(Composite parent, int treeStyle, |
412 |
protected CategoryFilterTree(Composite parent, int treeStyle, |
412 |
PatternFilter filter) { |
413 |
CategoryPatternFilter filter) { |
413 |
super(parent, treeStyle, filter); |
414 |
super(parent, treeStyle, filter); |
|
|
415 |
this.filter = filter; |
414 |
} |
416 |
} |
415 |
|
417 |
|
416 |
protected void createControl(final Composite parent, final int treeStyle) { |
418 |
public void filterCategories(boolean b) { |
417 |
GridData gridData; |
419 |
filter.filterCategories(b); |
418 |
GridLayout layout; |
420 |
textChanged(); |
419 |
|
|
|
420 |
layout = new GridLayout(); |
421 |
// Why doesn't this seem to be working?? |
422 |
layout.marginHeight = 0; |
423 |
layout.marginWidth = 0; |
424 |
setLayout(layout); |
425 |
setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); |
426 |
setFont(parent.getFont()); |
427 |
|
428 |
// Create the filter controls |
429 |
filterComposite = new Composite(this, SWT.NONE); |
430 |
GridLayout filterLayout = new GridLayout(2, false); |
431 |
filterLayout.marginHeight = 0; |
432 |
filterLayout.marginWidth = 0; |
433 |
filterComposite.setLayout(filterLayout); |
434 |
filterComposite.setFont(parent.getFont()); |
435 |
|
436 |
createFilterControls(filterComposite); |
437 |
filterComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, |
438 |
true, false)); |
439 |
|
440 |
// Create a table tree viewer. |
441 |
final Control treeControl = createTreeControl(this, treeStyle); |
442 |
gridData = new GridData(SWT.FILL, SWT.FILL, true, true); |
443 |
gridData.horizontalSpan = 3; |
444 |
treeControl.setLayoutData(gridData); |
445 |
} |
421 |
} |
446 |
|
422 |
|
447 |
/** |
423 |
public boolean isFilteringCategories() { |
448 |
* <p> |
424 |
return filter.isFilteringCategories(); |
449 |
* Creates the grouping controls that will appear in the top-right in |
|
|
450 |
* the default layout. The default grouping controls are a label and a |
451 |
* combo box. |
452 |
* </p> |
453 |
* <p> |
454 |
* Subclasses may extend or override this method. Before this method |
455 |
* completes, <code>groupingCombo</code> should be initialized. |
456 |
* Subclasses must create a combo box which contains the possible |
457 |
* groupings. |
458 |
* </p> |
459 |
* |
460 |
* @param parent |
461 |
* The composite in which the grouping control should be |
462 |
* placed; must not be <code>null</code>. |
463 |
* @return The composite containing the grouping controls, or the |
464 |
* grouping control itself (if there is only one control). |
465 |
*/ |
466 |
protected Control createGroupingControl(final Composite parent) { |
467 |
// Create the composite that will contain the grouping controls. |
468 |
Composite groupingControl = new Composite(parent, SWT.NONE); |
469 |
GridLayout layout = new GridLayout(2, false); |
470 |
layout.marginWidth = 0; |
471 |
layout.marginHeight = 0; |
472 |
groupingControl.setLayout(layout); |
473 |
groupingControl.setFont(parent.getFont()); |
474 |
|
475 |
return groupingControl; |
476 |
} |
425 |
} |
477 |
} |
426 |
} |
478 |
|
427 |
|
Lines 834-839
Link Here
|
834 |
|
783 |
|
835 |
private static final String TAG_FILTER_INTERNAL = "internalFilter"; //$NON-NLS-1$ |
784 |
private static final String TAG_FILTER_INTERNAL = "internalFilter"; //$NON-NLS-1$ |
836 |
|
785 |
|
|
|
786 |
private static final String TAG_FILTER_UNCAT = "uncategorizedFilter"; //$NON-NLS-1$ |
787 |
|
837 |
/** |
788 |
/** |
838 |
* Sorts the given array of <code>NamedHandleObject</code> instances based |
789 |
* Sorts the given array of <code>NamedHandleObject</code> instances based |
839 |
* on their name. This is generally useful if they will be displayed to an |
790 |
* on their name. This is generally useful if they will be displayed to an |
Lines 896-902
Link Here
|
896 |
/** |
847 |
/** |
897 |
* The filtered tree containing the list of commands and bindings to edit. |
848 |
* The filtered tree containing the list of commands and bindings to edit. |
898 |
*/ |
849 |
*/ |
899 |
private GroupedFilteredTree filteredTree; |
850 |
private CategoryFilterTree filteredTree; |
|
|
851 |
|
852 |
private CategoryPatternFilter patternFilter; |
900 |
|
853 |
|
901 |
/** |
854 |
/** |
902 |
* The grouping for the bindings tree. Either there should be no group |
855 |
* The grouping for the bindings tree. Either there should be no group |
Lines 1165-1173
Link Here
|
1165 |
getShell()); |
1118 |
getShell()); |
1166 |
dialog.setFilterActionSet(filterActionSetContexts); |
1119 |
dialog.setFilterActionSet(filterActionSetContexts); |
1167 |
dialog.setFilterInternal(filterInternalContexts); |
1120 |
dialog.setFilterInternal(filterInternalContexts); |
|
|
1121 |
dialog.setFilterUncategorized(filteredTree.isFilteringCategories()); |
1168 |
if (dialog.open() == Window.OK) { |
1122 |
if (dialog.open() == Window.OK) { |
1169 |
filterActionSetContexts = dialog.getFilterActionSet(); |
1123 |
filterActionSetContexts = dialog.getFilterActionSet(); |
1170 |
filterInternalContexts = dialog.getFilterInternal(); |
1124 |
filterInternalContexts = dialog.getFilterInternal(); |
|
|
1125 |
filteredTree.filterCategories(dialog |
1126 |
.getFilterUncategorized()); |
1171 |
whenCombo.setInput(getContexts()); |
1127 |
whenCombo.setInput(getContexts()); |
1172 |
updateDataControls(); |
1128 |
updateDataControls(); |
1173 |
} |
1129 |
} |
Lines 1197-1202
Link Here
|
1197 |
if (settings.get(TAG_FILTER_INTERNAL) != null) { |
1153 |
if (settings.get(TAG_FILTER_INTERNAL) != null) { |
1198 |
filterInternalContexts = settings.getBoolean(TAG_FILTER_INTERNAL); |
1154 |
filterInternalContexts = settings.getBoolean(TAG_FILTER_INTERNAL); |
1199 |
} |
1155 |
} |
|
|
1156 |
patternFilter = new CategoryPatternFilter( |
1157 |
true, commandService.getCategory(null)); |
1158 |
if (settings.get(TAG_FILTER_UNCAT) != null) { |
1159 |
patternFilter.filterCategories(settings |
1160 |
.getBoolean(TAG_FILTER_UNCAT)); |
1161 |
} |
1200 |
|
1162 |
|
1201 |
// Creates a composite to hold all of the page contents. |
1163 |
// Creates a composite to hold all of the page contents. |
1202 |
final Composite page = new Composite(parent, SWT.NONE); |
1164 |
final Composite page = new Composite(parent, SWT.NONE); |
Lines 1466-1474
Link Here
|
1466 |
private final Control createTree(final Composite parent) { |
1428 |
private final Control createTree(final Composite parent) { |
1467 |
GridData gridData; |
1429 |
GridData gridData; |
1468 |
|
1430 |
|
1469 |
filteredTree = new GroupedFilteredTree(parent, SWT.SINGLE |
1431 |
filteredTree = new CategoryFilterTree(parent, SWT.SINGLE |
1470 |
| SWT.FULL_SELECTION | SWT.BORDER, new PatternFilter()); |
1432 |
| SWT.FULL_SELECTION | SWT.BORDER, patternFilter); |
1471 |
final GridLayout layout = new GridLayout(2, false); |
1433 |
final GridLayout layout = new GridLayout(1, false); |
1472 |
layout.marginWidth = 0; |
1434 |
layout.marginWidth = 0; |
1473 |
filteredTree.setLayout(layout); |
1435 |
filteredTree.setLayout(layout); |
1474 |
gridData = new GridData(); |
1436 |
gridData = new GridData(); |
Lines 1509-1515
Link Here
|
1509 |
triggerSequenceColumn |
1471 |
triggerSequenceColumn |
1510 |
.setText(NewKeysPreferenceMessages.TriggerSequenceColumn_Text); |
1472 |
.setText(NewKeysPreferenceMessages.TriggerSequenceColumn_Text); |
1511 |
triggerSequenceColumn.addSelectionListener(new ResortColumn(comparator, |
1473 |
triggerSequenceColumn.addSelectionListener(new ResortColumn(comparator, |
1512 |
triggerSequenceColumn, tree, BindingLabelProvider.COLUMN_TRIGGER_SEQUENCE)); |
1474 |
triggerSequenceColumn, tree, |
|
|
1475 |
BindingLabelProvider.COLUMN_TRIGGER_SEQUENCE)); |
1513 |
|
1476 |
|
1514 |
final TreeColumn whenColumn = new TreeColumn(tree, SWT.LEFT, |
1477 |
final TreeColumn whenColumn = new TreeColumn(tree, SWT.LEFT, |
1515 |
BindingLabelProvider.COLUMN_WHEN); |
1478 |
BindingLabelProvider.COLUMN_WHEN); |
Lines 2247-2252
Link Here
|
2247 |
dialogSettings.put(TAG_FIELD, showAllCheckBox.getSelection()); |
2210 |
dialogSettings.put(TAG_FIELD, showAllCheckBox.getSelection()); |
2248 |
dialogSettings.put(TAG_FILTER_ACTION_SETS, filterActionSetContexts); |
2211 |
dialogSettings.put(TAG_FILTER_ACTION_SETS, filterActionSetContexts); |
2249 |
dialogSettings.put(TAG_FILTER_INTERNAL, filterInternalContexts); |
2212 |
dialogSettings.put(TAG_FILTER_INTERNAL, filterInternalContexts); |
|
|
2213 |
dialogSettings.put(TAG_FILTER_UNCAT, filteredTree.isFilteringCategories()); |
2250 |
} |
2214 |
} |
2251 |
|
2215 |
|
2252 |
protected IDialogSettings getDialogSettings() { |
2216 |
protected IDialogSettings getDialogSettings() { |