Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 301820 | Differences between
and this patch

Collapse All | Expand All

(-)plugin.properties (+2 lines)
Lines 303-305 Link Here
303
notFilterProvider.name = NOT group
303
notFilterProvider.name = NOT group
304
notFilterProvider.description = Allows grouping others filters with the NOT logical preposition
304
notFilterProvider.description = Allows grouping others filters with the NOT logical preposition
305
installationPage.feature.name = Features
305
installationPage.feature.name = Features
306
pathFilterProvider.name = Path Matcher
307
pathFilterProvider.description = * = any string, ? = any character, \\ = escape literals: * ? \\
(-)plugin.xml (+8 lines)
Lines 2323-2328 Link Here
2323
            name="%notFilterProvider.name"
2323
            name="%notFilterProvider.name"
2324
            ordering="first">
2324
            ordering="first">
2325
      </filterMatcher>
2325
      </filterMatcher>
2326
      <filterMatcher
2327
            argumentType="string"
2328
            class="org.eclipse.ui.internal.ide.misc.StringPathMatcher"
2329
            description="%pathFilterProvider.description"
2330
            id="org.eclipse.ui.ide.pathFilter"
2331
            name="%pathFilterProvider.name"
2332
            ordering="first">
2333
      </filterMatcher>
2326
   </extension>
2334
   </extension>
2327
   <extension
2335
   <extension
2328
         point="org.eclipse.ui.installationPages">
2336
         point="org.eclipse.ui.installationPages">
(-)src/org/eclipse/ui/internal/ide/IDEWorkbenchMessages.java (+4 lines)
Lines 53-58 Link Here
53
	public static String ResourceFilterPage_title;
53
	public static String ResourceFilterPage_title;
54
	public static String ResourceFilterPage_noResource;
54
	public static String ResourceFilterPage_noResource;
55
	public static String ResourceFilterPage_addButtonLabel;
55
	public static String ResourceFilterPage_addButtonLabel;
56
	public static String ResourceFilterPage_addGroupButtonLabel;
56
	public static String ResourceFilterPage_editButtonLabel;
57
	public static String ResourceFilterPage_editButtonLabel;
57
	public static String ResourceFilterPage_removeButtonLabel;
58
	public static String ResourceFilterPage_removeButtonLabel;
58
	public static String ResourceFilterPage_upButtonLabel;
59
	public static String ResourceFilterPage_upButtonLabel;
Lines 76-81 Link Here
76
	public static String ResourceFilterPage_editFilterDialogTitle;
77
	public static String ResourceFilterPage_editFilterDialogTitle;
77
	public static String ResourceFilterPage_description;
78
	public static String ResourceFilterPage_description;
78
	public static String ResourceFilterPage_addSubFilterActionLabel;
79
	public static String ResourceFilterPage_addSubFilterActionLabel;
80
	public static String ResourceFilterPage_addSubFilterGroupActionLabel;
81
	public static String ResourceFilterPage_removeFilterActionLabel;
82
	public static String ResourceFilterPage_editFilterActionLabel;
79
	//
83
	//
80
	//
84
	//
81
	// Copies from org.eclipse.ui.workbench
85
	// Copies from org.eclipse.ui.workbench
(-)src/org/eclipse/ui/internal/ide/messages.properties (-1 / +5 lines)
Lines 573-578 Link Here
573
ResourceFilterPage_title=Resource filters can be used to hide file system objects from the Eclipse resource tree.\nA file system object will be included if it matches any of the include filters and doesn't match any of the exclude filters. 
573
ResourceFilterPage_title=Resource filters can be used to hide file system objects from the Eclipse resource tree.\nA file system object will be included if it matches any of the include filters and doesn't match any of the exclude filters. 
574
ResourceFilterPage_noResource=Resource information is not available for the current selection.
574
ResourceFilterPage_noResource=Resource information is not available for the current selection.
575
ResourceFilterPage_addButtonLabel=&Add...
575
ResourceFilterPage_addButtonLabel=&Add...
576
ResourceFilterPage_addGroupButtonLabel=Add &Group...
576
ResourceFilterPage_editButtonLabel=Edi&t...
577
ResourceFilterPage_editButtonLabel=Edi&t...
577
ResourceFilterPage_removeButtonLabel=&Remove
578
ResourceFilterPage_removeButtonLabel=&Remove
578
ResourceFilterPage_upButtonLabel=Up
579
ResourceFilterPage_upButtonLabel=Up
Lines 595-601 Link Here
595
ResourceFilterPage_foldersColumn=Folders
596
ResourceFilterPage_foldersColumn=Folders
596
ResourceFilterPage_editFilterDialogTitle=Edit Resource Filter
597
ResourceFilterPage_editFilterDialogTitle=Edit Resource Filter
597
ResourceFilterPage_description=Description
598
ResourceFilterPage_description=Description
598
ResourceFilterPage_addSubFilterActionLabel=Add Condition...
599
ResourceFilterPage_addSubFilterActionLabel=Add &Condition...
600
ResourceFilterPage_addSubFilterGroupActionLabel=Add &Group...
601
ResourceFilterPage_removeFilterActionLabel=&Remove
602
ResourceFilterPage_editFilterActionLabel=&Edit
599
ResourceInfo_folder = Folder
603
ResourceInfo_folder = Folder
600
ResourceInfo_project = Project
604
ResourceInfo_project = Project
601
ResourceInfo_linkedFile = Linked File
605
ResourceInfo_linkedFile = Linked File
(-)src/org/eclipse/ui/internal/ide/dialogs/ResourceFilterGroup.java (-32 / +115 lines)
Lines 33-38 Link Here
33
import org.eclipse.core.runtime.NullProgressMonitor;
33
import org.eclipse.core.runtime.NullProgressMonitor;
34
import org.eclipse.jface.action.Action;
34
import org.eclipse.jface.action.Action;
35
import org.eclipse.jface.action.MenuManager;
35
import org.eclipse.jface.action.MenuManager;
36
import org.eclipse.jface.action.Separator;
36
import org.eclipse.jface.dialogs.Dialog;
37
import org.eclipse.jface.dialogs.Dialog;
37
import org.eclipse.jface.dialogs.ErrorDialog;
38
import org.eclipse.jface.dialogs.ErrorDialog;
38
import org.eclipse.jface.dialogs.IDialogConstants;
39
import org.eclipse.jface.dialogs.IDialogConstants;
Lines 105-110 Link Here
105
public class ResourceFilterGroup {
106
public class ResourceFilterGroup {
106
107
107
	private Button addButton = null;
108
	private Button addButton = null;
109
	private Button addGroupButton = null;
108
	private Button removeButton = null;
110
	private Button removeButton = null;
109
	private Button upButton = null;
111
	private Button upButton = null;
110
	private Button downButton = null;
112
	private Button downButton = null;
Lines 595-613 Link Here
595
			public void menuDetected(MenuDetectEvent e) {
597
			public void menuDetected(MenuDetectEvent e) {
596
				MenuManager mgr = new MenuManager();
598
				MenuManager mgr = new MenuManager();
597
				mgr.add(addSubFilterAction);
599
				mgr.add(addSubFilterAction);
600
				mgr.add(addSubGroupFilterAction);
601
				mgr.add(new Separator());
602
				mgr.add(new EditFilterAction());
603
				mgr.add(new RemoveFilterAction());
598
				filterView.getControl().setMenu(
604
				filterView.getControl().setMenu(
599
						mgr.createContextMenu(filterView.getControl()));
605
						mgr.createContextMenu(filterView.getControl()));
600
			}
606
			}
601
		});
607
		});
602
	}
608
	}
603
609
604
	Action addSubFilterAction = new AddSubFilterAction();
610
	class EditFilterAction extends Action {
611
612
		public EditFilterAction() {
613
			setText(NLS
614
					.bind(IDEWorkbenchMessages.ResourceFilterPage_editFilterActionLabel,
615
							null));
616
		}
617
618
		public void run() {
619
			handleEdit();
620
		}
621
		public boolean isEnabled() {
622
			ISelection selection = filterView.getSelection();
623
			if (selection instanceof IStructuredSelection) {
624
				return ((IStructuredSelection) selection).size() > 0;			}
625
			return false;
626
		}
627
	}
628
629
	class RemoveFilterAction extends Action {
630
631
		public RemoveFilterAction() {
632
			setText(NLS
633
					.bind(IDEWorkbenchMessages.ResourceFilterPage_removeFilterActionLabel,
634
							null));
635
		}
636
637
		public void run() {
638
			handleRemove();
639
		}
640
		public boolean isEnabled() {
641
			ISelection selection = filterView.getSelection();
642
			if (selection instanceof IStructuredSelection) {
643
				return ((IStructuredSelection) selection).size() > 0;			}
644
			return false;
645
		}
646
	}
647
648
	Action addSubFilterAction = new AddSubFilterAction(false);
605
649
606
	class AddSubFilterAction extends Action {
650
	class AddSubFilterAction extends Action {
607
651
608
		public AddSubFilterAction() {
652
		boolean createGroupOnly;
653
		
654
		public AddSubFilterAction(boolean createGroupOnly) {
655
			this.createGroupOnly = createGroupOnly;
609
			setText(NLS
656
			setText(NLS
610
					.bind(
657
					.bind(createGroupOnly ?
658
							IDEWorkbenchMessages.ResourceFilterPage_addSubFilterGroupActionLabel:
611
							IDEWorkbenchMessages.ResourceFilterPage_addSubFilterActionLabel,
659
							IDEWorkbenchMessages.ResourceFilterPage_addSubFilterActionLabel,
612
							null));
660
							null));
613
		}
661
		}
Lines 626-632 Link Here
626
					FilterCopy newFilter = new FilterCopy();
674
					FilterCopy newFilter = new FilterCopy();
627
					newFilter.setParent(filter);
675
					newFilter.setParent(filter);
628
					FilterEditDialog dialog = new FilterEditDialog(shell,
676
					FilterEditDialog dialog = new FilterEditDialog(shell,
629
							newFilter);
677
							newFilter, createGroupOnly);
630
					if (dialog.open() == Window.OK) {
678
					if (dialog.open() == Window.OK) {
631
						filter.addChild(newFilter);
679
						filter.addChild(newFilter);
632
						filterView.refresh();
680
						filterView.refresh();
Lines 651-656 Link Here
651
		}
699
		}
652
	}
700
	}
653
701
702
	Action addSubGroupFilterAction = new AddSubFilterAction(true);
703
654
	class FilterCopyDrop extends ViewerDropAdapter {
704
	class FilterCopyDrop extends ViewerDropAdapter {
655
		protected FilterCopyDrop(Viewer viewer) {
705
		protected FilterCopyDrop(Viewer viewer) {
656
			super(viewer);
706
			super(viewer);
Lines 782-790 Link Here
782
			}
832
			}
783
833
784
			public void widgetSelected(SelectionEvent e) {
834
			public void widgetSelected(SelectionEvent e) {
785
				handleAdd();
835
				handleAdd(false);
786
			}
836
			}
787
		});
837
		});
838
		
839
		addGroupButton = new Button(composite, SWT.PUSH);
840
		addGroupButton.setText(NLS.bind(
841
				IDEWorkbenchMessages.ResourceFilterPage_addGroupButtonLabel, null));
842
		data = new GridData(SWT.FILL, SWT.FILL, false, false);
843
		addGroupButton.setLayoutData(data);
844
		setButtonDimensionHint(addGroupButton);
845
		addGroupButton.addSelectionListener(new SelectionListener() {
846
			public void widgetDefaultSelected(SelectionEvent e) {
847
			}
848
849
			public void widgetSelected(SelectionEvent e) {
850
				handleAdd(true);
851
			}
852
		});
853
		
788
854
789
		editButton = new Button(composite, SWT.PUSH);
855
		editButton = new Button(composite, SWT.PUSH);
790
		editButton.setText(NLS.bind(
856
		editButton.setText(NLS.bind(
Lines 884-892 Link Here
884
		return filters.isLast((FilterCopy) o);
950
		return filters.isLast((FilterCopy) o);
885
	}
951
	}
886
952
887
	private void handleAdd() {
953
	private void handleAdd(boolean createGroupOnly) {
888
		FilterCopy newFilter = new FilterCopy();
954
		FilterCopy newFilter = new FilterCopy();
889
		FilterEditDialog dialog = new FilterEditDialog(shell, newFilter);
955
		FilterEditDialog dialog = new FilterEditDialog(shell, newFilter, createGroupOnly);
890
		if (dialog.open() == Window.OK) {
956
		if (dialog.open() == Window.OK) {
891
			filters.add(newFilter);
957
			filters.add(newFilter);
892
			filterView.refresh();
958
			filterView.refresh();
Lines 900-906 Link Here
900
					.getFirstElement();
966
					.getFirstElement();
901
			FilterCopy copy = new FilterCopy(filter);
967
			FilterCopy copy = new FilterCopy(filter);
902
			copy.setParent(filter.getParent());
968
			copy.setParent(filter.getParent());
903
			FilterEditDialog dialog = new FilterEditDialog(shell, copy);
969
			boolean isGroup = filter.getChildrenLimit() > 0;
970
			FilterEditDialog dialog = new FilterEditDialog(shell, copy, isGroup);
904
			if (dialog.open() == Window.OK) {
971
			if (dialog.open() == Window.OK) {
905
				if (copy.hasChanged()) {
972
				if (copy.hasChanged()) {
906
					filter.copy(copy);
973
					filter.copy(copy);
Lines 1260-1275 Link Here
1260
								null) };
1327
								null) };
1261
	}
1328
	}
1262
1329
1263
	static String[] getFilterNames(boolean childrenOnly) {
1330
	static String[] getFilterNames(boolean groupOnly) {
1264
		IFilterMatcherDescriptor[] descriptors = ResourcesPlugin.getWorkspace()
1331
		IFilterMatcherDescriptor[] descriptors = ResourcesPlugin.getWorkspace()
1265
				.getFilterMatcherDescriptors();
1332
				.getFilterMatcherDescriptors();
1266
		LinkedList names = new LinkedList();
1333
		LinkedList names = new LinkedList();
1267
		for (int i = 0; i < descriptors.length; i++) {
1334
		for (int i = 0; i < descriptors.length; i++) {
1268
			if (!childrenOnly
1335
			boolean isGroup = descriptors[i].getArgumentType().equals(
1336
					IFilterMatcherDescriptor.ARGUMENT_TYPE_FILTER_MATCHER)
1269
					|| descriptors[i].getArgumentType().equals(
1337
					|| descriptors[i].getArgumentType().equals(
1270
							IFilterMatcherDescriptor.ARGUMENT_TYPE_FILTER_MATCHER)
1338
							IFilterMatcherDescriptor.ARGUMENT_TYPE_FILTER_MATCHERS);
1271
					|| descriptors[i].getArgumentType().equals(
1339
			if (isGroup == groupOnly) 
1272
							IFilterMatcherDescriptor.ARGUMENT_TYPE_FILTER_MATCHERS))
1273
				names.add(descriptors[i].getName());
1340
				names.add(descriptors[i].getName());
1274
		}
1341
		}
1275
		return (String[]) names.toArray(new String[0]);
1342
		return (String[]) names.toArray(new String[0]);
Lines 1662-1667 Link Here
1662
	protected Label argumentsLabel;
1729
	protected Label argumentsLabel;
1663
	protected Label description;
1730
	protected Label description;
1664
	protected FilterTypeUtil util;
1731
	protected FilterTypeUtil util;
1732
	protected boolean createGroupOnly;
1665
1733
1666
	private static final String REGEX_FILTER_ID = "org.eclipse.core.resources.regexFilter"; //$NON-NLS-1$
1734
	private static final String REGEX_FILTER_ID = "org.eclipse.core.resources.regexFilter"; //$NON-NLS-1$
1667
	
1735
	
Lines 1676-1685 Link Here
1676
	 * 
1744
	 * 
1677
	 * @param parentShell
1745
	 * @param parentShell
1678
	 * @param filter
1746
	 * @param filter
1747
	 * @param createGroupOnly 
1679
	 */
1748
	 */
1680
	public FilterEditDialog(Shell parentShell, FilterCopy filter) {
1749
	public FilterEditDialog(Shell parentShell, FilterCopy filter, boolean createGroupOnly) {
1681
		super(parentShell);
1750
		super(parentShell);
1682
		this.filter = filter;
1751
		this.filter = filter;
1752
		this.createGroupOnly = createGroupOnly;
1683
		util = new FilterTypeUtil();
1753
		util = new FilterTypeUtil();
1684
	}
1754
	}
1685
1755
Lines 1802-1810 Link Here
1802
	 * 
1872
	 * 
1803
	 */
1873
	 */
1804
	private void setArgumentLabelEnabled() {
1874
	private void setArgumentLabelEnabled() {
1805
		Color color = argumentsLabel.getDisplay().getSystemColor(
1875
		if (argumentsLabel != null) {
1806
				filter.hasStringArguments() ? SWT.COLOR_BLACK : SWT.COLOR_GRAY);
1876
			Color color = argumentsLabel.getDisplay().getSystemColor(
1807
		argumentsLabel.setForeground(color);
1877
					filter.hasStringArguments() ? SWT.COLOR_BLACK : SWT.COLOR_GRAY);
1878
			argumentsLabel.setForeground(color);
1879
		}
1808
	}
1880
	}
1809
1881
1810
	/**
1882
	/**
Lines 1833-1840 Link Here
1833
				IDEWorkbenchMessages.ResourceFilterPage_columnFilterID, null),
1905
				IDEWorkbenchMessages.ResourceFilterPage_columnFilterID, null),
1834
				true);
1906
				true);
1835
		idCombo = new Combo(idComposite, SWT.READ_ONLY);
1907
		idCombo = new Combo(idComposite, SWT.READ_ONLY);
1836
		idCombo.setItems(FilterTypeUtil.getFilterNames(filter
1908
		idCombo.setItems(FilterTypeUtil.getFilterNames(createGroupOnly));
1837
				.getChildrenLimit() > 0));
1838
		data = new GridData(SWT.FILL, SWT.CENTER, true, false);
1909
		data = new GridData(SWT.FILL, SWT.CENTER, true, false);
1839
		idCombo.setLayoutData(data);
1910
		idCombo.setLayoutData(data);
1840
		idCombo.setFont(font);
1911
		idCombo.setFont(font);
Lines 1845-1870 Link Here
1845
			public void widgetSelected(SelectionEvent e) {
1916
			public void widgetSelected(SelectionEvent e) {
1846
				FilterTypeUtil.setValue(filter, FilterTypeUtil.ID, idCombo
1917
				FilterTypeUtil.setValue(filter, FilterTypeUtil.ID, idCombo
1847
						.getItem(idCombo.getSelectionIndex()));
1918
						.getItem(idCombo.getSelectionIndex()));
1848
				arguments.setEnabled(filter.hasStringArguments());
1919
				if (arguments != null)
1920
					arguments.setEnabled(filter.hasStringArguments());
1849
				setArgumentLabelEnabled();
1921
				setArgumentLabelEnabled();
1850
				description.setText(FilterTypeUtil
1922
				description.setText(FilterTypeUtil
1851
						.getDescriptor(filter.getId()).getDescription());
1923
						.getDescriptor(filter.getId()).getDescription());
1852
				fContentAssistField.setEnabled(filter.getId().equals(REGEX_FILTER_ID));
1924
				if (fContentAssistField != null)
1925
					fContentAssistField.setEnabled(filter.getId().equals(REGEX_FILTER_ID));
1853
			}
1926
			}
1854
		});
1927
		});
1855
		selectComboItem(filter.getId());
1928
		if (createGroupOnly) {
1856
		Composite argumentComposite = new Composite(idComposite, SWT.NONE);
1929
			idCombo.select(0);
1857
		GridLayout layout = new GridLayout();
1930
			FilterTypeUtil.setValue(filter, FilterTypeUtil.ID, idCombo
1858
		layout.numColumns = 2;
1931
					.getItem(idCombo.getSelectionIndex()));
1859
		layout.marginWidth = 0;
1932
		}
1860
		argumentComposite.setLayout(layout);
1933
		else
1861
		data = new GridData(SWT.FILL, SWT.FILL, true, true);
1934
			selectComboItem(filter.getId());
1862
		argumentComposite.setLayoutData(data);
1935
		
1863
		argumentComposite.setFont(font);
1936
		if (!createGroupOnly) {
1864
		createArgumentsArea(font, argumentComposite);
1937
			Composite argumentComposite = new Composite(idComposite, SWT.NONE);
1938
			GridLayout layout = new GridLayout();
1939
			layout.numColumns = 2;
1940
			layout.marginWidth = 0;
1941
			argumentComposite.setLayout(layout);
1942
			data = new GridData(SWT.FILL, SWT.FILL, true, true);
1943
			argumentComposite.setLayoutData(data);
1944
			argumentComposite.setFont(font);
1945
			createArgumentsArea(font, argumentComposite);
1946
		}
1865
1947
1866
		createDescriptionArea(font, idComposite);
1948
		createDescriptionArea(font, idComposite);
1867
		fContentAssistField.setEnabled(filter.getId().equals(REGEX_FILTER_ID));
1949
		if (fContentAssistField != null)
1950
			fContentAssistField.setEnabled(filter.getId().equals(REGEX_FILTER_ID));
1868
	}
1951
	}
1869
1952
1870
	/**
1953
	/**

Return to bug 301820