本文整理汇总了Java中org.eclipse.jdt.core.CompletionProposal.getFlags方法的典型用法代码示例。如果您正苦于以下问题:Java CompletionProposal.getFlags方法的具体用法?Java CompletionProposal.getFlags怎么用?Java CompletionProposal.getFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.CompletionProposal
的用法示例。
在下文中一共展示了CompletionProposal.getFlags方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createTypeImageDescriptor
import org.eclipse.jdt.core.CompletionProposal; //导入方法依赖的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);
}
示例2: createImageDescriptor
import org.eclipse.jdt.core.CompletionProposal; //导入方法依赖的package包/类
/**
* Creates and returns a decorated image descriptor for a completion proposal.
*
* @param proposal the proposal for which to create an image descriptor
* @return the created image descriptor, or <code>null</code> if no image is available
*/
public ImageDescriptor createImageDescriptor(CompletionProposal proposal) {
final int flags = proposal.getFlags();
ImageDescriptor descriptor;
switch (proposal.getKind()) {
case CompletionProposal.METHOD_DECLARATION:
case CompletionProposal.METHOD_NAME_REFERENCE:
case CompletionProposal.METHOD_REF:
case CompletionProposal.CONSTRUCTOR_INVOCATION:
case CompletionProposal.METHOD_REF_WITH_CASTED_RECEIVER:
case CompletionProposal.ANNOTATION_ATTRIBUTE_REF:
case CompletionProposal.POTENTIAL_METHOD_DECLARATION:
case CompletionProposal.ANONYMOUS_CLASS_DECLARATION:
case CompletionProposal.ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION:
descriptor = JavaElementImageProvider.getMethodImageDescriptor(false, flags);
break;
case CompletionProposal.TYPE_REF:
switch (Signature.getTypeSignatureKind(proposal.getSignature())) {
case Signature.CLASS_TYPE_SIGNATURE:
descriptor =
JavaElementImageProvider.getTypeImageDescriptor(false, false, flags, false);
break;
case Signature.TYPE_VARIABLE_SIGNATURE:
descriptor = JavaPluginImages.DESC_OBJS_TYPEVARIABLE;
break;
default:
descriptor = null;
}
break;
case CompletionProposal.FIELD_REF:
case CompletionProposal.FIELD_REF_WITH_CASTED_RECEIVER:
descriptor = JavaElementImageProvider.getFieldImageDescriptor(false, flags);
break;
case CompletionProposal.LOCAL_VARIABLE_REF:
case CompletionProposal.VARIABLE_DECLARATION:
descriptor = JavaPluginImages.DESC_OBJS_LOCAL_VARIABLE;
break;
case CompletionProposal.PACKAGE_REF:
descriptor = JavaPluginImages.DESC_OBJS_PACKAGE;
break;
case CompletionProposal.KEYWORD:
case CompletionProposal.LABEL_REF:
descriptor = null;
break;
case CompletionProposal.JAVADOC_METHOD_REF:
case CompletionProposal.JAVADOC_TYPE_REF:
case CompletionProposal.JAVADOC_FIELD_REF:
case CompletionProposal.JAVADOC_VALUE_REF:
case CompletionProposal.JAVADOC_BLOCK_TAG:
case CompletionProposal.JAVADOC_INLINE_TAG:
case CompletionProposal.JAVADOC_PARAM_REF:
descriptor = JavaPluginImages.DESC_OBJS_JAVADOCTAG;
break;
default:
descriptor = null;
Assert.isTrue(false);
}
if (descriptor == null) return null;
return decorateImageDescriptor(descriptor, proposal);
}
示例3: createMethodImageDescriptor
import org.eclipse.jdt.core.CompletionProposal; //导入方法依赖的package包/类
ImageDescriptor createMethodImageDescriptor(CompletionProposal proposal) {
final int flags = proposal.getFlags();
return decorateImageDescriptor(
JavaElementImageProvider.getMethodImageDescriptor(false, flags), proposal);
}
示例4: createFieldImageDescriptor
import org.eclipse.jdt.core.CompletionProposal; //导入方法依赖的package包/类
ImageDescriptor createFieldImageDescriptor(CompletionProposal proposal) {
final int flags = proposal.getFlags();
return decorateImageDescriptor(
JavaElementImageProvider.getFieldImageDescriptor(false, flags), proposal);
}
示例5: decorateImageDescriptor
import org.eclipse.jdt.core.CompletionProposal; //导入方法依赖的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*/);
}