本文整理汇总了Java中org.eclipse.jdt.core.Flags.isInterface方法的典型用法代码示例。如果您正苦于以下问题:Java Flags.isInterface方法的具体用法?Java Flags.isInterface怎么用?Java Flags.isInterface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.Flags
的用法示例。
在下文中一共展示了Flags.isInterface方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isAccessibleClass
import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
private static boolean isAccessibleClass(IType type) throws JavaModelException {
int flags = type.getFlags();
if (Flags.isInterface(flags)) {
return false;
}
IJavaElement parent = type.getParent();
while (true) {
if (parent instanceof ICompilationUnit || parent instanceof IClassFile) {
return true;
}
if (!(parent instanceof IType) || !Flags.isStatic(flags) || !Flags.isPublic(flags)) {
return false;
}
flags = ((IType) parent).getFlags();
parent = parent.getParent();
}
}
示例2: isOfKind
import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
private boolean isOfKind(TypeNameMatch curr, int typeKinds, boolean is50OrHigher) {
int flags= curr.getModifiers();
if (Flags.isAnnotation(flags)) {
return is50OrHigher && (typeKinds & SimilarElementsRequestor.ANNOTATIONS) != 0;
}
if (Flags.isEnum(flags)) {
return is50OrHigher && (typeKinds & SimilarElementsRequestor.ENUMS) != 0;
}
if (Flags.isInterface(flags)) {
return (typeKinds & SimilarElementsRequestor.INTERFACES) != 0;
}
return (typeKinds & SimilarElementsRequestor.CLASSES) != 0;
}
示例3: getKind
import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
private static final int getKind(int flags, char[] typeNameSig) {
if (Signature.getTypeSignatureKind(typeNameSig) == Signature.TYPE_VARIABLE_SIGNATURE) {
return VARIABLES;
}
if (Flags.isAnnotation(flags)) {
return ANNOTATIONS;
}
if (Flags.isInterface(flags)) {
return INTERFACES;
}
if (Flags.isEnum(flags)) {
return ENUMS;
}
return CLASSES;
}
示例4: createTypeImageDescriptor
import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
ImageDescriptor createTypeImageDescriptor(CompletionProposal proposal) {
final int flags = proposal.getFlags();
boolean isInterfaceOrAnnotation = Flags.isInterface(flags) || Flags.isAnnotation(flags);
return decorateImageDescriptor(
JavaElementImageProvider.getTypeImageDescriptor(
true /* in order to get all visibility decorations */,
isInterfaceOrAnnotation,
flags,
false),
proposal);
}
示例5: isOfKind
import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
private boolean isOfKind(TypeNameMatch curr, int typeKinds, boolean is50OrHigher) {
int flags = curr.getModifiers();
if (Flags.isAnnotation(flags)) {
return is50OrHigher && ((typeKinds & SimilarElementsRequestor.ANNOTATIONS) != 0);
}
if (Flags.isEnum(flags)) {
return is50OrHigher && ((typeKinds & SimilarElementsRequestor.ENUMS) != 0);
}
if (Flags.isInterface(flags)) {
return (typeKinds & SimilarElementsRequestor.INTERFACES) != 0;
}
return (typeKinds & SimilarElementsRequestor.CLASSES) != 0;
}
示例6: isOfKind
import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
private boolean isOfKind(TypeNameMatch curr, int typeKinds, boolean is50OrHigher) {
int flags = curr.getModifiers();
if (Flags.isAnnotation(flags)) {
return is50OrHigher && (typeKinds & SimilarElementsRequestor.ANNOTATIONS) != 0;
}
if (Flags.isEnum(flags)) {
return is50OrHigher && (typeKinds & SimilarElementsRequestor.ENUMS) != 0;
}
if (Flags.isInterface(flags)) {
return (typeKinds & SimilarElementsRequestor.INTERFACES) != 0;
}
return (typeKinds & SimilarElementsRequestor.CLASSES) != 0;
}
示例7: getKind
import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
private static final int getKind(int flags, char[] typeNameSig) {
if (Signature.getTypeSignatureKind(typeNameSig) == Signature.TYPE_VARIABLE_SIGNATURE) {
return VARIABLES;
}
if (Flags.isAnnotation(flags)) {
return ANNOTATIONS;
}
if (Flags.isInterface(flags)) {
return INTERFACES;
}
if (Flags.isEnum(flags)) {
return ENUMS;
}
return CLASSES;
}
示例8: getTypeImageDescriptor
import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
public static ImageDescriptor getTypeImageDescriptor(
boolean isInner, boolean isInInterfaceOrAnnotation, int flags, boolean useLightIcons) {
if (Flags.isEnum(flags)) {
if (useLightIcons) {
return JavaPluginImages.DESC_OBJS_ENUM_ALT;
}
if (isInner) {
return getInnerEnumImageDescriptor(isInInterfaceOrAnnotation, flags);
}
return getEnumImageDescriptor(flags);
} else if (Flags.isAnnotation(flags)) {
if (useLightIcons) {
return JavaPluginImages.DESC_OBJS_ANNOTATION_ALT;
}
if (isInner) {
return getInnerAnnotationImageDescriptor(isInInterfaceOrAnnotation, flags);
}
return getAnnotationImageDescriptor(flags);
} else if (Flags.isInterface(flags)) {
if (useLightIcons) {
return JavaPluginImages.DESC_OBJS_INTERFACEALT;
}
if (isInner) {
return getInnerInterfaceImageDescriptor(isInInterfaceOrAnnotation, flags);
}
return getInterfaceImageDescriptor(flags);
} else {
if (useLightIcons) {
return JavaPluginImages.DESC_OBJS_CLASSALT;
}
if (isInner) {
return getInnerClassImageDescriptor(isInInterfaceOrAnnotation, flags);
}
return getClassImageDescriptor(flags);
}
}
示例9: createJavaCompletionProposal
import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
@Override
protected IJavaCompletionProposal createJavaCompletionProposal(
CompletionProposal proposal) {
if (collectMethods) {
if (CompletionProposal.METHOD_REF == proposal.getKind()
&& Flags.isPublic(proposal.getFlags())) {
char[] sig = proposal.getSignature();
char[] declSig = proposal.getDeclarationSignature();
// collect methods suitable for action methods ignoring Object
// methods
if (sig != null && declSig != null
&& ACTION_METHOD_SIGNATURE.equals(String.valueOf(sig))
&& !OBJECT_SIGNATURE.equals(String.valueOf(declSig))) {
return new SimpleJavaCompletionProposal(proposal,
getInvocationContext(), getImage(getLabelProvider()
.createImageDescriptor(proposal)));
}
}
} else {
// collect packages and classes suitable for actions
if ((CompletionProposal.PACKAGE_REF == proposal.getKind() || CompletionProposal.TYPE_REF == proposal
.getKind())
&& !Flags.isAbstract(proposal.getFlags())
&& !Flags.isInterface(proposal.getFlags())
&& !Flags.isEnum(proposal.getFlags())) {
return new SimpleJavaCompletionProposal(proposal,
getInvocationContext(), getImage(getLabelProvider()
.createImageDescriptor(proposal)));
}
}
return null;
}
示例10: getModifiers
import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
private String getModifiers(int flags, int typeFlags) {
StringBuilder modifiers = new StringBuilder();
// package private modifier has no string representation
if (Flags.isPublic(flags)) {
modifiers.append("public ");
}
if (Flags.isProtected(flags)) {
modifiers.append("protected ");
}
if (Flags.isPrivate(flags)) {
modifiers.append("private ");
}
if (Flags.isStatic(flags)) {
modifiers.append("static ");
}
if (Flags.isAbstract(flags) && !Flags.isInterface(typeFlags)) {
modifiers.append("abstract ");
}
if (Flags.isFinal(flags)) {
modifiers.append("final ");
}
if (Flags.isNative(flags)) {
modifiers.append("native ");
}
if (Flags.isSynchronized(flags)) {
modifiers.append("synchronized ");
}
if (Flags.isVolatile(flags)) {
modifiers.append("volatile ");
}
int len = modifiers.length();
if (len == 0) return "";
modifiers.setLength(len - 1);
return modifiers.toString();
}
示例11: decorateImageDescriptor
import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
/**
* Returns a version of <code>descriptor</code> decorated according to the passed <code>modifier
* </code> flags.
*
* @param descriptor the image descriptor to decorate
* @param proposal the proposal
* @return an image descriptor for a method proposal
* @see org.eclipse.jdt.core.Flags
*/
private ImageDescriptor decorateImageDescriptor(
ImageDescriptor descriptor, CompletionProposal proposal) {
int adornments = 0;
int flags = proposal.getFlags();
int kind = proposal.getKind();
boolean deprecated = Flags.isDeprecated(flags);
if (!deprecated) {
CompletionProposal[] requiredProposals = proposal.getRequiredProposals();
if (requiredProposals != null) {
for (int i = 0; i < requiredProposals.length; i++) {
CompletionProposal requiredProposal = requiredProposals[i];
if (requiredProposal.getKind() == CompletionProposal.TYPE_REF) {
deprecated |= Flags.isDeprecated(requiredProposal.getFlags());
}
}
}
}
if (deprecated) adornments |= JavaElementImageDescriptor.DEPRECATED;
if (kind == CompletionProposal.FIELD_REF
|| kind == CompletionProposal.METHOD_DECLARATION
|| kind == CompletionProposal.METHOD_NAME_REFERENCE
|| kind == CompletionProposal.METHOD_REF
|| kind == CompletionProposal.CONSTRUCTOR_INVOCATION)
if (Flags.isStatic(flags)) adornments |= JavaElementImageDescriptor.STATIC;
if (kind == CompletionProposal.METHOD_DECLARATION
|| kind == CompletionProposal.METHOD_NAME_REFERENCE
|| kind == CompletionProposal.METHOD_REF
|| kind == CompletionProposal.CONSTRUCTOR_INVOCATION)
if (Flags.isSynchronized(flags)) adornments |= JavaElementImageDescriptor.SYNCHRONIZED;
if (kind == CompletionProposal.METHOD_DECLARATION
|| kind == CompletionProposal.METHOD_NAME_REFERENCE
|| kind == CompletionProposal.METHOD_REF)
if (Flags.isDefaultMethod(flags)) adornments |= JavaElementImageDescriptor.DEFAULT_METHOD;
if (kind == CompletionProposal.ANNOTATION_ATTRIBUTE_REF)
if (Flags.isAnnnotationDefault(flags))
adornments |= JavaElementImageDescriptor.ANNOTATION_DEFAULT;
if (kind == CompletionProposal.TYPE_REF && Flags.isAbstract(flags) && !Flags.isInterface(flags))
adornments |= JavaElementImageDescriptor.ABSTRACT;
if (kind == CompletionProposal.FIELD_REF) {
if (Flags.isFinal(flags)) adornments |= JavaElementImageDescriptor.FINAL;
if (Flags.isTransient(flags)) adornments |= JavaElementImageDescriptor.TRANSIENT;
if (Flags.isVolatile(flags)) adornments |= JavaElementImageDescriptor.VOLATILE;
}
return new JavaElementImageDescriptor(
descriptor, adornments /*, JavaElementImageProvider.SMALL_SIZE*/);
}