diff options
author | Szymon Brandys | 2009-12-21 10:38:06 +0000 |
---|---|---|
committer | Szymon Brandys | 2009-12-21 10:38:06 +0000 |
commit | 3f682559f5b4a2f16d9eae26942f181cf639b0ab (patch) | |
tree | 2287a6b83aae58c9bcebf7e4be774dbc17f8088a | |
parent | f25520f7159930dc9ac783fdc48ccf252546b9e6 (diff) | |
download | eclipse.platform.resources-3f682559f5b4a2f16d9eae26942f181cf639b0ab.tar.gz eclipse.platform.resources-3f682559f5b4a2f16d9eae26942f181cf639b0ab.tar.xz eclipse.platform.resources-3f682559f5b4a2f16d9eae26942f181cf639b0ab.zip |
bug 297728 - [Filters] IFileInfoMatcherDescription and FileInfoMatcherDescription cleanupv20091221Root_virtualFoldersPolishing_szymon_20100104
10 files changed, 79 insertions, 183 deletions
diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/FilterDescription.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/FilterDescription.java index 11c7446e2..43c9d3519 100644 --- a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/FilterDescription.java +++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/FilterDescription.java @@ -30,7 +30,7 @@ public class FilterDescription implements IResourceFilterDescription, Comparable */ private int type; - private IFileInfoMatcherDescription matcherDescription; + private FileInfoMatcherDescription matcherDescription; /** * The resource that this filter is applied to @@ -41,7 +41,7 @@ public class FilterDescription implements IResourceFilterDescription, Comparable this.type = -1; } - public FilterDescription(IResource resource, int type, IFileInfoMatcherDescription matcherDescription) { + public FilterDescription(IResource resource, int type, FileInfoMatcherDescription matcherDescription) { super(); Assert.isNotNull(resource); this.type = type; @@ -88,11 +88,11 @@ public class FilterDescription implements IResourceFilterDescription, Comparable return resource; } - public IFileInfoMatcherDescription getFileInfoMatcherDescription() { + public FileInfoMatcherDescription getFileInfoMatcherDescription() { return matcherDescription; } - public void setFileInfoMatcherDescription(IFileInfoMatcherDescription matcherDescription) { + public void setFileInfoMatcherDescription(FileInfoMatcherDescription matcherDescription) { this.matcherDescription = matcherDescription; } diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ModelObjectWriter.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ModelObjectWriter.java index e165cec00..b37557216 100644 --- a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ModelObjectWriter.java +++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ModelObjectWriter.java @@ -101,15 +101,15 @@ public class ModelObjectWriter implements IModelObjectConstants { writer.endTag(FILTER); } - protected void write(IFileInfoMatcherDescription description, XMLWriter writer) { + protected void write(FileInfoMatcherDescription description, XMLWriter writer) { writer.startTag(MATCHER, null); writer.printSimpleTag(ID, description.getId()); if (description.getArguments() != null) { if (description.getArguments() instanceof String) { writer.printSimpleTag(ARGUMENTS, description.getArguments()); - } else if (description.getArguments() instanceof IFileInfoMatcherDescription[]) { + } else if (description.getArguments() instanceof FileInfoMatcherDescription[]) { writer.startTag(ARGUMENTS , null); - IFileInfoMatcherDescription[] array = (IFileInfoMatcherDescription[]) description.getArguments(); + FileInfoMatcherDescription[] array = (FileInfoMatcherDescription[]) description.getArguments(); for (int i = 0; i < array.length; i++) { write(array[i], writer); } diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ProjectDescriptionReader.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ProjectDescriptionReader.java index b438a493c..efab85551 100644 --- a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ProjectDescriptionReader.java +++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ProjectDescriptionReader.java @@ -482,11 +482,11 @@ public class ProjectDescriptionReader extends DefaultHandler implements IModelOb private void endMatcherElement(String elementName) { if (elementName.equals(MATCHER)) { - // Pop off the filter description - FileInfoMatcherDescription filter = (FileInfoMatcherDescription) objectStack.pop(); + // Pop off an array (Object[2]) containing the matcher id and arguments. + Object[] matcher = (Object[]) objectStack.pop(); // Make sure that you have something reasonable - String id = filter.getId(); - // arguments can be null + String id = (String) matcher[0]; + // the id can't be null if (id == null) { parseProblem(NLS.bind(Messages.projRead_badFilterID, id)); return; @@ -494,15 +494,15 @@ public class ProjectDescriptionReader extends DefaultHandler implements IModelOb if (objectStack.peek() instanceof ArrayList) { state = S_MATCHER_ARGUMENTS; - // The HashMap of filtered resources is the next thing on the stack + // The ArrayList of matchers is the next thing on the stack ArrayList list = ((ArrayList) objectStack.peek()); - list.add(filter); + list.add(new FileInfoMatcherDescription((String) matcher[0], matcher[1])); } - + if (objectStack.peek() instanceof FilterDescription) { state = S_FILTER; FilterDescription d = ((FilterDescription) objectStack.peek()); - d.setFileInfoMatcherDescription(filter); + d.setFileInfoMatcherDescription(new FileInfoMatcherDescription((String) matcher[0], matcher[1])); } } } @@ -621,14 +621,14 @@ public class ProjectDescriptionReader extends DefaultHandler implements IModelOb private void endMatcherID(String elementName) { if (elementName.equals(ID)) { - // A filter is an String. + // The matcher id is String. String newID = charBuffer.toString().trim(); - // objectStack has a FilterDescription on it. Set the type on this FilterDescription. - String oldID = ((FileInfoMatcherDescription) objectStack.peek()).getId(); + // objectStack has an array (Object[2]) on it for the matcher id and arguments. + String oldID = (String)((Object[])objectStack.peek())[0]; if (oldID != null) { parseProblem(NLS.bind(Messages.projRead_badID, oldID, newID)); } else { - ((FileInfoMatcherDescription) objectStack.peek()).setId(newID); + ((Object[]) objectStack.peek())[0] = newID; } state = S_MATCHER; } @@ -636,17 +636,18 @@ public class ProjectDescriptionReader extends DefaultHandler implements IModelOb private void endMatcherArguments(String elementName) { if (elementName.equals(ARGUMENTS)) { - ArrayList filters = (ArrayList) objectStack.pop(); + ArrayList matchers = (ArrayList) objectStack.pop(); Object newArguments = charBuffer.toString(); - if (filters.size() > 0) - newArguments = filters.toArray(new IFileInfoMatcherDescription[filters.size()]); - - Object oldArguments = ((FileInfoMatcherDescription) objectStack.peek()).getArguments(); + if (matchers.size() > 0) + newArguments = matchers.toArray(new FileInfoMatcherDescription[matchers.size()]); + + // objectStack has an array (Object[2]) on it for the matcher id and arguments. + String oldArguments = (String)((Object[])objectStack.peek())[1]; if (oldArguments != null) { parseProblem(NLS.bind(Messages.projRead_badArguments, oldArguments, newArguments)); } else - ((FileInfoMatcherDescription) objectStack.peek()).setArguments(newArguments); + ((Object[]) objectStack.peek())[1] = newArguments; state = S_MATCHER; } } @@ -1024,7 +1025,8 @@ public class ProjectDescriptionReader extends DefaultHandler implements IModelOb state = S_FILTER_TYPE; } else if (elementName.equals(MATCHER)) { state = S_MATCHER; - objectStack.push(new FileInfoMatcherDescription()); + // Push an array for the matcher id and arguments + objectStack.push(new Object[2]); } break; case S_MATCHER: @@ -1038,9 +1040,8 @@ public class ProjectDescriptionReader extends DefaultHandler implements IModelOb case S_MATCHER_ARGUMENTS: if (elementName.equals(MATCHER)) { state = S_MATCHER; - // Push place holders for the name, type, id and arguments of - // this filter. - objectStack.push(new FileInfoMatcherDescription()); + // Push an array for the matcher id and arguments + objectStack.push(new Object[2]); } break; case S_VARIABLE: diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Resource.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Resource.java index c6c202c18..f1e7c87ff 100644 --- a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Resource.java +++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Resource.java @@ -17,13 +17,6 @@ *******************************************************************************/ package org.eclipse.core.internal.resources; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.IProgressMonitor; - -import org.eclipse.core.internal.utils.Messages; -import org.eclipse.core.internal.utils.Policy; -import org.eclipse.core.runtime.OperationCanceledException; - import java.net.URI; import java.net.URISyntaxException; import java.util.*; @@ -713,9 +706,9 @@ public abstract class Resource extends PlatformObject implements IResource, ICor } /** - * @see IContainer#createFilter(int, IFileInfoMatcherDescription, int, IProgressMonitor) + * @see IContainer#createFilter(int, FileInfoMatcherDescription, int, IProgressMonitor) */ - public IResourceFilterDescription createFilter(int type, IFileInfoMatcherDescription matcherDescription, int updateFlags, IProgressMonitor monitor) throws CoreException { + public IResourceFilterDescription createFilter(int type, FileInfoMatcherDescription matcherDescription, int updateFlags, IProgressMonitor monitor) throws CoreException { Assert.isNotNull(getProject()); monitor = Policy.monitorFor(monitor); FilterDescription filter = null; diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/FileInfoMatcherDescription.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/FileInfoMatcherDescription.java index dc49ee31a..5f0ad555f 100644 --- a/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/FileInfoMatcherDescription.java +++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/FileInfoMatcherDescription.java @@ -11,14 +11,21 @@ package org.eclipse.core.resources; /** + * A description of a file info matcher. * @since 3.6 */ -public final class FileInfoMatcherDescription implements IFileInfoMatcherDescription { +public final class FileInfoMatcherDescription { private String id; private Object arguments; + public FileInfoMatcherDescription(String id, Object arguments) { + super(); + this.id = id; + this.arguments = arguments; + } + public Object getArguments() { return arguments; } @@ -27,14 +34,6 @@ public final class FileInfoMatcherDescription implements IFileInfoMatcherDescrip return id; } - public void setArguments(Object arguments) { - this.arguments = arguments; - } - - public void setId(String id) { - this.id = id; - } - /* (non-Javadoc) * @see java.lang.Object#hashCode() */ diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/IContainer.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/IContainer.java index 5999a8122..23eb5b624 100644 --- a/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/IContainer.java +++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/IContainer.java @@ -468,13 +468,13 @@ public interface IContainer extends IResource, IAdaptable { public void setDefaultCharset(String charset, IProgressMonitor monitor) throws CoreException; /** - * Adds a new filter matching the arguments to this container's filter list + * Adds a new filter to this container. * * @param type (IResourceFilter.INCLUDE_ONLY or IResourceFilter.EXCLUDE_ALL) and/or IResourceFilter.INHERITABLE * @param updateFlags bit-wise or of update flag constants * ({@link IResource#BACKGROUND_REFRESH}) - * @param monitor a progress monitor, or <code>null</code> if progress - * reporting is not desired + * @param monitor a progress monitor, or <code>null</code> if progress reporting is not desired + * @return the description of the added filter * @exception CoreException if this filter could not be added. Reasons include: * <ul> * <li> This resource is not a folder.</li> @@ -486,7 +486,7 @@ public interface IContainer extends IResource, IAdaptable { * * @since 3.6 */ - public IResourceFilterDescription createFilter(int type, IFileInfoMatcherDescription matcherDescription, int updateFlags, IProgressMonitor monitor) throws CoreException; + public IResourceFilterDescription createFilter(int type, FileInfoMatcherDescription matcherDescription, int updateFlags, IProgressMonitor monitor) throws CoreException; /** * Remove the filter matching the arguments from this container's filter list @@ -509,7 +509,7 @@ public interface IContainer extends IResource, IAdaptable { public void removeFilter(IResourceFilterDescription filterDescription, int updateFlags, IProgressMonitor monitor) throws CoreException; /** - * Retrieve the filters for this container. + * Retrieve all filters on this container. * If no filters exist for this resource, an empty array is returned. * * @return an array of filters diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/IFileInfoMatcherDescription.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/IFileInfoMatcherDescription.java deleted file mode 100644 index 062c69db1..000000000 --- a/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/IFileInfoMatcherDescription.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Freescale Semiconductor and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Serge Beauchamp (Freescale Semiconductor) - initial API and implementation - * IBM - ongoing development - *******************************************************************************/ -package org.eclipse.core.resources; - -/** - * @see IContainer#createFilter(int, IFileInfoMatcherDescription, int, org.eclipse.core.runtime.IProgressMonitor) - * @noimplement This interface is not intended to be implemented by clients. - * @since 3.6 - */ -public interface IFileInfoMatcherDescription { - - /** - * Return the matcher id. - * - * @return the file info matcher id. - */ - public String getId(); - - public void setId(String id); - - /** - * Return the matcher arguments, or null if no arguments exist. - * - * @return the argument string, or null - */ - public Object getArguments(); - - public void setArguments(Object arguments); -}
\ No newline at end of file diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/IResourceFilterDescription.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/IResourceFilterDescription.java index 11374ba4a..1fbf8a9a5 100644 --- a/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/IResourceFilterDescription.java +++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/IResourceFilterDescription.java @@ -12,7 +12,9 @@ package org.eclipse.core.resources; /** - * Interface for resource filters. A filter determines which file system + * A description of a resource filter. + * + * A filter determines which file system * objects will be visible when a local refresh is performed for an IContainer. * * @see IContainer#getFilters() @@ -70,5 +72,5 @@ public interface IResourceFilterDescription { */ public int getType(); - public IFileInfoMatcherDescription getFileInfoMatcherDescription(); + public FileInfoMatcherDescription getFileInfoMatcherDescription(); }
\ No newline at end of file diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/filtermatchers/CompoundFileInfoMatcher.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/filtermatchers/CompoundFileInfoMatcher.java index 91828ba4b..edd64a17a 100644 --- a/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/filtermatchers/CompoundFileInfoMatcher.java +++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/filtermatchers/CompoundFileInfoMatcher.java @@ -24,7 +24,7 @@ public abstract class CompoundFileInfoMatcher extends AbstractFileInfoMatcher { protected AbstractFileInfoMatcher[] filterTypes; protected AbstractFileInfoMatcher instantiate(IProject project, - IFileInfoMatcherDescription filter) { + FileInfoMatcherDescription filter) { IFilterMatcherDescriptor desc = project.getWorkspace().getFilterMatcherDescriptor( filter.getId()); if (desc != null) { @@ -44,7 +44,7 @@ public abstract class CompoundFileInfoMatcher extends AbstractFileInfoMatcher { * .core.resources.IProject, java.lang.Object) */ public final void initialize(IProject project, Object arguments) { - IFileInfoMatcherDescription[] filters = (IFileInfoMatcherDescription[]) arguments; + FileInfoMatcherDescription[] filters = (FileInfoMatcherDescription[]) arguments; filterTypes = new AbstractFileInfoMatcher[filters != null ? filters.length : 0]; for (int i = 0; i < filterTypes.length; i++) diff --git a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/FilteredResourceTest.java b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/FilteredResourceTest.java index 4cf50324d..cb93b0396 100644 --- a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/FilteredResourceTest.java +++ b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/FilteredResourceTest.java @@ -111,9 +111,7 @@ public class FilteredResourceTest extends ResourceTest { */ public void testCreateFilterOnFolder() { try { - IFileInfoMatcherDescription matcherDescription = new FileInfoMatcherDescription(); - matcherDescription.setId(REGEX_FILTER_PROVIDER); - matcherDescription.setArguments("foo"); + FileInfoMatcherDescription matcherDescription = new FileInfoMatcherDescription(REGEX_FILTER_PROVIDER, "foo"); existingFolderInExistingProject.createFilter(IResourceFilterDescription.INCLUDE_ONLY | IResourceFilterDescription.FILES | IResourceFilterDescription.FOLDERS, matcherDescription, 0, getMonitor()); } catch (CoreException e) { fail("1.0"); @@ -166,9 +164,7 @@ public class FilteredResourceTest extends ResourceTest { */ public void testCreateFilterOnProject() { try { - IFileInfoMatcherDescription matcherDescription = new FileInfoMatcherDescription(); - matcherDescription.setId(REGEX_FILTER_PROVIDER); - matcherDescription.setArguments("foo"); + FileInfoMatcherDescription matcherDescription = new FileInfoMatcherDescription(REGEX_FILTER_PROVIDER, "foo"); existingProject.createFilter(IResourceFilterDescription.INCLUDE_ONLY | IResourceFilterDescription.FOLDERS, matcherDescription, 0, getMonitor()); } catch (CoreException e) { fail("1.0"); @@ -237,9 +233,7 @@ public class FilteredResourceTest extends ResourceTest { } try { - IFileInfoMatcherDescription matcherDescription = new FileInfoMatcherDescription(); - matcherDescription.setId(REGEX_FILTER_PROVIDER); - matcherDescription.setArguments("foo"); + FileInfoMatcherDescription matcherDescription = new FileInfoMatcherDescription(REGEX_FILTER_PROVIDER, "foo"); folder.createFilter(IResourceFilterDescription.INCLUDE_ONLY | IResourceFilterDescription.FILES, matcherDescription, 0, getMonitor()); } catch (CoreException e) { fail("1.0"); @@ -301,13 +295,8 @@ public class FilteredResourceTest extends ResourceTest { fail("0.5"); } - IFileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(); - matcherDescription1.setId(REGEX_FILTER_PROVIDER); - matcherDescription1.setArguments(".*\\.cpp"); - - IFileInfoMatcherDescription matcherDescription2 = new FileInfoMatcherDescription(); - matcherDescription2.setId(REGEX_FILTER_PROVIDER); - matcherDescription2.setArguments(".*\\.h"); + FileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(REGEX_FILTER_PROVIDER, ".*\\.cpp"); + FileInfoMatcherDescription matcherDescription2 = new FileInfoMatcherDescription(REGEX_FILTER_PROVIDER, ".*\\.h"); IResourceFilterDescription filterDescription2 = null; @@ -543,13 +532,8 @@ public class FilteredResourceTest extends ResourceTest { fail("0.5"); } - IFileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(); - matcherDescription1.setId(REGEX_FILTER_PROVIDER); - matcherDescription1.setArguments(".*\\.h"); - - IFileInfoMatcherDescription matcherDescription2 = new FileInfoMatcherDescription(); - matcherDescription2.setId(REGEX_FILTER_PROVIDER); - matcherDescription2.setArguments(".*\\.cpp"); + FileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(REGEX_FILTER_PROVIDER, ".*\\.h"); + FileInfoMatcherDescription matcherDescription2 = new FileInfoMatcherDescription(REGEX_FILTER_PROVIDER, ".*\\.cpp"); try { folder.createFilter(IResourceFilterDescription.INCLUDE_ONLY | IResourceFilterDescription.FILES, matcherDescription1, 0, getMonitor()); @@ -647,9 +631,7 @@ public class FilteredResourceTest extends ResourceTest { assertTrue("0.2", !folder2.exists()); assertTrue("0.3", parentLoc.isPrefixOf(childLoc)); - IFileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(); - matcherDescription1.setId(REGEX_FILTER_PROVIDER); - matcherDescription1.setArguments(".*"); + FileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(REGEX_FILTER_PROVIDER, ".*"); IResourceFilterDescription filterDescription1 = null; try { @@ -794,9 +776,7 @@ public class FilteredResourceTest extends ResourceTest { assertTrue("0.2", !folder2.exists()); assertTrue("0.3", parentLoc.isPrefixOf(childLoc)); - IFileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(); - matcherDescription1.setId(REGEX_FILTER_PROVIDER); - matcherDescription1.setArguments(".*"); + FileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(REGEX_FILTER_PROVIDER, ".*"); IResourceFilterDescription filterDescription1 = null; try { @@ -901,9 +881,7 @@ public class FilteredResourceTest extends ResourceTest { assertTrue("0.1", !folder.exists()); - IFileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(); - matcherDescription1.setId(REGEX_FILTER_PROVIDER); - matcherDescription1.setArguments("foo"); + FileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(REGEX_FILTER_PROVIDER, "foo"); try { folder.createFilter(IResourceFilterDescription.INCLUDE_ONLY | IResourceFilterDescription.FILES, matcherDescription1, 0, getMonitor()); @@ -963,9 +941,7 @@ public class FilteredResourceTest extends ResourceTest { * Tests the creation and removal of a simple filter on a folder. */ public void testCreateAndRemoveFilterOnFolder() { - IFileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(); - matcherDescription1.setId(REGEX_FILTER_PROVIDER); - matcherDescription1.setArguments("foo"); + FileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(REGEX_FILTER_PROVIDER, "foo"); IResourceFilterDescription filterDescription = null; try { @@ -1033,9 +1009,7 @@ public class FilteredResourceTest extends ResourceTest { * Tests the creation and removal of a simple filter on a folder. */ public void testCreateAndRemoveFilterOnFolderWithoutClosingProject() { - IFileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(); - matcherDescription1.setId(REGEX_FILTER_PROVIDER); - matcherDescription1.setArguments("foo"); + FileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(REGEX_FILTER_PROVIDER, "foo"); IResourceFilterDescription filterDescription = null; try { @@ -1087,9 +1061,7 @@ public class FilteredResourceTest extends ResourceTest { * Tests the creation of the include-only filter. */ public void testIncludeOnlyFilter() { - IFileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(); - matcherDescription1.setId(REGEX_FILTER_PROVIDER); - matcherDescription1.setArguments(".*\\.c"); + FileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(REGEX_FILTER_PROVIDER, ".*\\.c"); try { existingFolderInExistingProject.createFilter(IResourceFilterDescription.INCLUDE_ONLY | IResourceFilterDescription.FILES | IResourceFilterDescription.FOLDERS, matcherDescription1, 0, getMonitor()); @@ -1121,9 +1093,7 @@ public class FilteredResourceTest extends ResourceTest { assertEquals("2.3", members[1].getType(), IResource.FILE); assertEquals("2.4", members[1].getName(), "foo.c"); - IFileInfoMatcherDescription matcherDescription2 = new FileInfoMatcherDescription(); - matcherDescription2.setId(REGEX_FILTER_PROVIDER); - matcherDescription2.setArguments(".*\\.c"); + FileInfoMatcherDescription matcherDescription2 = new FileInfoMatcherDescription(REGEX_FILTER_PROVIDER, ".*\\.c"); try { existingFolderInExistingProject.createFilter(IResourceFilterDescription.INCLUDE_ONLY | IResourceFilterDescription.FILES | IResourceFilterDescription.FOLDERS, matcherDescription2, 0, getMonitor()); @@ -1154,9 +1124,7 @@ public class FilteredResourceTest extends ResourceTest { * Tests the creation of the exclude-all filter. */ public void testExcludeAllFilter() { - IFileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(); - matcherDescription1.setId(REGEX_FILTER_PROVIDER); - matcherDescription1.setArguments(".*\\.c"); + FileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(REGEX_FILTER_PROVIDER, ".*\\.c"); try { existingFolderInExistingFolder.createFilter(IResourceFilterDescription.EXCLUDE_ALL | IResourceFilterDescription.FILES | IResourceFilterDescription.FOLDERS, matcherDescription1, 0, getMonitor()); @@ -1189,9 +1157,7 @@ public class FilteredResourceTest extends ResourceTest { assertEquals("2.3", members[1].getType(), IResource.FILE); assertEquals("2.4", members[1].getName(), "foo.h"); - IFileInfoMatcherDescription matcherDescription2 = new FileInfoMatcherDescription(); - matcherDescription2.setId(REGEX_FILTER_PROVIDER); - matcherDescription2.setArguments("foo.*"); + FileInfoMatcherDescription matcherDescription2 = new FileInfoMatcherDescription(REGEX_FILTER_PROVIDER, "foo.*"); try { existingFolderInExistingFolder.createFilter(IResourceFilterDescription.EXCLUDE_ALL | IResourceFilterDescription.FILES | IResourceFilterDescription.FOLDERS, matcherDescription2, 0, getMonitor()); @@ -1220,13 +1186,8 @@ public class FilteredResourceTest extends ResourceTest { * Tests the creation of the mixed include-only exclude-all filter. */ public void testMixedFilter() { - IFileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(); - matcherDescription1.setId(REGEX_FILTER_PROVIDER); - matcherDescription1.setArguments(".*\\.c"); - - IFileInfoMatcherDescription matcherDescription2 = new FileInfoMatcherDescription(); - matcherDescription2.setId(REGEX_FILTER_PROVIDER); - matcherDescription2.setArguments("foo.*"); + FileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(REGEX_FILTER_PROVIDER, ".*\\.c"); + FileInfoMatcherDescription matcherDescription2 = new FileInfoMatcherDescription(REGEX_FILTER_PROVIDER, "foo.*"); try { existingFolderInExistingProject.createFilter(IResourceFilterDescription.INCLUDE_ONLY | IResourceFilterDescription.FILES | IResourceFilterDescription.FOLDERS, matcherDescription1, 0, getMonitor()); @@ -1263,13 +1224,8 @@ public class FilteredResourceTest extends ResourceTest { * Tests the creation of inheritable filter. */ public void testInheritedFilter() { - IFileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(); - matcherDescription1.setId(REGEX_FILTER_PROVIDER); - matcherDescription1.setArguments(".*\\.c"); - - IFileInfoMatcherDescription matcherDescription2 = new FileInfoMatcherDescription(); - matcherDescription2.setId(REGEX_FILTER_PROVIDER); - matcherDescription2.setArguments("foo.*"); + FileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(REGEX_FILTER_PROVIDER, ".*\\.c"); + FileInfoMatcherDescription matcherDescription2 = new FileInfoMatcherDescription(REGEX_FILTER_PROVIDER, "foo.*"); try { existingProject.createFilter(IResourceFilterDescription.INCLUDE_ONLY | IResourceFilterDescription.INHERITABLE | IResourceFilterDescription.FILES, matcherDescription1, 0, getMonitor()); @@ -1306,9 +1262,7 @@ public class FilteredResourceTest extends ResourceTest { * Tests the creation of FOLDER filter. */ public void testFolderOnlyFilters() { - IFileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(); - matcherDescription1.setId(REGEX_FILTER_PROVIDER); - matcherDescription1.setArguments("foo.*"); + FileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(REGEX_FILTER_PROVIDER, "foo.*"); try { existingFolderInExistingFolder.createFilter(IResourceFilterDescription.EXCLUDE_ALL | IResourceFilterDescription.FOLDERS, matcherDescription1, 0, getMonitor()); @@ -1342,9 +1296,7 @@ public class FilteredResourceTest extends ResourceTest { * Tests the creation of FILE filter. */ public void testFileOnlyFilters() { - IFileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(); - matcherDescription1.setId(REGEX_FILTER_PROVIDER); - matcherDescription1.setArguments("foo.*"); + FileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(REGEX_FILTER_PROVIDER, "foo.*"); try { existingFolderInExistingFolder.createFilter(IResourceFilterDescription.EXCLUDE_ALL | IResourceFilterDescription.FILES, matcherDescription1, 0, getMonitor()); @@ -1378,9 +1330,7 @@ public class FilteredResourceTest extends ResourceTest { * Tests moving a folder with filters. */ public void testMoveFolderWithFilterToAnotherProject() { - IFileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(); - matcherDescription1.setId(REGEX_FILTER_PROVIDER); - matcherDescription1.setArguments("foo.*"); + FileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(REGEX_FILTER_PROVIDER, "foo.*"); try { existingFolderInExistingProject.createFilter(IResourceFilterDescription.EXCLUDE_ALL | IResourceFilterDescription.FILES, matcherDescription1, 0, getMonitor()); @@ -1433,9 +1383,7 @@ public class FilteredResourceTest extends ResourceTest { * Tests copying a folder with filters. */ public void testCopyFolderWithFilterToAnotherProject() { - IFileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(); - matcherDescription1.setId(REGEX_FILTER_PROVIDER); - matcherDescription1.setArguments("foo.*"); + FileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(REGEX_FILTER_PROVIDER, "foo.*"); try { existingFolderInExistingProject.createFilter(IResourceFilterDescription.EXCLUDE_ALL | IResourceFilterDescription.FILES, matcherDescription1, 0, getMonitor()); @@ -1492,9 +1440,7 @@ public class FilteredResourceTest extends ResourceTest { * Tests copying a folder with filters to another folder. */ public void testCopyFolderWithFilterToAnotherFolder() { - IFileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(); - matcherDescription1.setId(REGEX_FILTER_PROVIDER); - matcherDescription1.setArguments("foo.*"); + FileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(REGEX_FILTER_PROVIDER, "foo.*"); try { existingFolderInExistingProject.createFilter(IResourceFilterDescription.EXCLUDE_ALL | IResourceFilterDescription.FILES, matcherDescription1, 0, getMonitor()); @@ -1553,9 +1499,7 @@ public class FilteredResourceTest extends ResourceTest { * Tests moving a folder with filters to another folder. */ public void testMoveFolderWithFilterToAnotherFolder() { - IFileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(); - matcherDescription1.setId(REGEX_FILTER_PROVIDER); - matcherDescription1.setArguments("foo.*"); + FileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(REGEX_FILTER_PROVIDER, "foo.*"); try { existingFolderInExistingProject.createFilter(IResourceFilterDescription.EXCLUDE_ALL | IResourceFilterDescription.FILES, matcherDescription1, 0, getMonitor()); @@ -1610,13 +1554,8 @@ public class FilteredResourceTest extends ResourceTest { * Tests deleting a folder with filters. */ public void testDeleteFolderWithFilterToAnotherFolder() { - IFileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(); - matcherDescription1.setId(REGEX_FILTER_PROVIDER); - matcherDescription1.setArguments("foo.*"); - - IFileInfoMatcherDescription matcherDescription2 = new FileInfoMatcherDescription(); - matcherDescription2.setId(REGEX_FILTER_PROVIDER); - matcherDescription2.setArguments(".*\\.c"); + FileInfoMatcherDescription matcherDescription1 = new FileInfoMatcherDescription(REGEX_FILTER_PROVIDER, "foo.*"); + FileInfoMatcherDescription matcherDescription2 = new FileInfoMatcherDescription(REGEX_FILTER_PROVIDER, ".*\\.c"); try { existingFolderInExistingProject.createFilter(IResourceFilterDescription.EXCLUDE_ALL | IResourceFilterDescription.FILES, matcherDescription1, 0, getMonitor()); |