Java Code Examples for org.eclipse.jdt.core.CompletionProposal#MODULE_DECLARATION
The following examples show how to use
org.eclipse.jdt.core.CompletionProposal#MODULE_DECLARATION .
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: CompletionProposalDescriptionProvider.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
/** * Updates the description fields of the item. * * @param proposal * @param item */ public void updateDescription(CompletionProposal proposal, CompletionItem item) { switch (proposal.getKind()) { case CompletionProposal.METHOD_NAME_REFERENCE: case CompletionProposal.METHOD_REF: case CompletionProposal.CONSTRUCTOR_INVOCATION: case CompletionProposal.METHOD_REF_WITH_CASTED_RECEIVER: case CompletionProposal.POTENTIAL_METHOD_DECLARATION: if (fContext != null && fContext.isInJavadoc()) { createJavadocMethodProposalLabel(proposal, item); break; } createMethodProposalLabel(proposal, item); break; case CompletionProposal.METHOD_DECLARATION: createOverrideMethodProposalLabel(proposal, item); break; case CompletionProposal.ANONYMOUS_CLASS_DECLARATION: case CompletionProposal.ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION: createAnonymousTypeLabel(proposal, item); break; case CompletionProposal.TYPE_REF: createTypeProposalLabel(proposal, item); break; case CompletionProposal.JAVADOC_TYPE_REF: createJavadocTypeProposalLabel(proposal, item); break; 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: createJavadocSimpleProposalLabel(proposal, item); break; case CompletionProposal.JAVADOC_METHOD_REF: createJavadocMethodProposalLabel(proposal, item); break; case CompletionProposal.PACKAGE_REF: case CompletionProposal.MODULE_DECLARATION: case CompletionProposal.MODULE_REF: createPackageProposalLabel(proposal, item); break; case CompletionProposal.ANNOTATION_ATTRIBUTE_REF: case CompletionProposal.FIELD_REF: case CompletionProposal.FIELD_REF_WITH_CASTED_RECEIVER: createLabelWithTypeAndDeclaration(proposal, item); break; case CompletionProposal.LOCAL_VARIABLE_REF: case CompletionProposal.VARIABLE_DECLARATION: createSimpleLabelWithType(proposal, item); break; case CompletionProposal.KEYWORD: case CompletionProposal.LABEL_REF: item.setLabel(createSimpleLabel(proposal).toString()); break; default: JavaLanguageServerPlugin.logInfo(new String(proposal.getName()) + " is of type " + getProposal(proposal)); Assert.isTrue(false); } }
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: CompletionProposalRequestor.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
/** * copied from * org.eclipse.jdt.ui.text.java.CompletionProposalCollector.getDeclaringType(CompletionProposal) */ protected final char[] getDeclaringType(CompletionProposal proposal) { switch (proposal.getKind()) { case CompletionProposal.METHOD_DECLARATION: case CompletionProposal.METHOD_NAME_REFERENCE: case CompletionProposal.JAVADOC_METHOD_REF: case CompletionProposal.METHOD_REF: case CompletionProposal.CONSTRUCTOR_INVOCATION: case CompletionProposal.ANONYMOUS_CLASS_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.FIELD_REF: case CompletionProposal.FIELD_REF_WITH_CASTED_RECEIVER: case CompletionProposal.JAVADOC_FIELD_REF: case CompletionProposal.JAVADOC_VALUE_REF: char[] declaration = proposal.getDeclarationSignature(); // special methods may not have a declaring type: methods defined on arrays etc. // Currently known: class literals don't have a declaring type - use Object if (declaration == null) { return "java.lang.Object".toCharArray(); //$NON-NLS-1$ } return Signature.toCharArray(declaration); case CompletionProposal.PACKAGE_REF: case CompletionProposal.MODULE_REF: case CompletionProposal.MODULE_DECLARATION: return proposal.getDeclarationSignature(); case CompletionProposal.JAVADOC_TYPE_REF: case CompletionProposal.TYPE_REF: return Signature.toCharArray(proposal.getSignature()); case CompletionProposal.LOCAL_VARIABLE_REF: case CompletionProposal.VARIABLE_DECLARATION: case CompletionProposal.KEYWORD: case CompletionProposal.LABEL_REF: case CompletionProposal.JAVADOC_BLOCK_TAG: case CompletionProposal.JAVADOC_INLINE_TAG: case CompletionProposal.JAVADOC_PARAM_REF: return null; default: Assert.isTrue(false); return null; } }