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


Java QualifiedType类代码示例

本文整理汇总了Java中org.eclipse.jdt.core.dom.QualifiedType的典型用法代码示例。如果您正苦于以下问题:Java QualifiedType类的具体用法?Java QualifiedType怎么用?Java QualifiedType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getNormalizedNode

import org.eclipse.jdt.core.dom.QualifiedType; //导入依赖的package包/类
/**
 * For {@link Name} or {@link Type} nodes, returns the topmost {@link Type} node
 * that shares the same type binding as the given node.
 *
 * @param node an ASTNode
 * @return the normalized {@link Type} node or the original node
 */
public static ASTNode getNormalizedNode(ASTNode node) {
	ASTNode current= node;
	// normalize name
	if (QualifiedName.NAME_PROPERTY.equals(current.getLocationInParent())) {
		current= current.getParent();
	}
	// normalize type
	if (QualifiedType.NAME_PROPERTY.equals(current.getLocationInParent())
			|| SimpleType.NAME_PROPERTY.equals(current.getLocationInParent())
			|| NameQualifiedType.NAME_PROPERTY.equals(current.getLocationInParent())) {
		current= current.getParent();
	}
	// normalize parameterized types
	if (ParameterizedType.TYPE_PROPERTY.equals(current.getLocationInParent())) {
		current= current.getParent();
	}
	return current;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:26,代码来源:ASTNodes.java

示例2: getNormalizedNode

import org.eclipse.jdt.core.dom.QualifiedType; //导入依赖的package包/类
/**
 * For {@link Name} or {@link org.eclipse.jdt.core.dom.Type} nodes, returns the topmost {@link
 * org.eclipse.jdt.core.dom.Type} node that shares the same type binding as the given node.
 *
 * @param node an ASTNode
 * @return the normalized {@link org.eclipse.jdt.core.dom.Type} node or the original node
 */
public static ASTNode getNormalizedNode(ASTNode node) {
  ASTNode current = node;
  // normalize name
  if (QualifiedName.NAME_PROPERTY.equals(current.getLocationInParent())) {
    current = current.getParent();
  }
  // normalize type
  if (QualifiedType.NAME_PROPERTY.equals(current.getLocationInParent())
      || SimpleType.NAME_PROPERTY.equals(current.getLocationInParent())
      || NameQualifiedType.NAME_PROPERTY.equals(current.getLocationInParent())) {
    current = current.getParent();
  }
  // normalize parameterized types
  if (ParameterizedType.TYPE_PROPERTY.equals(current.getLocationInParent())) {
    current = current.getParent();
  }
  return current;
}
 
开发者ID:eclipse,项目名称:che,代码行数:26,代码来源:ASTNodes.java

示例3: getNormalizedNode

import org.eclipse.jdt.core.dom.QualifiedType; //导入依赖的package包/类
/**
 * For {@link Name} or {@link Type} nodes, returns the topmost {@link Type} node
 * that shares the same type binding as the given node.
 * 
 * @param node an ASTNode
 * @return the normalized {@link Type} node or the original node
 */
public static ASTNode getNormalizedNode(ASTNode node) {
	ASTNode current= node;
	// normalize name
	if (QualifiedName.NAME_PROPERTY.equals(current.getLocationInParent())) {
		current= current.getParent();
	}
	// normalize type
	if (QualifiedType.NAME_PROPERTY.equals(current.getLocationInParent())
			|| SimpleType.NAME_PROPERTY.equals(current.getLocationInParent())
			|| NameQualifiedType.NAME_PROPERTY.equals(current.getLocationInParent())) {
		current= current.getParent();
	}
	// normalize parameterized types
	if (ParameterizedType.TYPE_PROPERTY.equals(current.getLocationInParent())) {
		current= current.getParent();
	}
	return current;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:26,代码来源:ASTNodes.java

示例4: getNormalizedNode

import org.eclipse.jdt.core.dom.QualifiedType; //导入依赖的package包/类
public static ASTNode getNormalizedNode(ASTNode node) {
	ASTNode current= node;
	// normalize name
	if (QualifiedName.NAME_PROPERTY.equals(current.getLocationInParent())) {
		current= current.getParent();
	}
	// normalize type
	if (QualifiedType.NAME_PROPERTY.equals(current.getLocationInParent()) ||
		SimpleType.NAME_PROPERTY.equals(current.getLocationInParent())) {
		current= current.getParent();
	}
	// normalize parameterized types
	if (ParameterizedType.TYPE_PROPERTY.equals(current.getLocationInParent())) {
		current= current.getParent();
	}
	return current;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:18,代码来源:ASTNodes.java

示例5: getLeftMostSimpleType

import org.eclipse.jdt.core.dom.QualifiedType; //导入依赖的package包/类
public static SimpleType getLeftMostSimpleType(QualifiedType type) {
	final SimpleType[] result= new SimpleType[1];
	ASTVisitor visitor= new ASTVisitor() {
		@Override
		public boolean visit(QualifiedType qualifiedType) {
			Type left= qualifiedType.getQualifier();
			if (left instanceof SimpleType)
				result[0]= (SimpleType)left;
			else
				left.accept(this);
			return false;
		}
	};
	type.accept(visitor);
	return result[0];
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:17,代码来源:ASTNodes.java

示例6: toClassName

import org.eclipse.jdt.core.dom.QualifiedType; //导入依赖的package包/类
public static String toClassName(IProject project, Type type)
{
    Name name = null;
    
    if (type instanceof SimpleType)
    {
        name = ((SimpleType) type).getName();
    }
    else if (type instanceof QualifiedType)
    {
        name = ((QualifiedType) type).getName();
    }
    else if (type instanceof ParameterizedType)
    {
        return toClassName(project, ((ParameterizedType) type).getType());
    }
    else
    {
        //  Unsupported type, i.e., primitive types are not supported at the moment
        return null;
    }
    
    return name.isQualifiedName()
             ? name.getFullyQualifiedName()
             : tryResolveFQNameFromImports(project, type.getRoot(), name.getFullyQualifiedName());
}
 
开发者ID:anjlab,项目名称:eclipse-tapestry5-plugin,代码行数:27,代码来源:EclipseUtils.java

示例7: tryToResolve

import org.eclipse.jdt.core.dom.QualifiedType; //导入依赖的package包/类
protected boolean tryToResolve(Type type) {
	boolean result = false;

	if (underResolution.getResolverMap().containsKey(type)) {
		result = true;
	} else {
		if (type.isPrimitiveType()) {
			result = tryToResolve((PrimitiveType)type);
		} else if (type.isQualifiedType()) {
			result = tryToResolve((QualifiedType)type);
		} else if (type.isArrayType()) {
			result = tryToResolve(((ArrayType)type).getElementType());
		} else if (type.isSimpleType()) {
			result = tryToResolve((SimpleType)type);
		} else if (type.isParameterizedType()) {
			result = tryToResolve((ParameterizedType)type);
		} else if (type.isWildcardType()) {
			result = tryToResolve((WildcardType)type);
		} else {
			CoreActivator.log(IStatus.INFO, "Type not handled " + type.toString());
		}
	}
	return result;
}
 
开发者ID:hmarchadour,项目名称:2uml,代码行数:25,代码来源:ResolverImpl.java

示例8: getName

import org.eclipse.jdt.core.dom.QualifiedType; //导入依赖的package包/类
/**
 * Return a name instance from a Type instance
 */
public static Name getName(Type t) {
	if (t.isArrayType()) {
		ArrayType arrayType = (ArrayType) t;
		return getName(ASTArrayTypeHelper.getComponentType(arrayType));
	} else if (t.isParameterizedType()) {
		return getName(((ParameterizedType) t).getType());
	} else if (t.isPrimitiveType()) {
		return null;
	} else if (t.isQualifiedType()) {
		return ((QualifiedType) t).getName();
	} else if (t.isSimpleType()) {
		return ((SimpleType) t).getName();
	}

	return null;
}
 
开发者ID:awltech,项目名称:eclipse-optimus,代码行数:20,代码来源:JavaCodeHelper.java

示例9: visit

import org.eclipse.jdt.core.dom.QualifiedType; //导入依赖的package包/类
@Override
public boolean visit(QualifiedType node) {
  addType(
      node.resolveBinding(),
      extractClassNameFromQualifiedName(extractTypeNameWithoutGenerics(node)),
      node.getStartPosition());
  return true;
}
 
开发者ID:bazelbuild,项目名称:BUILD_file_generator,代码行数:9,代码来源:ReferencedClassesParser.java

示例10: getNameOfType

import org.eclipse.jdt.core.dom.QualifiedType; //导入依赖的package包/类
/**
 * @return a String representation of 'type'. Handles qualified, simple and parameterized types.
 */
@Nullable
private String getNameOfType(Type type) {
  if (type instanceof QualifiedType) {
    return extractTypeNameWithoutGenerics((QualifiedType) type);
  }
  if (type instanceof SimpleType) {
    return ((SimpleType) type).getName().getFullyQualifiedName();
  }
  if (type instanceof ParameterizedType) {
    return getNameOfType(((ParameterizedType) type).getType());
  }
  return null;
}
 
开发者ID:bazelbuild,项目名称:BUILD_file_generator,代码行数:17,代码来源:ReferencedClassesParser.java

示例11: testExtractTypeNameWithoutGenerics

import org.eclipse.jdt.core.dom.QualifiedType; //导入依赖的package包/类
@Test
public void testExtractTypeNameWithoutGenerics() {
  AST ast = AST.newAST(AST.JLS4);
  org.eclipse.jdt.core.dom.SimpleName entry = ast.newSimpleName("Entry");
  ParameterizedType map = ast.newParameterizedType(ast.newSimpleType(ast.newSimpleName("Map")));
  map.typeArguments().add(ast.newSimpleType(ast.newSimpleName("Foo")));
  QualifiedType type = ast.newQualifiedType(map, entry);
  assertThat(type.toString()).isEqualTo("Map<Foo>.Entry");
  assertThat(ReferencedClassesParser.extractTypeNameWithoutGenerics(type)).isEqualTo("Map.Entry");
}
 
开发者ID:bazelbuild,项目名称:BUILD_file_generator,代码行数:11,代码来源:ReferencedClassesParserTest.java

示例12: endVisit

import org.eclipse.jdt.core.dom.QualifiedType; //导入依赖的package包/类
@Override
public void endVisit(QualifiedType node) {
	if (skipNode(node)) {
		return;
	}
	processSequential(node, node.getQualifier(), node.getName());
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:8,代码来源:FlowAnalyzer.java

示例13: getSelectedName

import org.eclipse.jdt.core.dom.QualifiedType; //导入依赖的package包/类
private static SimpleName getSelectedName(CompilationUnit compilationUnit, IProblemLocation problem) {
	final ASTNode selection= problem.getCoveredNode(compilationUnit);
	if (selection == null)
		return null;

	Name name= null;
	if (selection instanceof SimpleType) {
		name= ((SimpleType) selection).getName();
	} else if (selection instanceof NameQualifiedType) {
		name= ((NameQualifiedType) selection).getName();
	} else if (selection instanceof QualifiedType) {
		name= ((QualifiedType) selection).getName();
	} else if (selection instanceof ParameterizedType) {
		final ParameterizedType type= (ParameterizedType) selection;
		final Type raw= type.getType();
		if (raw instanceof SimpleType)
			name= ((SimpleType) raw).getName();
		else if (raw instanceof NameQualifiedType)
			name= ((NameQualifiedType) raw).getName();
		else if (raw instanceof QualifiedType)
			name= ((QualifiedType) raw).getName();
	} else if (selection instanceof Name) {
		name= (Name) selection;
	}
	if (name == null)
		return null;

	if (name.isSimpleName()) {
		return (SimpleName)name;
	} else {
		return ((QualifiedName)name).getName();
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:34,代码来源:PotentialProgrammingProblemsFix.java

示例14: visit

import org.eclipse.jdt.core.dom.QualifiedType; //导入依赖的package包/类
@Override
public boolean visit(QualifiedType node) {
	node.getQualifier().accept(this);
	this.fBuffer.append(".");//$NON-NLS-1$
	node.getName().accept(this);
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:8,代码来源:ASTFlattener.java

示例15: resolveBinding

import org.eclipse.jdt.core.dom.QualifiedType; //导入依赖的package包/类
private static IBinding resolveBinding(ASTNode node) {
	if (node instanceof SimpleName) {
		// workaround for https://bugs.eclipse.org/62605 (constructor name resolves to type, not method)
		SimpleName simpleName= (SimpleName) node;
		StructuralPropertyDescriptor loc= simpleName.getLocationInParent();
		while (loc == QualifiedType.NAME_PROPERTY || loc == QualifiedName.NAME_PROPERTY|| loc == SimpleType.NAME_PROPERTY || loc == ParameterizedType.TYPE_PROPERTY) {
			node= node.getParent();
			loc= node.getLocationInParent();
		}
		if (loc == ClassInstanceCreation.TYPE_PROPERTY) {
			ClassInstanceCreation cic= (ClassInstanceCreation) node.getParent();
			IMethodBinding constructorBinding= cic.resolveConstructorBinding();
			if (constructorBinding == null)
				return null;
			ITypeBinding declaringClass= constructorBinding.getDeclaringClass();
			if (!declaringClass.isAnonymous())
				return constructorBinding;
			ITypeBinding superTypeDeclaration= declaringClass.getSuperclass().getTypeDeclaration();
			return resolveSuperclassConstructor(superTypeDeclaration, constructorBinding);
		}
		return simpleName.resolveBinding();
		
	} else if (node instanceof SuperConstructorInvocation) {
		return ((SuperConstructorInvocation) node).resolveConstructorBinding();
	} else if (node instanceof ConstructorInvocation) {
		return ((ConstructorInvocation) node).resolveConstructorBinding();
	} else {
		return null;
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:31,代码来源:JavadocHover.java


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