本文整理汇总了Java中org.eclipse.jdt.ui.JavaElementImageDescriptor.FINAL属性的典型用法代码示例。如果您正苦于以下问题:Java JavaElementImageDescriptor.FINAL属性的具体用法?Java JavaElementImageDescriptor.FINAL怎么用?Java JavaElementImageDescriptor.FINAL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.jdt.ui.JavaElementImageDescriptor
的用法示例。
在下文中一共展示了JavaElementImageDescriptor.FINAL属性的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAdornmentFlags
private static int getAdornmentFlags(IBinding binding) {
int adornments = 0;
final int modifiers = binding.getModifiers();
if (Modifier.isAbstract(modifiers)) adornments |= JavaElementImageDescriptor.ABSTRACT;
if (Modifier.isFinal(modifiers)) adornments |= JavaElementImageDescriptor.FINAL;
if (Modifier.isStatic(modifiers)) adornments |= JavaElementImageDescriptor.STATIC;
if (binding.isDeprecated()) adornments |= JavaElementImageDescriptor.DEPRECATED;
if (binding instanceof IMethodBinding) {
if (((IMethodBinding) binding).isConstructor())
adornments |= JavaElementImageDescriptor.CONSTRUCTOR;
if (Modifier.isSynchronized(modifiers)) adornments |= JavaElementImageDescriptor.SYNCHRONIZED;
if (Modifier.isNative(modifiers)) adornments |= JavaElementImageDescriptor.NATIVE;
ITypeBinding type = ((IMethodBinding) binding).getDeclaringClass();
if (type.isInterface() && !Modifier.isAbstract(modifiers) && !Modifier.isStatic(modifiers))
adornments |= JavaElementImageDescriptor.DEFAULT_METHOD;
if (((IMethodBinding) binding).getDefaultValue() != null)
adornments |= JavaElementImageDescriptor.ANNOTATION_DEFAULT;
}
if (binding instanceof IVariableBinding && ((IVariableBinding) binding).isField()) {
if (Modifier.isTransient(modifiers)) adornments |= JavaElementImageDescriptor.TRANSIENT;
if (Modifier.isVolatile(modifiers)) adornments |= JavaElementImageDescriptor.VOLATILE;
}
return adornments;
}
示例2: getAdornmentFlags
private static int getAdornmentFlags(IBinding binding) {
int adornments= 0;
final int modifiers= binding.getModifiers();
if (Modifier.isAbstract(modifiers))
adornments|= JavaElementImageDescriptor.ABSTRACT;
if (Modifier.isFinal(modifiers))
adornments|= JavaElementImageDescriptor.FINAL;
if (Modifier.isStatic(modifiers))
adornments|= JavaElementImageDescriptor.STATIC;
if (binding.isDeprecated())
adornments|= JavaElementImageDescriptor.DEPRECATED;
if (binding instanceof IMethodBinding) {
if (((IMethodBinding) binding).isConstructor())
adornments|= JavaElementImageDescriptor.CONSTRUCTOR;
if (Modifier.isSynchronized(modifiers))
adornments|= JavaElementImageDescriptor.SYNCHRONIZED;
if (Modifier.isNative(modifiers))
adornments|= JavaElementImageDescriptor.NATIVE;
ITypeBinding type= ((IMethodBinding) binding).getDeclaringClass();
if (type.isInterface() && !Modifier.isAbstract(modifiers) && !Modifier.isStatic(modifiers))
adornments|= JavaElementImageDescriptor.DEFAULT_METHOD;
if (((IMethodBinding) binding).getDefaultValue() != null)
adornments|= JavaElementImageDescriptor.ANNOTATION_DEFAULT;
}
if (binding instanceof IVariableBinding && ((IVariableBinding) binding).isField()) {
if (Modifier.isTransient(modifiers))
adornments|= JavaElementImageDescriptor.TRANSIENT;
if (Modifier.isVolatile(modifiers))
adornments|= JavaElementImageDescriptor.VOLATILE;
}
return adornments;
}
示例3: getImageDescriptor
public static ImageDescriptor getImageDescriptor(TypeNameMatch typeRef, int flags) {
if (isSet(SHOW_TYPE_CONTAINER_ONLY, flags)) {
if (typeRef.getPackageName().equals(typeRef.getTypeContainerName()))
return JavaPluginImages.DESC_OBJS_PACKAGE;
// XXX cannot check outer type for interface efficiently (5887)
return JavaPluginImages.DESC_OBJS_CLASS;
} else if (isSet(SHOW_PACKAGE_ONLY, flags)) {
return JavaPluginImages.DESC_OBJS_PACKAGE;
} else {
boolean isInner= typeRef.getTypeContainerName().indexOf('.') != -1;
int modifiers= typeRef.getModifiers();
ImageDescriptor desc= JavaElementImageProvider.getTypeImageDescriptor(isInner, false, modifiers, false);
int adornmentFlags= 0;
if (Flags.isFinal(modifiers)) {
adornmentFlags |= JavaElementImageDescriptor.FINAL;
}
if (Flags.isAbstract(modifiers) && !Flags.isInterface(modifiers)) {
adornmentFlags |= JavaElementImageDescriptor.ABSTRACT;
}
if (Flags.isStatic(modifiers)) {
adornmentFlags |= JavaElementImageDescriptor.STATIC;
}
if (Flags.isDeprecated(modifiers)) {
adornmentFlags |= JavaElementImageDescriptor.DEPRECATED;
}
return new JavaElementImageDescriptor(desc, adornmentFlags, JavaElementImageProvider.BIG_SIZE);
}
}
示例4: getFieldImage
public Image getFieldImage() {
int accessorFlags_JVM = Flags.AccDefault;
int accessorFlags_JDT = JavaElementImageDescriptor.FINAL;
ImageDescriptor desc = JavaElementImageProvider.getFieldImageDescriptor(false, accessorFlags_JVM);
ApexElementImageDescriptor decoratedDesc =
new ApexElementImageDescriptor(desc, accessorFlags_JDT, APEX_ICON_SIZE);
return ForceImages.get(ForceImages.JDT_FIELD, accessorFlags_JVM, decoratedDesc);
}
示例5: getAdornmentFlags
private static int getAdornmentFlags(IBinding binding) {
int adornments= 0;
final int modifiers= binding.getModifiers();
if (Modifier.isAbstract(modifiers))
adornments|= JavaElementImageDescriptor.ABSTRACT;
if (Modifier.isFinal(modifiers))
adornments|= JavaElementImageDescriptor.FINAL;
if (Modifier.isStatic(modifiers))
adornments|= JavaElementImageDescriptor.STATIC;
if (binding.isDeprecated())
adornments|= JavaElementImageDescriptor.DEPRECATED;
if (binding instanceof IMethodBinding) {
if (((IMethodBinding) binding).isConstructor())
adornments|= JavaElementImageDescriptor.CONSTRUCTOR;
if (Modifier.isSynchronized(modifiers))
adornments|= JavaElementImageDescriptor.SYNCHRONIZED;
if (Modifier.isNative(modifiers))
adornments|= JavaElementImageDescriptor.NATIVE;
}
if (binding instanceof IVariableBinding && ((IVariableBinding) binding).isField()) {
if (Modifier.isTransient(modifiers))
adornments|= JavaElementImageDescriptor.TRANSIENT;
if (Modifier.isVolatile(modifiers))
adornments|= JavaElementImageDescriptor.VOLATILE;
}
return adornments;
}
示例6: decorateImageDescriptor
/**
* 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*/);
}
示例7: computeJavaAdornmentFlags
private int computeJavaAdornmentFlags(IJavaElement element, int renderFlags) {
int flags = 0;
if (showOverlayIcons(renderFlags)) {
try {
if (element instanceof IMember) {
IMember member = (IMember) element;
int modifiers = member.getFlags();
if (confirmAbstract(member) && JdtFlags.isAbstract(member))
flags |= JavaElementImageDescriptor.ABSTRACT;
if (Flags.isFinal(modifiers)
|| isInterfaceOrAnnotationField(member)
|| isEnumConstant(member, modifiers)) flags |= JavaElementImageDescriptor.FINAL;
if (Flags.isStatic(modifiers)
|| isInterfaceOrAnnotationFieldOrType(member)
|| isEnumConstant(member, modifiers)) flags |= JavaElementImageDescriptor.STATIC;
if (Flags.isDeprecated(modifiers)) flags |= JavaElementImageDescriptor.DEPRECATED;
int elementType = element.getElementType();
if (elementType == IJavaElement.METHOD) {
if (((IMethod) element).isConstructor())
flags |= JavaElementImageDescriptor.CONSTRUCTOR;
if (Flags.isSynchronized(modifiers)) // collides with 'super' flag
flags |= JavaElementImageDescriptor.SYNCHRONIZED;
if (Flags.isNative(modifiers)) flags |= JavaElementImageDescriptor.NATIVE;
if (Flags.isDefaultMethod(modifiers))
flags |= JavaElementImageDescriptor.DEFAULT_METHOD;
if (Flags.isAnnnotationDefault(modifiers))
flags |= JavaElementImageDescriptor.ANNOTATION_DEFAULT;
}
if (member.getElementType() == IJavaElement.TYPE) {
if (JavaModelUtil.hasMainMethod((IType) member)) {
flags |= JavaElementImageDescriptor.RUNNABLE;
}
}
if (member.getElementType() == IJavaElement.FIELD) {
if (Flags.isVolatile(modifiers)) flags |= JavaElementImageDescriptor.VOLATILE;
if (Flags.isTransient(modifiers)) flags |= JavaElementImageDescriptor.TRANSIENT;
}
} else if (element instanceof ILocalVariable
&& Flags.isFinal(((ILocalVariable) element).getFlags())) {
flags |= JavaElementImageDescriptor.FINAL;
}
} catch (JavaModelException e) {
// do nothing. Can't compute runnable adornment or get flags
}
}
return flags;
}
示例8: decorateImageDescriptor
/**
* 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 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);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:59,代码来源:CompletionProposalLabelProvider.java
示例9: getTypeImageDescriptor
private ImageDescriptor getTypeImageDescriptor(IType type) {
ITypeHierarchy hierarchy= fHierarchy.getHierarchy();
if (hierarchy == null) {
return new JavaElementImageDescriptor(JavaPluginImages.DESC_OBJS_CLASS, 0, JavaElementImageProvider.BIG_SIZE);
}
int flags= hierarchy.getCachedFlags(type);
if (flags == -1) {
return new JavaElementImageDescriptor(JavaPluginImages.DESC_OBJS_CLASS, 0, JavaElementImageProvider.BIG_SIZE);
}
boolean isInterface= Flags.isInterface(flags);
IType declaringType= type.getDeclaringType();
boolean isInner= declaringType != null;
boolean isInInterfaceOrAnnotation= false;
if (isInner) {
int declaringTypeFlags= hierarchy.getCachedFlags(declaringType);
if (declaringTypeFlags != -1) {
isInInterfaceOrAnnotation= Flags.isInterface(declaringTypeFlags);
} else {
// declaring type is not in hierarchy, so we have to pay the price for resolving here
try {
isInInterfaceOrAnnotation= declaringType.isInterface();
} catch (JavaModelException e) {
}
}
}
ImageDescriptor desc= JavaElementImageProvider.getTypeImageDescriptor(isInner, isInInterfaceOrAnnotation, flags, isInDifferentHierarchyScope(type));
int adornmentFlags= 0;
if (Flags.isFinal(flags)) {
adornmentFlags |= JavaElementImageDescriptor.FINAL;
}
if (Flags.isAbstract(flags) && !isInterface) {
adornmentFlags |= JavaElementImageDescriptor.ABSTRACT;
}
if (Flags.isStatic(flags)) {
adornmentFlags |= JavaElementImageDescriptor.STATIC;
}
if (Flags.isDeprecated(flags)) {
adornmentFlags |= JavaElementImageDescriptor.DEPRECATED;
}
return new JavaElementImageDescriptor(desc, adornmentFlags, JavaElementImageProvider.BIG_SIZE);
}
示例10: evaluateVisibleMatches
private List<Variable> evaluateVisibleMatches(String expectedType, IJavaElement[] suggestions) throws JavaModelException {
IType currentType= null;
if (fEnclosingElement != null) {
currentType= (IType) fEnclosingElement.getAncestor(IJavaElement.TYPE);
}
ArrayList<Variable> res= new ArrayList<Variable>();
for (int i= 0; i < suggestions.length; i++) {
Variable variable= createVariable(suggestions[i], currentType, expectedType, i);
if (variable != null) {
if (fAlreadyMatchedNames.contains(variable.name)) {
variable.alreadyMatched= true;
}
res.add(variable);
}
}
// add 'this'
if (currentType != null && !(fEnclosingElement instanceof IMethod && Flags.isStatic(((IMethod) fEnclosingElement).getFlags()))) {
String fullyQualifiedName= currentType.getFullyQualifiedName('.');
if (fullyQualifiedName.equals(expectedType)) {
ImageDescriptor desc= new JavaElementImageDescriptor(JavaPluginImages.DESC_FIELD_PUBLIC, JavaElementImageDescriptor.FINAL | JavaElementImageDescriptor.STATIC, JavaElementImageProvider.SMALL_SIZE);
res.add(new Variable(fullyQualifiedName, "this", Variable.LITERALS, false, res.size(), new char[] {'.'}, desc)); //$NON-NLS-1$
}
}
Code primitiveTypeCode= getPrimitiveTypeCode(expectedType);
if (primitiveTypeCode == null) {
// add 'null'
res.add(new Variable(expectedType, "null", Variable.LITERALS, false, res.size(), NO_TRIGGERS, null)); //$NON-NLS-1$
} else {
String typeName= primitiveTypeCode.toString();
boolean isAutoboxing= !typeName.equals(expectedType);
if (primitiveTypeCode == PrimitiveType.BOOLEAN) {
// add 'true', 'false'
res.add(new Variable(typeName, "true", Variable.LITERALS, isAutoboxing, res.size(), NO_TRIGGERS, null)); //$NON-NLS-1$
res.add(new Variable(typeName, "false", Variable.LITERALS, isAutoboxing, res.size(), NO_TRIGGERS, null)); //$NON-NLS-1$
} else {
// add 0
res.add(new Variable(typeName, "0", Variable.LITERALS, isAutoboxing, res.size(), NO_TRIGGERS, null)); //$NON-NLS-1$
}
}
return res;
}
示例11: computeJavaAdornmentFlags
private int computeJavaAdornmentFlags(IJavaElement element, int renderFlags) {
int flags= 0;
if (showOverlayIcons(renderFlags)) {
try {
if (element instanceof IMember) {
IMember member= (IMember)element;
int modifiers= member.getFlags();
if (confirmAbstract(member) && JdtFlags.isAbstract(member))
flags|= JavaElementImageDescriptor.ABSTRACT;
if (Flags.isFinal(modifiers) || isInterfaceOrAnnotationField(member) || isEnumConstant(member, modifiers))
flags|= JavaElementImageDescriptor.FINAL;
if (Flags.isStatic(modifiers) || isInterfaceOrAnnotationFieldOrType(member) || isEnumConstant(member, modifiers))
flags|= JavaElementImageDescriptor.STATIC;
if (Flags.isDeprecated(modifiers))
flags|= JavaElementImageDescriptor.DEPRECATED;
int elementType= element.getElementType();
if (elementType == IJavaElement.METHOD) {
if (((IMethod)element).isConstructor())
flags|= JavaElementImageDescriptor.CONSTRUCTOR;
if (Flags.isSynchronized(modifiers)) // collides with 'super' flag
flags|= JavaElementImageDescriptor.SYNCHRONIZED;
if (Flags.isNative(modifiers))
flags|= JavaElementImageDescriptor.NATIVE;
if (Flags.isDefaultMethod(modifiers))
flags|= JavaElementImageDescriptor.DEFAULT_METHOD;
if (Flags.isAnnnotationDefault(modifiers))
flags|= JavaElementImageDescriptor.ANNOTATION_DEFAULT;
}
if (member.getElementType() == IJavaElement.TYPE) {
if (JavaModelUtil.hasMainMethod((IType)member)) {
flags|= JavaElementImageDescriptor.RUNNABLE;
}
}
if (member.getElementType() == IJavaElement.FIELD) {
if (Flags.isVolatile(modifiers))
flags|= JavaElementImageDescriptor.VOLATILE;
if (Flags.isTransient(modifiers))
flags|= JavaElementImageDescriptor.TRANSIENT;
}
} else if (element instanceof ILocalVariable && Flags.isFinal(((ILocalVariable)element).getFlags())) {
flags|= JavaElementImageDescriptor.FINAL;
}
} catch (JavaModelException e) {
// do nothing. Can't compute runnable adornment or get flags
}
}
return flags;
}
示例12: flipBits
public static final AccessorFlags flipBits(ModifierGroup modifiers) {
Integer accessorFlag_JVM = 0;
Integer accessorFlag_JDT = 0;
if (modifiers.has(TEST_METHOD)) {
accessorFlag_JVM |= ApexElementImageDescriptor.TESTMETHOD;
accessorFlag_JDT |= ApexElementImageDescriptor.TESTMETHOD;
}
if (modifiers.has(IS_TEST)) {
accessorFlag_JVM |= ApexElementImageDescriptor.TESTMETHOD;
accessorFlag_JDT |= ApexElementImageDescriptor.TESTMETHOD;
}
if (modifiers.has(GLOBAL)) {
accessorFlag_JVM |= ApexElementImageDescriptor.GLOBAL;
accessorFlag_JDT |= ApexElementImageDescriptor.GLOBAL;
}
if (modifiers.has(WEB_SERVICE)) {
accessorFlag_JVM |= ApexElementImageDescriptor.WEBSERVICE;
accessorFlag_JDT |= ApexElementImageDescriptor.WEBSERVICE;
}
if (modifiers.has(PUBLIC)) {
accessorFlag_JVM |= Flags.AccPublic;
}
if (modifiers.has(PRIVATE)) {
accessorFlag_JVM |= Flags.AccPrivate;
}
if (modifiers.has(PROTECTED)) {
accessorFlag_JVM |= Flags.AccProtected;
}
if (modifiers.has(WITH_SHARING)) {
accessorFlag_JVM |= ApexElementImageDescriptor.WITHSHARING;
accessorFlag_JDT |= ApexElementImageDescriptor.WITHSHARING;
}
if (modifiers.has(WITHOUT_SHARING)) {
accessorFlag_JVM |= ApexElementImageDescriptor.WITHOUTSHARING;
accessorFlag_JDT |= ApexElementImageDescriptor.WITHOUTSHARING;
}
if (modifiers.has(STATIC)) {
accessorFlag_JVM |= Flags.AccStatic;
accessorFlag_JDT |= JavaElementImageDescriptor.STATIC;
}
if (modifiers.has(TRANSIENT)) {
accessorFlag_JVM |= Flags.AccTransient;
accessorFlag_JDT |= JavaElementImageDescriptor.TRANSIENT;
}
if (modifiers.has(ABSTRACT)) {
accessorFlag_JVM |= Flags.AccAbstract;
accessorFlag_JDT |= JavaElementImageDescriptor.ABSTRACT;
}
if (modifiers.has(FINAL)) {
accessorFlag_JVM |= Flags.AccFinal;
accessorFlag_JDT |= JavaElementImageDescriptor.FINAL;
}
if (modifiers.has(OVERRIDE)) {
accessorFlag_JDT |= JavaElementImageDescriptor.OVERRIDES;
}
if (modifiers.has(VIRTUAL)) {
accessorFlag_JVM |= ApexElementImageDescriptor.VIRTUAL;
accessorFlag_JDT |= ApexElementImageDescriptor.VIRTUAL;
}
return new AccessorFlags(accessorFlag_JVM, accessorFlag_JDT);
}
示例13: decorateImageDescriptor
/**
* 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 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_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_DECLARATION || kind == CompletionProposal.METHOD_NAME_REFERENCE || kind == CompletionProposal.METHOD_REF
|| kind == CompletionProposal.CONSTRUCTOR_INVOCATION)
if (Flags.isSynchronized(flags))
adornments |= JavaElementImageDescriptor.SYNCHRONIZED;
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);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:53,代码来源:CompletionProposalLabelProvider.java
示例14: computeJavaAdornmentFlags
private int computeJavaAdornmentFlags(IJavaElement element, int renderFlags) {
int flags= 0;
if (showOverlayIcons(renderFlags)) {
try {
if (element instanceof IMember) {
IMember member= (IMember)element;
int modifiers= member.getFlags();
if (Flags.isAbstract(modifiers) && confirmAbstract(member))
flags|= JavaElementImageDescriptor.ABSTRACT;
if (Flags.isFinal(modifiers) || isInterfaceOrAnnotationField(member) || isEnumConstant(member, modifiers))
flags|= JavaElementImageDescriptor.FINAL;
if (Flags.isStatic(modifiers) || isInterfaceOrAnnotationFieldOrType(member) || isEnumConstant(member, modifiers))
flags|= JavaElementImageDescriptor.STATIC;
if (Flags.isDeprecated(modifiers))
flags|= JavaElementImageDescriptor.DEPRECATED;
int elementType= element.getElementType();
if (elementType == IJavaElement.METHOD) {
if (((IMethod)element).isConstructor())
flags|= JavaElementImageDescriptor.CONSTRUCTOR;
if (Flags.isSynchronized(modifiers)) // collides with 'super' flag
flags|= JavaElementImageDescriptor.SYNCHRONIZED;
if (Flags.isNative(modifiers))
flags|= JavaElementImageDescriptor.NATIVE;
}
if (member.getElementType() == IJavaElement.TYPE) {
if (JavaModelUtil.hasMainMethod((IType)member)) {
flags|= JavaElementImageDescriptor.RUNNABLE;
}
}
if (member.getElementType() == IJavaElement.FIELD) {
if (Flags.isVolatile(modifiers))
flags|= JavaElementImageDescriptor.VOLATILE;
if (Flags.isTransient(modifiers))
flags|= JavaElementImageDescriptor.TRANSIENT;
}
} else if (element instanceof ILocalVariable && Flags.isFinal(((ILocalVariable)element).getFlags())) {
flags|= JavaElementImageDescriptor.FINAL;
}
} catch (JavaModelException e) {
// do nothing. Can't compute runnable adornment or get flags
}
}
return flags;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:49,代码来源:JavaElementImageProvider.java