diff options
author | Michael Valenta | 2007-06-28 18:11:41 +0000 |
---|---|---|
committer | Michael Valenta | 2007-06-28 18:11:41 +0000 |
commit | 5b000a67a6e84cc07c2470f91e9fd1a452e8508f (patch) | |
tree | fd021b0c3f63de40c23b818084d14cd8f55d07ba | |
parent | c46f7e131ac185f245660ad32c58394329ba379d (diff) | |
download | eclipse.platform.team-5b000a67a6e84cc07c2470f91e9fd1a452e8508f.tar.gz eclipse.platform.team-5b000a67a6e84cc07c2470f91e9fd1a452e8508f.tar.xz eclipse.platform.team-5b000a67a6e84cc07c2470f91e9fd1a452e8508f.zip |
[Bug 39239] [Preferences] Ignored Resources should accept multi directory pattern
-rw-r--r-- | bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java | 10 | ||||
-rw-r--r-- | bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/StringMatcher.java | 12 |
2 files changed, 19 insertions, 3 deletions
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java index 7c54cd22f..550819758 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java @@ -88,12 +88,12 @@ public final class Team { } /** - * Returns whether the given file should be ignored. + * Returns whether the given file or folder with its content should be ignored. * * This method answers true if the file matches one of the global ignore * patterns, or if the file is marked as derived. * - * @param resource the file + * @param resource the file or folder * @return whether the file should be ignored */ public static boolean isIgnoredHint(IResource resource) { @@ -113,7 +113,11 @@ public final class Team { private static boolean matchesEnabledIgnore(IResource resource) { StringMatcher[] matchers = getStringMatchers(); for (int i = 0; i < matchers.length; i++) { - if (matchers[i].match(resource.getName())) return true; + String resourceName = resource.getName(); + if(matchers[i].isPathPattern()) { + resourceName = resource.getFullPath().toString(); + } + if (matchers[i].match(resourceName)) return true; } return false; } diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/StringMatcher.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/StringMatcher.java index 8597e5d97..412e56928 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/StringMatcher.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/StringMatcher.java @@ -29,6 +29,7 @@ public class StringMatcher { /* boundary value beyond which we don't need to search in the text */ protected int fBound = 0; + private boolean pathPattern; protected static final char fSingleWildCard = '\u0000'; @@ -126,6 +127,8 @@ public class StringMatcher { fIgnoreWildCards = ignoreWildCards; fLength = aPattern.length(); + pathPattern = aPattern.indexOf('/') != -1; + /* convert case */ if (fIgnoreCase) { fPattern = aPattern.toUpperCase(); @@ -224,6 +227,15 @@ public class StringMatcher { public boolean match(String text) { return match(text, 0, text.length()); } + + /** + * check existence of '/' in the pattern. + * @return <b>true</b> if pattern contains '/' + */ + public boolean isPathPattern() { + return pathPattern; + } + /** * This method parses the given pattern into segments seperated by wildcard '*' characters. * Since wildcards are not being used in this case, the pattern consists of a single segment. |