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


Java JavaElementImageProvider.getTypeImageDescriptor方法代码示例

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


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

示例1: getImageDescriptor

import org.eclipse.jdt.internal.ui.viewsupport.JavaElementImageProvider; //导入方法依赖的package包/类
@Override
public ImageDescriptor getImageDescriptor(Context context, Bookmark bookmark) {
	ImageDescriptorRegistry registry = JavaPlugin
			.getImageDescriptorRegistry();
	ImageDescriptor descriptor = null;
	String kind = bookmark.getPropertyValue(PROP_JAVA_ELEMENT_KIND);
	if (KIND_METHOD.equals(kind)) {
		descriptor = JavaElementImageProvider
				.getMethodImageDescriptor(false, 0);
	}
	if (KIND_FIELD.equals(kind)) {
		descriptor = JavaElementImageProvider
				.getFieldImageDescriptor(false, 0);
	}
	if (KIND_ANNOTATION.equals(kind)) {
		descriptor = JavaElementImageProvider
				.getTypeImageDescriptor(false, true, Flags.AccAnnotation, false);			
	}
	if (KIND_ENUM.equals(kind)) {
		descriptor = JavaElementImageProvider
				.getTypeImageDescriptor(false, false, Flags.AccEnum, false);			
	}
	if (KIND_INTERFACE.equals(kind)) {
		descriptor = JavaElementImageProvider
				.getTypeImageDescriptor(false, true, Flags.AccInterface, false);			
	}
	if (KIND_CLASS.equals(kind)) {
		descriptor = JavaElementImageProvider
				.getTypeImageDescriptor(false, false, 0, false);
	}		
	if (KIND_TYPE.equals(kind)) {
		descriptor = JavaElementImageProvider
				.getTypeImageDescriptor(false, false, 0, false);
	}
	return descriptor;
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:37,代码来源:JavaBookmarkLabelProvider.java

示例2: getImageDescriptor

import org.eclipse.jdt.internal.ui.viewsupport.JavaElementImageProvider; //导入方法依赖的package包/类
public ImageDescriptor getImageDescriptor(Object element) {
	TypeNameMatch type= (TypeNameMatch)element;
	if (fProviderExtension != null) {
		fAdapter.setMatch(type);
		ImageDescriptor descriptor= fProviderExtension.getImageDescriptor(fAdapter);
		if (descriptor != null)
			return descriptor;
	}
	return JavaElementImageProvider.getTypeImageDescriptor(
		isInnerType(type), false, type.getModifiers(), false);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:12,代码来源:TypeInfoViewer.java

示例3: getImageDescriptor

import org.eclipse.jdt.internal.ui.viewsupport.JavaElementImageProvider; //导入方法依赖的package包/类
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);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:33,代码来源:TypeNameMatchLabelProvider.java

示例4: createImageDescriptor

import org.eclipse.jdt.internal.ui.viewsupport.JavaElementImageProvider; //导入方法依赖的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);
}
 
开发者ID:eclipse,项目名称:che,代码行数:68,代码来源:CompletionProposalLabelProvider.java

示例5: accept

import org.eclipse.jdt.internal.ui.viewsupport.JavaElementImageProvider; //导入方法依赖的package包/类
@Override
public void accept(CompletionProposal proposal) {
	switch (proposal.getKind()) {
		case CompletionProposal.PACKAGE_REF :
			char[] packageName= proposal.getDeclarationSignature();
			if (TypeFilter.isFiltered(packageName))
				return;
			addAdjustedCompletion(
					new String(packageName),
					new String(proposal.getCompletion()),
					proposal.getReplaceStart(),
					proposal.getReplaceEnd(),
					proposal.getRelevance(),
					JavaPluginImages.DESC_OBJS_PACKAGE);
			return;

		case CompletionProposal.TYPE_REF :
			char[] signature= proposal.getSignature();
			char[] fullName= Signature.toCharArray(signature);
			if (TypeFilter.isFiltered(fullName))
				return;
			StringBuffer buf= new StringBuffer();
			buf.append(Signature.getSimpleName(fullName));
			if (buf.length() == 0)
				return; // this is the dummy class, whose $ have been converted to dots
			char[] typeQualifier= Signature.getQualifier(fullName);
			if (typeQualifier.length > 0) {
				buf.append(JavaElementLabels.CONCAT_STRING);
				buf.append(typeQualifier);
			}
			String name= buf.toString();

			// Only fully qualify if it's a top level type:
			boolean fullyQualify= fFullyQualify && CharOperation.equals(proposal.getDeclarationSignature(), typeQualifier);

			ImageDescriptor typeImageDescriptor;
			switch (Signature.getTypeSignatureKind(signature)) {
				case Signature.TYPE_VARIABLE_SIGNATURE :
					typeImageDescriptor= JavaPluginImages.DESC_OBJS_TYPEVARIABLE;
					break;
				case Signature.CLASS_TYPE_SIGNATURE :
					typeImageDescriptor= JavaElementImageProvider.getTypeImageDescriptor(false, false, proposal.getFlags(), false);
					break;
				default :
					typeImageDescriptor= null;
			}

			addAdjustedTypeCompletion(
					name,
					new String(proposal.getCompletion()),
					proposal.getReplaceStart(),
					proposal.getReplaceEnd(),
					proposal.getRelevance(),
					typeImageDescriptor,
					fullyQualify ? new String(fullName) : null);
			return;

		case CompletionProposal.KEYWORD:
			if (! fEnableBaseTypes)
				return;
			String keyword= new String(proposal.getName());
			if ( (fEnableVoid && VOID.equals(keyword)) || (fEnableBaseTypes && BASE_TYPES.contains(keyword)) )
				addAdjustedCompletion(
						keyword,
						new String(proposal.getCompletion()),
						proposal.getReplaceStart(),
						proposal.getReplaceEnd(),
						proposal.getRelevance(),
						null);
			return;

		default :
			return;
	}

}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:77,代码来源:JavaTypeCompletionProcessor.java

示例6: createImageDescriptor

import org.eclipse.jdt.internal.ui.viewsupport.JavaElementImageProvider; //导入方法依赖的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);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:68,代码来源:CompletionProposalLabelProvider.java

示例7: getTypeImageDescriptor

import org.eclipse.jdt.internal.ui.viewsupport.JavaElementImageProvider; //导入方法依赖的package包/类
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);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:47,代码来源:HierarchyLabelProvider.java


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