diff --git a/core/org.eclipse.cdt.core/ChangeLog b/core/org.eclipse.cdt.core/ChangeLog index 43255f391cb..0b149a878e7 100644 --- a/core/org.eclipse.cdt.core/ChangeLog +++ b/core/org.eclipse.cdt.core/ChangeLog @@ -1,3 +1,9 @@ +2004-03-25 David Inglis + + Added util class for core model + + * src/org/eclipse/cdt/core/model/CoreModelUtil.java + 2004-03-25 David Inglis Update to allow non-owned projects and added better recovery of deleted .cdtprojects via nature id diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/CoreModelUtil.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/CoreModelUtil.java new file mode 100644 index 00000000000..94ec2529605 --- /dev/null +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/CoreModelUtil.java @@ -0,0 +1,35 @@ +package org.eclipse.cdt.core.model; + +import org.eclipse.cdt.internal.core.CharOperation; +import org.eclipse.core.runtime.IPath; + +public class CoreModelUtil { + + public static boolean isExcludedPath(IPath resourcePath, IPath[] exclusionPatterns) { + char[] path = resourcePath.toString().toCharArray(); + for (int i = 0, length = exclusionPatterns.length; i < length; i++) { + char[] pattern = exclusionPatterns[i].toString().toCharArray(); + if (CharOperation.pathMatch(pattern, path, true, '/')) { + return true; + } + } + return false; + } + + /* + * Returns whether the given resource path matches one of the exclusion + * patterns. + * + * @see IPathEntry#getExclusionPatterns + */ + public final static boolean isExcluded(IPath resourcePath, char[][] exclusionPatterns) { + if (exclusionPatterns == null) + return false; + char[] path = resourcePath.toString().toCharArray(); + for (int i = 0, length = exclusionPatterns.length; i < length; i++) + if (CharOperation.pathMatch(exclusionPatterns[i], path, true, '/')) + return true; + return false; + } + +} \ No newline at end of file