List of usage examples for org.eclipse.jdt.core.compiler CharOperation pathMatch
public static final boolean pathMatch(char[] pattern, char[] filepath, boolean isCaseSensitive, char pathSeparator)
From source file:at.bestsolution.javafx.ide.jdt.internal.jdt.JavaModelUtil.java
License:Open Source License
public 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; }
From source file:at.bestsolution.javafx.ide.jdt.internal.jdt.JavaModelUtil.java
License:Open Source License
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; }//from ww w .j av a2s. c o m } return false; }
From source file:com.codenvy.ide.ext.java.emul.AccessRuleSet.java
License:Open Source License
/** * Select the first access rule which is violated when accessing a given type, * or null if no 'non accessible' access rule applies. * * @param targetTypeFilePath/* ww w . j a va 2 s. c o m*/ * the target type file path, formed as: * "org/eclipse/jdt/core/JavaCore" * @return the first access restriction that applies if any, null else */ public AccessRestriction getViolatedRestriction(char[] targetTypeFilePath) { for (int i = 0, length = this.accessRules.length; i < length; i++) { AccessRule accessRule = this.accessRules[i]; if (CharOperation.pathMatch(accessRule.pattern, targetTypeFilePath, true/*case sensitive*/, '/')) { switch (accessRule.getProblemId()) { case IProblem.ForbiddenReference: case IProblem.DiscouragedReference: return new AccessRestriction(accessRule, this.classpathEntryType, this.classpathEntryName); default: return null; } } } return null; }
From source file:org.eclipse.jst.j2ee.internal.common.operations.JavaModelUtil.java
License:Open Source License
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; }
From source file:org.eclipse.jst.jsf.common.ui.internal.utils.JavaModelUtil.java
License:Open Source License
/** * @param resourcePath/* w w w. j a v a 2 s. c o m*/ * @param exclusionPatterns * @return true if resourcePath is excluded by exclusion patterns */ 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; }
From source file:org.eclipse.jst.jsf.common.ui.internal.utils.JavaModelUtil.java
License:Open Source License
/** * Returns whether the given resource path matches one of the exclusion * patterns./*from w w w . j a v a 2s. c o m*/ * * @param resourcePath * @param exclusionPatterns * @return true if resourcePath is excluded */ public 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; }
From source file:org.eclipse.xtext.xbase.ui.validation.XbaseUIValidator.java
License:Open Source License
protected RestrictionKind computeRestriction(IJavaProject project, IType type) { try {//from w w w . j a v a 2 s . c o m IPackageFragmentRoot root = (IPackageFragmentRoot) type.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT); if (root == null) { return RestrictionKind.VALID; } IClasspathEntry entry = getResolvedClasspathEntry(project, root); if (entry == null) { return RestrictionKind.VALID; } IAccessRule[] rules = entry.getAccessRules(); String typePath = type.getFullyQualifiedName().replace('.', '/'); char[] typePathAsArray = typePath.toCharArray(); for (IAccessRule rule : rules) { char[] patternArray = ((ClasspathAccessRule) rule).pattern; if (CharOperation.pathMatch(patternArray, typePathAsArray, true, '/')) { if (rule.getKind() == IAccessRule.K_DISCOURAGED) { return RestrictionKind.DISCOURAGED; } else if (rule.getKind() == IAccessRule.K_NON_ACCESSIBLE) { return RestrictionKind.FORBIDDEN; } return RestrictionKind.VALID; } } } catch (JavaModelException jme) { // ignore } return RestrictionKind.VALID; }