本文整理汇总了Java中org.eclipse.jdt.core.IAccessRule.K_NON_ACCESSIBLE属性的典型用法代码示例。如果您正苦于以下问题:Java IAccessRule.K_NON_ACCESSIBLE属性的具体用法?Java IAccessRule.K_NON_ACCESSIBLE怎么用?Java IAccessRule.K_NON_ACCESSIBLE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.jdt.core.IAccessRule
的用法示例。
在下文中一共展示了IAccessRule.K_NON_ACCESSIBLE属性的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newAccessRule
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;
}
}
};
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:23,代码来源:LibraryClasspathContainerSerializerTest.java
示例2: isFiltered
public static boolean isFiltered(TypeNameMatch match) {
boolean filteredByPattern = getDefault().filter(match.getFullyQualifiedName());
if (filteredByPattern) return true;
int accessibility = match.getAccessibility();
switch (accessibility) {
case IAccessRule.K_NON_ACCESSIBLE:
return JavaCore.ENABLED.equals(
JavaCore.getOption(JavaCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK));
case IAccessRule.K_DISCOURAGED:
return JavaCore.ENABLED.equals(
JavaCore.getOption(JavaCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK));
default:
return false;
}
}
示例3: forInt
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);
}
}
示例4: getAccessRules
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;
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:10,代码来源:LibraryClasspathContainerResolverService.java
示例5: decodeAccessRules
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;
}
示例6: isFiltered
public static boolean isFiltered(TypeNameMatch match) {
boolean filteredByPattern= getDefault().filter(match.getFullyQualifiedName());
if (filteredByPattern)
return true;
int accessibility= match.getAccessibility();
switch (accessibility) {
case IAccessRule.K_NON_ACCESSIBLE:
return JavaCore.ENABLED.equals(JavaCore.getOption(JavaCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK));
case IAccessRule.K_DISCOURAGED:
return JavaCore.ENABLED.equals(JavaCore.getOption(JavaCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK));
default:
return false;
}
}
示例7: getResolutionImage
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;
}
示例8: getResolutionLabel
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$
}
示例9: decodeAccessRules
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;
}
示例10: inScope
private boolean inScope(TypeNameMatch match) {
if (TypeFilter.isFiltered(match))
return false;
int accessibility= match.getAccessibility();
switch (accessibility) {
case IAccessRule.K_NON_ACCESSIBLE:
return JavaCore.DISABLED.equals(JavaCore.getOption(JavaCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK));
case IAccessRule.K_DISCOURAGED:
return JavaCore.DISABLED.equals(JavaCore.getOption(JavaCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK));
default:
return true;
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:14,代码来源:TypeNameMatchCollector.java
示例11: AccessRuleEntryDialog
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;
}
}
}
}
示例12: acceptConstructor
public void acceptConstructor(
int modifiers,
char[] simpleTypeName,
int parameterCount,
char[] signature,
char[][] parameterTypes,
char[][] parameterNames,
int typeModifiers,
char[] packageName,
int extraFlags,
String path,
AccessRestriction accessRestriction) {
// does not check cancellation for every types to avoid performance loss
if ((this.foundConstructorsCount % (CHECK_CANCEL_FREQUENCY)) == 0) checkCancel();
this.foundConstructorsCount++;
if ((typeModifiers & ClassFileConstants.AccEnum) != 0) return;
if (this.options.checkDeprecation && (typeModifiers & ClassFileConstants.AccDeprecated) != 0) return;
if (this.options.checkVisibility) {
if((typeModifiers & ClassFileConstants.AccPublic) == 0) {
if((typeModifiers & ClassFileConstants.AccPrivate) != 0) return;
if (this.currentPackageName == null) {
initializePackageCache();
}
if(!CharOperation.equals(packageName, this.currentPackageName)) return;
}
}
int accessibility = IAccessRule.K_ACCESSIBLE;
if(accessRestriction != null) {
switch (accessRestriction.getProblemId()) {
case IProblem.ForbiddenReference:
if (this.options.checkForbiddenReference) {
return;
}
accessibility = IAccessRule.K_NON_ACCESSIBLE;
break;
case IProblem.DiscouragedReference:
if (this.options.checkDiscouragedReference) {
return;
}
accessibility = IAccessRule.K_DISCOURAGED;
break;
}
}
if(this.acceptedConstructors == null) {
this.acceptedConstructors = new ObjectVector();
}
this.acceptedConstructors.add(
new AcceptedConstructor(
modifiers,
simpleTypeName,
parameterCount,
signature,
parameterTypes,
parameterNames,
typeModifiers,
packageName,
extraFlags,
accessibility));
}
示例13: acceptType
/**
* One result of the search consists of a new type.
*
* NOTE - All package and type names are presented in their readable form:
* Package names are in the form "a.b.c".
* Nested type names are in the qualified form "A.I".
* The default package is represented by an empty array.
*/
public void acceptType(
char[] packageName,
char[] simpleTypeName,
char[][] enclosingTypeNames,
int modifiers,
AccessRestriction accessRestriction) {
// does not check cancellation for every types to avoid performance loss
if ((this.foundTypesCount % CHECK_CANCEL_FREQUENCY) == 0) checkCancel();
this.foundTypesCount++;
if (this.options.checkDeprecation && (modifiers & ClassFileConstants.AccDeprecated) != 0) return;
if (this.assistNodeIsExtendedType && (modifiers & ClassFileConstants.AccFinal) != 0) return;
if (this.options.checkVisibility) {
if((modifiers & ClassFileConstants.AccPublic) == 0) {
if((modifiers & ClassFileConstants.AccPrivate) != 0) return;
char[] currentPackage = CharOperation.concatWith(this.unitScope.fPackage.compoundName, '.');
if(!CharOperation.equals(packageName, currentPackage)) return;
}
}
int accessibility = IAccessRule.K_ACCESSIBLE;
if(accessRestriction != null) {
switch (accessRestriction.getProblemId()) {
case IProblem.ForbiddenReference:
if (this.options.checkForbiddenReference) {
return;
}
accessibility = IAccessRule.K_NON_ACCESSIBLE;
break;
case IProblem.DiscouragedReference:
if (this.options.checkDiscouragedReference) {
return;
}
accessibility = IAccessRule.K_DISCOURAGED;
break;
}
}
if (isForbidden(packageName, simpleTypeName, enclosingTypeNames)) {
return;
}
if(this.acceptedTypes == null) {
this.acceptedTypes = new ObjectVector();
}
this.acceptedTypes.add(new AcceptedType(packageName, simpleTypeName, enclosingTypeNames, modifiers, accessibility));
}
示例14: findParameterizedType
private void findParameterizedType(TypeReference ref, Scope scope) {
ReferenceBinding refBinding = (ReferenceBinding) ref.resolvedType;
if(refBinding != null) {
if (this.options.checkDeprecation &&
refBinding.isViewedAsDeprecated() &&
!scope.isDefinedInSameUnit(refBinding))
return;
int accessibility = IAccessRule.K_ACCESSIBLE;
if(refBinding.hasRestrictedAccess()) {
AccessRestriction accessRestriction = this.lookupEnvironment.getAccessRestriction(refBinding);
if(accessRestriction != null) {
switch (accessRestriction.getProblemId()) {
case IProblem.ForbiddenReference:
if (this.options.checkForbiddenReference) {
return;
}
accessibility = IAccessRule.K_NON_ACCESSIBLE;
break;
case IProblem.DiscouragedReference:
if (this.options.checkDiscouragedReference) {
return;
}
accessibility = IAccessRule.K_DISCOURAGED;
break;
}
}
}
int relevance = computeBaseRelevance();
relevance += computeRelevanceForResolution();
relevance += computeRelevanceForInterestingProposal();
relevance += computeRelevanceForCaseMatching(refBinding.sourceName, refBinding.sourceName);
relevance += computeRelevanceForExpectingType(refBinding);
relevance += computeRelevanceForQualification(false);
relevance += computeRelevanceForRestrictions(accessibility); // no access restriction for type in the current unit
if(!this.requestor.isIgnored(CompletionProposal.TYPE_REF)) {
createTypeProposal(
refBinding,
refBinding.qualifiedSourceName(),
IAccessRule.K_ACCESSIBLE,
CharOperation.NO_CHAR,
relevance,
null,
null,
null,
false);
}
}
}