Java Code Examples for org.eclipse.jdt.core.IAccessRule#K_ACCESSIBLE
The following examples show how to use
org.eclipse.jdt.core.IAccessRule#K_ACCESSIBLE .
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: LibraryClasspathContainerSerializerTest.java From google-cloud-eclipse with Apache License 2.0 | 6 votes |
private static IAccessRule newAccessRule(final String pattern, final boolean accessible) { return new IAccessRule() { @Override public boolean ignoreIfBetter() { return false; } @Override public IPath getPattern() { return new Path(pattern); } @Override public int getKind() { if (accessible) { return IAccessRule.K_ACCESSIBLE; } else { return IAccessRule.K_NON_ACCESSIBLE; } } }; }
Example 2
Source File: SerializableAccessRules.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
static AccessRuleKind forInt(int kind) { switch (kind) { case IAccessRule.K_ACCESSIBLE: return ACCESSIBLE; case IAccessRule.K_DISCOURAGED: return DISCOURAGED; case IAccessRule.K_NON_ACCESSIBLE: return FORBIDDEN; default: throw new IllegalArgumentException("Invalid access rule kind value: " + kind); } }
Example 3
Source File: LibraryClasspathContainerResolverService.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
private static IAccessRule[] getAccessRules(List<Filter> filters) { IAccessRule[] accessRules = new IAccessRule[filters.size()]; int idx = 0; for (Filter filter : filters) { int accessRuleKind = filter.isExclude() ? IAccessRule.K_NON_ACCESSIBLE : IAccessRule.K_ACCESSIBLE; accessRules[idx++] = JavaCore.newAccessRule(new Path(filter.getPattern()), accessRuleKind); } return accessRules; }
Example 4
Source File: AccessRulesLabelProvider.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public static Image getResolutionImage(int kind) { switch (kind) { case IAccessRule.K_ACCESSIBLE: return JavaPluginImages.get(JavaPluginImages.IMG_OBJS_NLS_TRANSLATE); case IAccessRule.K_DISCOURAGED: return JavaPluginImages.get(JavaPluginImages.IMG_OBJS_REFACTORING_WARNING); case IAccessRule.K_NON_ACCESSIBLE: return JavaPluginImages.get(JavaPluginImages.IMG_OBJS_REFACTORING_ERROR); } return null; }
Example 5
Source File: AccessRulesLabelProvider.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public static String getResolutionLabel(int kind) { switch (kind) { case IAccessRule.K_ACCESSIBLE: return NewWizardMessages.AccessRulesLabelProvider_kind_accessible; case IAccessRule.K_DISCOURAGED: return NewWizardMessages.AccessRulesLabelProvider_kind_discouraged; case IAccessRule.K_NON_ACCESSIBLE: return NewWizardMessages.AccessRulesLabelProvider_kind_non_accessible; } return ""; //$NON-NLS-1$ }
Example 6
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 7
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; }
Example 8
Source File: AccessRuleEntryDialog.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public AccessRuleEntryDialog(Shell parent, IAccessRule ruleToEdit, CPListElement entryToEdit) { super(parent); String title, message; if (ruleToEdit == null) { title= NewWizardMessages.TypeRestrictionEntryDialog_add_title; } else { title= NewWizardMessages.TypeRestrictionEntryDialog_edit_title; } message= Messages.format(NewWizardMessages.TypeRestrictionEntryDialog_pattern_label, BasicElementLabels.getPathLabel(entryToEdit.getPath(), false)); setTitle(title); fPatternStatus= new StatusInfo(); TypeRulesAdapter adapter= new TypeRulesAdapter(); fPatternDialog= new StringDialogField(); fPatternDialog.setLabelText(message); fPatternDialog.setDialogFieldListener(adapter); fRuleKindCombo= new ComboDialogField(SWT.READ_ONLY); fRuleKindCombo.setLabelText(NewWizardMessages.TypeRestrictionEntryDialog_kind_label); fRuleKindCombo.setDialogFieldListener(adapter); String[] items= { NewWizardMessages.TypeRestrictionEntryDialog_kind_non_accessible, NewWizardMessages.TypeRestrictionEntryDialog_kind_discourraged, NewWizardMessages.TypeRestrictionEntryDialog_kind_accessible }; fRuleKinds= new int[] { IAccessRule.K_NON_ACCESSIBLE, IAccessRule.K_DISCOURAGED, IAccessRule.K_ACCESSIBLE }; fRuleKindCombo.setItems(items); if (ruleToEdit == null) { fPatternDialog.setText(""); //$NON-NLS-1$ fRuleKindCombo.selectItem(0); } else { fPatternDialog.setText(ruleToEdit.getPattern().toString()); for (int i= 0; i < fRuleKinds.length; i++) { if (fRuleKinds[i] == ruleToEdit.getKind()) { fRuleKindCombo.selectItem(i); break; } } } }