当前位置: 首页>>代码示例>>Java>>正文


Java CompletionProposal.METHOD_NAME_REFERENCE属性代码示例

本文整理汇总了Java中org.eclipse.jdt.core.CompletionProposal.METHOD_NAME_REFERENCE属性的典型用法代码示例。如果您正苦于以下问题:Java CompletionProposal.METHOD_NAME_REFERENCE属性的具体用法?Java CompletionProposal.METHOD_NAME_REFERENCE怎么用?Java CompletionProposal.METHOD_NAME_REFERENCE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.eclipse.jdt.core.CompletionProposal的用法示例。


在下文中一共展示了CompletionProposal.METHOD_NAME_REFERENCE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ignoreAll

private void ignoreAll() {
  int[] ignoredKinds = new int[] {
      CompletionProposal.ANONYMOUS_CLASS_DECLARATION,
      CompletionProposal.FIELD_REF, CompletionProposal.KEYWORD,
      CompletionProposal.LABEL_REF, CompletionProposal.LOCAL_VARIABLE_REF,
      CompletionProposal.METHOD_REF, CompletionProposal.METHOD_DECLARATION,
      CompletionProposal.PACKAGE_REF, CompletionProposal.TYPE_REF,
      CompletionProposal.VARIABLE_DECLARATION,
      CompletionProposal.POTENTIAL_METHOD_DECLARATION,
      CompletionProposal.METHOD_NAME_REFERENCE,
      CompletionProposal.ANNOTATION_ATTRIBUTE_REF,
      CompletionProposal.JAVADOC_FIELD_REF,
      CompletionProposal.JAVADOC_METHOD_REF,
      CompletionProposal.JAVADOC_TYPE_REF,
      CompletionProposal.JAVADOC_VALUE_REF,
      CompletionProposal.JAVADOC_PARAM_REF,
      CompletionProposal.JAVADOC_BLOCK_TAG,
      CompletionProposal.JAVADOC_INLINE_TAG, CompletionProposal.FIELD_IMPORT,
      CompletionProposal.METHOD_IMPORT, CompletionProposal.TYPE_IMPORT};

  for (int kind : ignoredKinds) {
    setIgnored(kind, true);
  }
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:24,代码来源:ProposalGeneratingCompletionRequestor.java

示例2: createMethodProposalDescription

/**
 * Creates and returns the method signature suitable for display.
 *
 * @param proposal
 *            the proposal to create the description for
 * @return the string of method signature suitable for display
 */
public StringBuilder createMethodProposalDescription(CompletionProposal proposal) {
	int kind = proposal.getKind();
	StringBuilder description = new StringBuilder();
	switch (kind) {
		case CompletionProposal.METHOD_REF:
		case CompletionProposal.METHOD_NAME_REFERENCE:
		case CompletionProposal.POTENTIAL_METHOD_DECLARATION:
		case CompletionProposal.CONSTRUCTOR_INVOCATION:

			// method name
			description.append(proposal.getName());

			// parameters
			description.append('(');
			appendUnboundedParameterList(description, proposal);
			description.append(')');

			// return type
			if (!proposal.isConstructor()) {
				// TODO remove SignatureUtil.fix83600 call when bugs are fixed
				char[] returnType = createTypeDisplayName(SignatureUtil.getUpperBound(Signature.getReturnType(SignatureUtil.fix83600(proposal.getSignature()))));
				description.append(RETURN_TYPE_SEPARATOR);
				description.append(returnType);
			}
	}
	return description; // dummy
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:34,代码来源:CompletionProposalDescriptionProvider.java

示例3: computeSortText

/**
 * Computes the relevance for a given <code>CompletionProposal</code>.
 *
 * @param proposal the proposal to compute the relevance for
 * @return the relevance for <code>proposal</code>
 */
public static String computeSortText(CompletionProposal proposal) {
	final int baseRelevance= proposal.getRelevance() * 16;
	switch (proposal.getKind()) {
	case CompletionProposal.LABEL_REF:
		return convertRelevance( baseRelevance + 1);
	case CompletionProposal.KEYWORD:
		return convertRelevance(baseRelevance + 2);
	case CompletionProposal.TYPE_REF:
	case CompletionProposal.ANONYMOUS_CLASS_DECLARATION:
	case CompletionProposal.ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION:
		return convertRelevance(baseRelevance + 3);
	case CompletionProposal.METHOD_REF:
	case CompletionProposal.CONSTRUCTOR_INVOCATION:
	case CompletionProposal.METHOD_NAME_REFERENCE:
	case CompletionProposal.METHOD_DECLARATION:
	case CompletionProposal.ANNOTATION_ATTRIBUTE_REF:
	case CompletionProposal.POTENTIAL_METHOD_DECLARATION:
		return convertRelevance(baseRelevance + 4);
	case CompletionProposal.FIELD_REF:
		return convertRelevance(baseRelevance + 5);
	case CompletionProposal.LOCAL_VARIABLE_REF:
	case CompletionProposal.VARIABLE_DECLARATION:
		return convertRelevance(baseRelevance + 6);
	case CompletionProposal.PACKAGE_REF://intentional fall-through
	default:
		return convertRelevance(baseRelevance);
	}
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:34,代码来源:SortTextHelper.java

示例4: hasArgumentList

protected boolean hasArgumentList(CompletionProposal proposal) {
	if (CompletionProposal.METHOD_NAME_REFERENCE == proposal.getKind()) {
		return false;
	}
	char[] completion= proposal.getCompletion();
	return !isInJavadoc() && completion.length > 0 && completion[completion.length - 1] == RPAREN;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:7,代码来源:CompletionProposalReplacementProvider.java

示例5: computeRelevance

/**
 * Computes the relevance for a given <code>CompletionProposal</code>.
 *
 * <p>Subclasses may replace, but usually should not need to.
 *
 * @param proposal the proposal to compute the relevance for
 * @return the relevance for <code>proposal</code>
 */
protected int computeRelevance(CompletionProposal proposal) {
  final int baseRelevance = proposal.getRelevance() * 16;
  switch (proposal.getKind()) {
    case CompletionProposal.PACKAGE_REF:
      return baseRelevance + 0;
    case CompletionProposal.LABEL_REF:
      return baseRelevance + 1;
    case CompletionProposal.KEYWORD:
      return baseRelevance + 2;
    case CompletionProposal.TYPE_REF:
    case CompletionProposal.ANONYMOUS_CLASS_DECLARATION:
    case CompletionProposal.ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION:
      return baseRelevance + 3;
    case CompletionProposal.METHOD_REF:
    case CompletionProposal.CONSTRUCTOR_INVOCATION:
    case CompletionProposal.METHOD_NAME_REFERENCE:
    case CompletionProposal.METHOD_DECLARATION:
    case CompletionProposal.ANNOTATION_ATTRIBUTE_REF:
      return baseRelevance + 4;
    case CompletionProposal.POTENTIAL_METHOD_DECLARATION:
      return baseRelevance + 4 /* + 99 */;
    case CompletionProposal.FIELD_REF:
      return baseRelevance + 5;
    case CompletionProposal.LOCAL_VARIABLE_REF:
    case CompletionProposal.VARIABLE_DECLARATION:
      return baseRelevance + 6;
    default:
      return baseRelevance;
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:38,代码来源:CompletionProposalCollector.java

示例6: getDeclaringType

/**
 * Returns the type signature of the declaring type of a <code>CompletionProposal</code>, or
 * <code>null</code> for proposals that do not have a declaring type. The return value is
 * <em>not</em> <code>null</code> for proposals of the following kinds:
 *
 * <ul>
 *   <li>METHOD_DECLARATION
 *   <li>METHOD_NAME_REFERENCE
 *   <li>METHOD_REF
 *   <li>ANNOTATION_ATTRIBUTE_REF
 *   <li>POTENTIAL_METHOD_DECLARATION
 *   <li>ANONYMOUS_CLASS_DECLARATION
 *   <li>FIELD_REF
 *   <li>PACKAGE_REF (returns the package, but no type)
 *   <li>TYPE_REF
 * </ul>
 *
 * @param proposal the completion proposal to get the declaring type for
 * @return the type signature of the declaring type, or <code>null</code> if there is none
 * @see org.eclipse.jdt.core.Signature#toCharArray(char[])
 */
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:
      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;
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:60,代码来源:CompletionProposalCollector.java

示例7: isValidPrefix

@Override
protected boolean isValidPrefix(String prefix) {
  if (super.isValidPrefix(prefix)) return true;

  if (fProposal.getKind() == CompletionProposal.METHOD_NAME_REFERENCE) {
    // static imports - includes package & type name
    StringBuffer buf = new StringBuffer();
    buf.append(Signature.toCharArray(fProposal.getDeclarationSignature()));
    buf.append('.');
    buf.append(TextProcessor.deprocess(getDisplayString()));
    return isPrefix(prefix, buf.toString());
  }

  return false;
}
 
开发者ID:eclipse,项目名称:che,代码行数:15,代码来源:LazyJavaCompletionProposal.java

示例8: computeRelevance

protected int computeRelevance() {
  final int baseRelevance = fProposal.getRelevance() * 16;
  switch (fProposal.getKind()) {
    case CompletionProposal.PACKAGE_REF:
      return baseRelevance + 0;
    case CompletionProposal.LABEL_REF:
      return baseRelevance + 1;
    case CompletionProposal.KEYWORD:
      return baseRelevance + 2;
    case CompletionProposal.TYPE_REF:
    case CompletionProposal.ANONYMOUS_CLASS_DECLARATION:
    case CompletionProposal.ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION:
      return baseRelevance + 3;
    case CompletionProposal.METHOD_REF:
    case CompletionProposal.CONSTRUCTOR_INVOCATION:
    case CompletionProposal.METHOD_NAME_REFERENCE:
    case CompletionProposal.METHOD_DECLARATION:
    case CompletionProposal.ANNOTATION_ATTRIBUTE_REF:
      return baseRelevance + 4;
    case CompletionProposal.POTENTIAL_METHOD_DECLARATION:
      return baseRelevance + 4 /* + 99 */;
    case CompletionProposal.FIELD_REF:
      return baseRelevance + 5;
    case CompletionProposal.LOCAL_VARIABLE_REF:
    case CompletionProposal.VARIABLE_DECLARATION:
      return baseRelevance + 6;
    default:
      return baseRelevance;
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:30,代码来源:LazyJavaCompletionProposal.java

示例9: computeTriggerCharacters

@Override
protected char[] computeTriggerCharacters() {
  if (fProposal.getKind() == CompletionProposal.METHOD_NAME_REFERENCE)
    return METHOD_NAME_TRIGGERS;
  if (hasParameters()) return METHOD_WITH_ARGUMENTS_TRIGGERS;
  return METHOD_TRIGGERS;
}
 
开发者ID:eclipse,项目名称:che,代码行数:7,代码来源:JavaMethodCompletionProposal.java

示例10: hasArgumentList

/**
 * Returns <code>true</code> if the argument list should be inserted by the proposal, <code>false
 * </code> if not.
 *
 * @return <code>true</code> when the proposal is not in javadoc nor within an import and
 *     comprises the parameter list
 */
protected boolean hasArgumentList() {
  if (CompletionProposal.METHOD_NAME_REFERENCE == fProposal.getKind()) return false;
  //		IPreferenceStore preferenceStore= JavaPlugin.getDefault().getPreferenceStore();
  boolean
      noOverwrite = /*preferenceStore.getBoolean(PreferenceConstants.CODEASSIST_INSERT_COMPLETION)*/
          true ^ isToggleEating();
  char[] completion = fProposal.getCompletion();
  return !isInJavadoc()
      && completion.length > 0
      && (noOverwrite || completion[completion.length - 1] == ')');
}
 
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:JavaMethodCompletionProposal.java

示例11: updateDescription

/**
 * 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);
	}
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:65,代码来源:CompletionProposalDescriptionProvider.java

示例12: mapKind

private CompletionItemKind mapKind(final int kind) {
	switch (kind) {
	case CompletionProposal.ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION:
	case CompletionProposal.CONSTRUCTOR_INVOCATION:
		return CompletionItemKind.Constructor;
	case CompletionProposal.ANONYMOUS_CLASS_DECLARATION:
	case CompletionProposal.TYPE_REF:
		return CompletionItemKind.Class;
	case CompletionProposal.FIELD_IMPORT:
	case CompletionProposal.METHOD_IMPORT:
	case CompletionProposal.METHOD_NAME_REFERENCE:
	case CompletionProposal.PACKAGE_REF:
	case CompletionProposal.TYPE_IMPORT:
		return CompletionItemKind.Module;
	case CompletionProposal.FIELD_REF:
	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.Function;
		//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;
	}
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:42,代码来源:CompletionProposalRequestor.java

示例13: createStyledLabel

/**
 * Creates a display label with styles for a given <code>CompletionProposal</code>.
 *
 * @param proposal the completion proposal to create the display label for
 * @return the display label for <code>proposal</code>
 * @since 3.4
 */
public StyledString createStyledLabel(CompletionProposal proposal) {
  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())
        return createJavadocMethodProposalLabel(proposal);
      return createMethodProposalLabel(proposal);
    case CompletionProposal.METHOD_DECLARATION:
      return createOverrideMethodProposalLabel(proposal);
    case CompletionProposal.ANONYMOUS_CLASS_DECLARATION:
    case CompletionProposal.ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION:
      return createAnonymousTypeLabel(proposal);
    case CompletionProposal.TYPE_REF:
      return createTypeProposalLabel(proposal);
    case CompletionProposal.JAVADOC_TYPE_REF:
      return createJavadocTypeProposalLabel(proposal);
    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:
      return createJavadocSimpleProposalLabel(proposal);
    case CompletionProposal.JAVADOC_METHOD_REF:
      return createJavadocMethodProposalLabel(proposal);
    case CompletionProposal.PACKAGE_REF:
      return createPackageProposalLabel(proposal);
    case CompletionProposal.ANNOTATION_ATTRIBUTE_REF:
    case CompletionProposal.FIELD_REF:
    case CompletionProposal.FIELD_REF_WITH_CASTED_RECEIVER:
      return createLabelWithTypeAndDeclaration(proposal);
    case CompletionProposal.LOCAL_VARIABLE_REF:
    case CompletionProposal.VARIABLE_DECLARATION:
      return createSimpleLabelWithType(proposal);
    case CompletionProposal.KEYWORD:
    case CompletionProposal.LABEL_REF:
      return createSimpleLabel(proposal);
    default:
      Assert.isTrue(false);
      return null;
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:51,代码来源:CompletionProposalLabelProvider.java

示例14: createImageDescriptor

/**
 * 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);
}
 
开发者ID:eclipse,项目名称:che,代码行数:67,代码来源:CompletionProposalLabelProvider.java

示例15: 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*/);
}
 
开发者ID:eclipse,项目名称:che,代码行数:61,代码来源:CompletionProposalLabelProvider.java


注:本文中的org.eclipse.jdt.core.CompletionProposal.METHOD_NAME_REFERENCE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。