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


Java IJavaElement.FIELD属性代码示例

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


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

示例1: processType

private void processType(ITypeVisitor visitor, BinaryTypeName btn,
    IType type, IProgressMonitor monitor) throws JavaModelException {
  final String binaryname = btn.toString();
  monitor.subTask(binaryname);
  visitor.visit(type, binaryname);
  for (final IJavaElement child : type.getChildren()) {
    if (monitor.isCanceled()) {
      break;
    }
    switch (child.getElementType()) {
    case IJavaElement.TYPE:
      IType nestedtype = (IType) child;
      processType(visitor, btn.nest(nestedtype), nestedtype, monitor);
      break;
    case IJavaElement.METHOD:
    case IJavaElement.INITIALIZER:
    case IJavaElement.FIELD:
      processAnonymousInnerTypes(visitor, btn, (IMember) child, monitor);
      break;
    }
  }
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:22,代码来源:TypeTraverser.java

示例2: collectChildren

private void collectChildren(ITypeRoot unit, IJavaElement[] elements, ArrayList<SymbolInformation> symbols,
		IProgressMonitor monitor)
		throws JavaModelException {
	for(IJavaElement element : elements ){
		if (monitor.isCanceled()) {
			return;
		}
		if(element instanceof IParent){
			collectChildren(unit, filter(((IParent) element).getChildren()), symbols, monitor);
		}
		int type = element.getElementType();
		if (type != IJavaElement.TYPE && type != IJavaElement.FIELD && type != IJavaElement.METHOD) {
			continue;
		}

		Location location = JDTUtils.toLocation(element);
		if (location != null) {
			SymbolInformation si = new SymbolInformation();
			String name = JavaElementLabels.getElementLabel(element, JavaElementLabels.ALL_DEFAULT);
			si.setName(name == null ? element.getElementName() : name);
			si.setKind(mapKind(element));
			if (element.getParent() != null) {
				si.setContainerName(element.getParent().getElementName());
			}
			location.setUri(ResourceUtils.toClientUri(location.getUri()));
			si.setLocation(location);
			if (!symbols.contains(si)) {
				symbols.add(si);
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:32,代码来源:DocumentSymbolHandler.java

示例3: mapKind

public static SymbolKind mapKind(IJavaElement element) {
	switch (element.getElementType()) {
	case IJavaElement.ANNOTATION:
		return SymbolKind.Property; // TODO: find a better mapping
	case IJavaElement.CLASS_FILE:
	case IJavaElement.COMPILATION_UNIT:
		return SymbolKind.File;
	case IJavaElement.FIELD:
		return SymbolKind.Field;
	case IJavaElement.IMPORT_CONTAINER:
	case IJavaElement.IMPORT_DECLARATION:
		return SymbolKind.Module;
	case IJavaElement.INITIALIZER:
		return SymbolKind.Constructor;
	case IJavaElement.LOCAL_VARIABLE:
	case IJavaElement.TYPE_PARAMETER:
		return SymbolKind.Variable;
	case IJavaElement.METHOD:
		return SymbolKind.Method;
	case IJavaElement.PACKAGE_DECLARATION:
		return SymbolKind.Package;
	case IJavaElement.TYPE:
		try {
			return ( ((IType)element).isInterface() ? SymbolKind.Interface : SymbolKind.Class);
		} catch (JavaModelException e) {
			return SymbolKind.Class;
		}
	}
	return SymbolKind.String;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:30,代码来源:DocumentSymbolHandler.java

示例4: getKind

private String getKind(IMember member) {
	switch (member.getElementType()) {
	case IJavaElement.METHOD:
		return KIND_METHOD;
	case IJavaElement.INITIALIZER:
		return KIND_INITIALIZER;
	case IJavaElement.FIELD:
		return KIND_FIELD;
	case IJavaElement.TYPE:
		IType type = (IType) member;
		try {
			if (type.isAnnotation()) {
				return KIND_ANNOTATION;
			}
			if (type.isInterface()) {
				return KIND_INTERFACE;
			}
			if (type.isEnum()) {
				return KIND_ENUM;
			}
			if (type.isClass()) {
				return KIND_CLASS;
			}
		} catch (JavaModelException e) {
			return KIND_TYPE;
		}
		return KIND_TYPE;
	default:
		return null;
	}
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:31,代码来源:JavaTypeMemberBookmarkPropertiesProvider.java

示例5: appendElementLabel

/**
 * Appends the label for a Java element with the flags as defined by this class.
 *
 * @param element the element to render
 * @param flags the rendering flags.
 */
public void appendElementLabel(IJavaElement element, long flags) {
	int type= element.getElementType();
	IPackageFragmentRoot root= null;

	if (type != IJavaElement.JAVA_MODEL && type != IJavaElement.JAVA_PROJECT && type != IJavaElement.PACKAGE_FRAGMENT_ROOT) {
		root= JavaModelUtil.getPackageFragmentRoot(element);
	}
	if (root != null && getFlag(flags, JavaElementLabels.PREPEND_ROOT_PATH)) {
		appendPackageFragmentRootLabel(root, JavaElementLabels.ROOT_QUALIFIED);
		fBuilder.append(JavaElementLabels.CONCAT_STRING);
	}

	switch (type) {
	case IJavaElement.METHOD:
		appendMethodLabel((IMethod) element, flags);
		break;
	case IJavaElement.FIELD:
		appendFieldLabel((IField) element, flags);
		break;
	case IJavaElement.LOCAL_VARIABLE:
		appendLocalVariableLabel((ILocalVariable) element, flags);
		break;
	case IJavaElement.TYPE_PARAMETER:
		appendTypeParameterLabel((ITypeParameter) element, flags);
		break;
	case IJavaElement.INITIALIZER:
		appendInitializerLabel((IInitializer) element, flags);
		break;
	case IJavaElement.TYPE:
		appendTypeLabel((IType) element, flags);
		break;
	case IJavaElement.CLASS_FILE:
		appendClassFileLabel((IClassFile) element, flags);
		break;
	case IJavaElement.COMPILATION_UNIT:
		appendCompilationUnitLabel((ICompilationUnit) element, flags);
		break;
	case IJavaElement.PACKAGE_FRAGMENT:
		appendPackageFragmentLabel((IPackageFragment) element, flags);
		break;
	case IJavaElement.PACKAGE_FRAGMENT_ROOT:
		appendPackageFragmentRootLabel((IPackageFragmentRoot) element, flags);
		break;
	case IJavaElement.IMPORT_CONTAINER:
	case IJavaElement.IMPORT_DECLARATION:
	case IJavaElement.PACKAGE_DECLARATION:
		appendDeclarationLabel(element, flags);
		break;
	case IJavaElement.JAVA_PROJECT:
	case IJavaElement.JAVA_MODEL:
		fBuilder.append(element.getElementName());
		break;
	default:
		fBuilder.append(element.getElementName());
	}

	if (root != null && getFlag(flags, JavaElementLabels.APPEND_ROOT_PATH)) {
		fBuilder.append(JavaElementLabels.CONCAT_STRING);
		appendPackageFragmentRootLabel(root, JavaElementLabels.ROOT_QUALIFIED);
	}
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:67,代码来源:JavaElementLabelComposer.java


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