Java Code Examples for org.eclipse.jdt.core.IAccessRule#IGNORE_IF_BETTER
The following examples show how to use
org.eclipse.jdt.core.IAccessRule#IGNORE_IF_BETTER .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClasspathAccessRule.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private static int toProblemId(int kind) { boolean ignoreIfBetter = (kind & IAccessRule.IGNORE_IF_BETTER) != 0; switch (kind & ~IAccessRule.IGNORE_IF_BETTER) { case K_NON_ACCESSIBLE: return ignoreIfBetter ? IProblem.ForbiddenReference | AccessRule.IgnoreIfBetter : IProblem.ForbiddenReference; case K_DISCOURAGED: return ignoreIfBetter ? IProblem.DiscouragedReference | AccessRule.IgnoreIfBetter : IProblem.DiscouragedReference; default: return ignoreIfBetter ? AccessRule.IgnoreIfBetter : 0; } }
Example 2
Source File: ClasspathEntry.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
static IAccessRule[] decodeAccessRules(NodeList list) { if (list == null) return null; int length = list.getLength(); if (length == 0) return null; IAccessRule[] result = new IAccessRule[length]; int index = 0; for (int i = 0; i < length; i++) { Node accessRule = list.item(i); if (accessRule.getNodeType() == Node.ELEMENT_NODE) { Element elementAccessRule = (Element) accessRule; String pattern = elementAccessRule.getAttribute(TAG_PATTERN); if (pattern == null) continue; String tagKind = elementAccessRule.getAttribute(TAG_KIND); int kind; if (TAG_ACCESSIBLE.equals(tagKind)) kind = IAccessRule.K_ACCESSIBLE; else if (TAG_NON_ACCESSIBLE.equals(tagKind)) kind = IAccessRule.K_NON_ACCESSIBLE; else if (TAG_DISCOURAGED.equals(tagKind)) kind = IAccessRule.K_DISCOURAGED; else continue; boolean ignoreIfBetter = "true".equals(elementAccessRule.getAttribute(TAG_IGNORE_IF_BETTER)); //$NON-NLS-1$ result[index++] = new ClasspathAccessRule(new Path(pattern), ignoreIfBetter ? kind | IAccessRule.IGNORE_IF_BETTER : kind); } } if (index != length) System.arraycopy(result, 0, result = new IAccessRule[index], 0, index); return result; }
Example 3
Source File: JavaClasspathParser.java From sarl with Apache License 2.0 | 5 votes |
@SuppressWarnings({ "checkstyle:npathcomplexity", "checkstyle:innerassignment" }) private static IAccessRule[] decodeAccessRules(NodeList list) { if (list == null) { return null; } final int length = list.getLength(); if (length == 0) { return null; } IAccessRule[] result = new IAccessRule[length]; int index = 0; for (int i = 0; i < length; i++) { final Node accessRule = list.item(i); if (accessRule.getNodeType() == Node.ELEMENT_NODE) { final Element elementAccessRule = (Element) accessRule; final String pattern = elementAccessRule.getAttribute(ClasspathEntry.TAG_PATTERN); if (pattern == null) { continue; } final String tagKind = elementAccessRule.getAttribute(ClasspathEntry.TAG_KIND); final int kind; if (ClasspathEntry.TAG_ACCESSIBLE.equals(tagKind)) { kind = IAccessRule.K_ACCESSIBLE; } else if (ClasspathEntry.TAG_NON_ACCESSIBLE.equals(tagKind)) { kind = IAccessRule.K_NON_ACCESSIBLE; } else if (ClasspathEntry.TAG_DISCOURAGED.equals(tagKind)) { kind = IAccessRule.K_DISCOURAGED; } else { continue; } final boolean ignoreIfBetter = "true".equals(elementAccessRule.getAttribute(ClasspathEntry.TAG_IGNORE_IF_BETTER)); //$NON-NLS-1$ result[index++] = new ClasspathAccessRule(new Path(pattern), ignoreIfBetter ? kind | IAccessRule.IGNORE_IF_BETTER : kind); } } if (index != length) { System.arraycopy(result, 0, result = new IAccessRule[index], 0, index); } return result; }