當前位置: 首頁>>代碼示例>>Java>>正文


Java ITypeBinding.isNested方法代碼示例

本文整理匯總了Java中org.eclipse.jdt.core.dom.ITypeBinding.isNested方法的典型用法代碼示例。如果您正苦於以下問題:Java ITypeBinding.isNested方法的具體用法?Java ITypeBinding.isNested怎麽用?Java ITypeBinding.isNested使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jdt.core.dom.ITypeBinding的用法示例。


在下文中一共展示了ITypeBinding.isNested方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initializeDestinations

import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
private void initializeDestinations() {
	List<ASTNode> result = new ArrayList<>();
	BodyDeclaration decl = fAnalyzer.getEnclosingBodyDeclaration();
	ASTNode current = ASTResolving.findParentType(decl.getParent());
	if (fAnalyzer.isValidDestination(current)) {
		result.add(current);
	}
	if (current != null && (decl instanceof MethodDeclaration || decl instanceof Initializer || decl instanceof FieldDeclaration)) {
		ITypeBinding binding = ASTNodes.getEnclosingType(current);
		ASTNode next = ASTResolving.findParentType(current.getParent());
		while (next != null && binding != null && binding.isNested()) {
			if (fAnalyzer.isValidDestination(next)) {
				result.add(next);
			}
			current = next;
			binding = ASTNodes.getEnclosingType(current);
			next = ASTResolving.findParentType(next.getParent());
		}
	}
	fDestinations = result.toArray(new ASTNode[result.size()]);
	fDestination = fDestinations[fDestinationIndex];
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:23,代碼來源:ExtractMethodRefactoring.java

示例2: getSimpleName

import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
private static String getSimpleName(ITypeBinding itb) {
	if (itb.isNested()) {
		if (itb.isAnonymous()) {
			String binname = itb.getBinaryName();
			int index = binname.indexOf('$');
			String name = binname.substring(index + 1, binname.length());
			return getSimpleName(itb.getDeclaringClass()) + "#" + name;
		} else {
			return getSimpleName(itb.getDeclaringClass()) + "#"
					+ itb.getName();
		}
	} else {
		return itb.getName();
	}
}
 
開發者ID:aserg-ufmg,項目名稱:RefDiff,代碼行數:16,代碼來源:ASTVisitorAtomicChange.java

示例3: addNewFieldProposals

import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
private static void addNewFieldProposals(ICompilationUnit cu, CompilationUnit astRoot, ITypeBinding binding,
		ITypeBinding declaringTypeBinding, SimpleName simpleName, boolean isWriteAccess,
		Collection<CUCorrectionProposal> proposals) throws JavaModelException {
	// new variables
	ICompilationUnit targetCU;
	ITypeBinding senderDeclBinding;
	if (binding != null) {
		senderDeclBinding= binding.getTypeDeclaration();
		targetCU= ASTResolving.findCompilationUnitForBinding(cu, astRoot, senderDeclBinding);
	} else { // binding is null for accesses without qualifier
		senderDeclBinding= declaringTypeBinding;
		targetCU= cu;
	}

	if (!senderDeclBinding.isFromSource() || targetCU == null) {
		return;
	}

	boolean mustBeConst= ASTResolving.isInsideModifiers(simpleName);

	addNewFieldForType(targetCU, binding, senderDeclBinding, simpleName, isWriteAccess, mustBeConst, proposals);

	if (binding == null && senderDeclBinding.isNested()) {
		ASTNode anonymDecl= astRoot.findDeclaringNode(senderDeclBinding);
		if (anonymDecl != null) {
			ITypeBinding bind= Bindings.getBindingOfParentType(anonymDecl.getParent());
			if (!bind.isAnonymous()) {
				addNewFieldForType(targetCU, bind, bind, simpleName, isWriteAccess, mustBeConst, proposals);
			}
		}
	}
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:33,代碼來源:UnresolvedElementsSubProcessor.java

示例4: getDomainParamsDecl

import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
/**
 * return declared domain parameters includes OWNER!
 */
public static List<DomainParams> getDomainParamsDecl(ITypeBinding tb, AnnotationDatabase annoDB) {
	if (tb.isNested()) {
		ITypeBinding declaringClass = tb.getDeclaringClass();
		return getDomainParamsDecl(declaringClass, annoDB);
	}
	List<DomainParams> result = new ArrayList<DomainParams>();
	result.add(DomainParams.create(Constants.OWNER));
	List<ICrystalAnnotation> annots = annoDB.getAnnosForType(tb);
	if (annots == null || annots.isEmpty()) {
		// Try to load XML Loader.
		String key = tb.getErasure().getKey();
		TypeAnnotationInfo typeDecl = TypeAnnotationInfo.getBinding(key);
		if (typeDecl != null) {
			for (String domParam : typeDecl.getParameters()) {
				result.add(DomainParams.create(domParam));
			}
			return result;
		}
	}
	for (ICrystalAnnotation iCrystalAnnotation : annots) {
		if (iCrystalAnnotation.getName().endsWith(Constants.DOMAIN_PARAMS)) {
			Object[] annot = (Object[]) iCrystalAnnotation.getObject("value");
			for (int i = 0; i < annot.length; i++) {
				result.add(DomainParams.create((String) annot[i]));
			}
			return result;
		}
	}
	return result;
}
 
開發者ID:aroog,項目名稱:code,代碼行數:34,代碼來源:Utils.java

示例5: getDomainParamsDecl2

import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
public static List<String> getDomainParamsDecl2(ITypeBinding tb, AnnotationDatabase annoDB) {
	if (tb.isNested()) {
		ITypeBinding declaringClass = tb.getDeclaringClass();
		return getDomainParamsDecl2(declaringClass, annoDB);
	}
	List<String> result = new ArrayList<String>();
	result.add(Constants.OWNER);
	List<ICrystalAnnotation> annots = annoDB.getAnnosForType(tb);
	if (annots == null || annots.isEmpty()) {
		// Try to load XML Loader.
		String key = tb.getErasure().getKey();
		TypeAnnotationInfo typeDecl = TypeAnnotationInfo.getBinding(key);
		if (typeDecl != null) {
			for (String domParam : typeDecl.getParameters()) {
				result.add(domParam);
			}
			return result;
		}
	}
	for (ICrystalAnnotation iCrystalAnnotation : annots) {
		if (iCrystalAnnotation.getName().endsWith(Constants.DOMAIN_PARAMS)) {
			Object[] annot = (Object[]) iCrystalAnnotation.getObject("value");
			for (int i = 0; i < annot.length; i++) {
				result.add((String) annot[i]);
			}
			return result;
		}
	}
	return result;
}
 
開發者ID:aroog,項目名稱:code,代碼行數:31,代碼來源:Utils.java

示例6: addNewMethodProposals

import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
private static void addNewMethodProposals(ICompilationUnit cu, CompilationUnit astRoot, Expression sender,
		List<Expression> arguments, boolean isSuperInvocation, ASTNode invocationNode, String methodName,
		Collection<CUCorrectionProposal> proposals) throws JavaModelException {
	ITypeBinding nodeParentType= Bindings.getBindingOfParentType(invocationNode);
	ITypeBinding binding= null;
	if (sender != null) {
		binding= sender.resolveTypeBinding();
	} else {
		binding= nodeParentType;
		if (isSuperInvocation && binding != null) {
			binding= binding.getSuperclass();
		}
	}
	if (binding != null && binding.isFromSource()) {
		ITypeBinding senderDeclBinding= binding.getTypeDeclaration();

		ICompilationUnit targetCU= ASTResolving.findCompilationUnitForBinding(cu, astRoot, senderDeclBinding);
		if (targetCU != null) {
			String label;
			ITypeBinding[] parameterTypes= getParameterTypes(arguments);
			if (parameterTypes != null) {
				String sig = ASTResolving.getMethodSignature(methodName, parameterTypes, false);
				boolean is18OrHigher= JavaModelUtil.is18OrHigher(targetCU.getJavaProject());

				boolean isSenderBindingInterface= senderDeclBinding.isInterface();
				if (nodeParentType == senderDeclBinding) {
					label= Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_createmethod_description, sig);
				} else {
					label= Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_createmethod_other_description, new Object[] { sig, BasicElementLabels.getJavaElementName(senderDeclBinding.getName()) } );
				}
				if (is18OrHigher || !isSenderBindingInterface
						|| (nodeParentType != senderDeclBinding && (!(sender instanceof SimpleName) || !((SimpleName) sender).getIdentifier().equals(senderDeclBinding.getName())))) {
					proposals.add(new NewMethodCorrectionProposal(label, targetCU, invocationNode, arguments,
							senderDeclBinding, IProposalRelevance.CREATE_METHOD));
				}

				if (senderDeclBinding.isNested() && cu.equals(targetCU) && sender == null && Bindings.findMethodInHierarchy(senderDeclBinding, methodName, (ITypeBinding[]) null) == null) { // no covering method
					ASTNode anonymDecl= astRoot.findDeclaringNode(senderDeclBinding);
					if (anonymDecl != null) {
						senderDeclBinding= Bindings.getBindingOfParentType(anonymDecl.getParent());
						isSenderBindingInterface= senderDeclBinding.isInterface();
						if (!senderDeclBinding.isAnonymous()) {
							if (is18OrHigher || !isSenderBindingInterface) {
								String[] args = new String[] { sig,
										ASTResolving.getTypeSignature(senderDeclBinding) };
								label= Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_createmethod_other_description, args);
								proposals.add(new NewMethodCorrectionProposal(label, targetCU, invocationNode,
										arguments, senderDeclBinding, IProposalRelevance.CREATE_METHOD));
							}
						}
					}
				}
			}
		}
	}
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:57,代碼來源:UnresolvedElementsSubProcessor.java


注:本文中的org.eclipse.jdt.core.dom.ITypeBinding.isNested方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。