Java Code Examples for org.eclipse.jdt.core.CompletionProposal#getFlags()
The following examples show how to use
org.eclipse.jdt.core.CompletionProposal#getFlags() .
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: JavaElementToken.java From Pydev with Eclipse Public License 1.0 | 5 votes |
public JavaElementToken(String rep, String doc, String args, String parentPackage, int type, IJavaElement javaElement, CompletionProposal completionProposal) { super(rep, doc, args, parentPackage, type, null); this.javaElement = javaElement; this.completionProposalKind = completionProposal.getKind(); this.completionProposalFlags = completionProposal.getFlags(); if (HAS_ADDITIONAL_FLAGS) { this.completionProposalAdditionalFlags = completionProposal.getAdditionalFlags(); } this.completionPropsoalSignature = completionProposal.getSignature(); }
Example 2
Source File: CompletionProposalRequestor.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
private CompletionItemKind mapKind(final CompletionProposal proposal) { //When a new CompletionItemKind is added, don't forget to update SUPPORTED_KINDS int kind = proposal.getKind(); int flags = proposal.getFlags(); switch (kind) { case CompletionProposal.ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION: case CompletionProposal.CONSTRUCTOR_INVOCATION: return CompletionItemKind.Constructor; case CompletionProposal.ANONYMOUS_CLASS_DECLARATION: case CompletionProposal.TYPE_REF: if (Flags.isInterface(flags)) { return CompletionItemKind.Interface; } else if (Flags.isEnum(flags)) { return CompletionItemKind.Enum; } return CompletionItemKind.Class; case CompletionProposal.FIELD_IMPORT: case CompletionProposal.METHOD_IMPORT: case CompletionProposal.METHOD_NAME_REFERENCE: case CompletionProposal.PACKAGE_REF: case CompletionProposal.TYPE_IMPORT: case CompletionProposal.MODULE_DECLARATION: case CompletionProposal.MODULE_REF: return CompletionItemKind.Module; case CompletionProposal.FIELD_REF: if (Flags.isEnum(flags)) { return CompletionItemKind.EnumMember; } if (Flags.isStatic(flags) && Flags.isFinal(flags)) { return CompletionItemKind.Constant; } return CompletionItemKind.Field; case CompletionProposal.FIELD_REF_WITH_CASTED_RECEIVER: return CompletionItemKind.Field; case CompletionProposal.KEYWORD: return CompletionItemKind.Keyword; case CompletionProposal.LABEL_REF: return CompletionItemKind.Reference; case CompletionProposal.LOCAL_VARIABLE_REF: case CompletionProposal.VARIABLE_DECLARATION: return CompletionItemKind.Variable; case CompletionProposal.METHOD_DECLARATION: case CompletionProposal.METHOD_REF: case CompletionProposal.METHOD_REF_WITH_CASTED_RECEIVER: case CompletionProposal.POTENTIAL_METHOD_DECLARATION: return CompletionItemKind.Method; //text case CompletionProposal.ANNOTATION_ATTRIBUTE_REF: case CompletionProposal.JAVADOC_BLOCK_TAG: case CompletionProposal.JAVADOC_FIELD_REF: case CompletionProposal.JAVADOC_INLINE_TAG: case CompletionProposal.JAVADOC_METHOD_REF: case CompletionProposal.JAVADOC_PARAM_REF: case CompletionProposal.JAVADOC_TYPE_REF: case CompletionProposal.JAVADOC_VALUE_REF: default: return CompletionItemKind.Text; } }
Example 3
Source File: CompletionProposalLabelProvider.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
/** * 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); }
Example 4
Source File: CompletionProposalLabelProvider.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
ImageDescriptor createMethodImageDescriptor(CompletionProposal proposal) { final int flags= proposal.getFlags(); return decorateImageDescriptor(JavaElementImageProvider.getMethodImageDescriptor(false, flags), proposal); }
Example 5
Source File: CompletionProposalLabelProvider.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
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); }
Example 6
Source File: CompletionProposalLabelProvider.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
ImageDescriptor createFieldImageDescriptor(CompletionProposal proposal) { final int flags= proposal.getFlags(); return decorateImageDescriptor(JavaElementImageProvider.getFieldImageDescriptor(false, flags), proposal); }
Example 7
Source File: CompletionProposalLabelProvider.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
/** * 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); }