本文整理匯總了Java中org.eclipse.jdt.core.dom.ITypeBinding.isFromSource方法的典型用法代碼示例。如果您正苦於以下問題:Java ITypeBinding.isFromSource方法的具體用法?Java ITypeBinding.isFromSource怎麽用?Java ITypeBinding.isFromSource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jdt.core.dom.ITypeBinding
的用法示例。
在下文中一共展示了ITypeBinding.isFromSource方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: extractSupertypesForPostProcessing
import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
private void extractSupertypesForPostProcessing(RastNode type, ITypeBinding superTypeBinding) {
List<String> supertypes = postProcessSupertypes.get(type);
if (supertypes == null) {
supertypes = new ArrayList<String>();
postProcessSupertypes.put(type, supertypes);
}
while (superTypeBinding != null && superTypeBinding.isFromSource()) {
String superTypeName = superTypeBinding.getErasure().getQualifiedName();
supertypes.add(superTypeName);
superTypeBinding = superTypeBinding.getSuperclass();
}
}
示例2: visit
import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
@Override
public boolean visit(AnonymousClassDeclaration node) {
if (node.getParent() instanceof ClassInstanceCreation) {
ClassInstanceCreation parent = (ClassInstanceCreation) node.getParent();
ITypeBinding typeBinding = parent.getType().resolveBinding();
if (typeBinding != null && typeBinding.isFromSource()) {
SDType type = model.createAnonymousType(containerStack.peek(), sourceFilePath, "");
containerStack.push(type);
extractSupertypesForPostProcessing(type, typeBinding);
return true;
}
}
return false;
}
示例3: endVisit
import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
@Override
public void endVisit(AnonymousClassDeclaration node) {
if (node.getParent() instanceof ClassInstanceCreation) {
ClassInstanceCreation parent = (ClassInstanceCreation) node.getParent();
ITypeBinding typeBinding = parent.getType().resolveBinding();
if (typeBinding != null && typeBinding.isFromSource()) {
containerStack.pop();
}
}
}
示例4: extractSupertypesForPostProcessing
import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
private void extractSupertypesForPostProcessing(SDType type, ITypeBinding superTypeBinding) {
List<String> supertypes = postProcessSupertypes.get(type);
if (supertypes == null) {
supertypes = new ArrayList<String>();
postProcessSupertypes.put(type, supertypes);
}
while (superTypeBinding != null && superTypeBinding.isFromSource()) {
String superTypeName = superTypeBinding.getErasure().getQualifiedName();
supertypes.add(superTypeName);
superTypeBinding = superTypeBinding.getSuperclass();
}
}
示例5: 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);
}
}
}
}
示例6: ignoreType
import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
protected boolean ignoreType(ITypeBinding typeBinding) {
return this.onlyFromSource && !typeBinding.isFromSource();
}
示例7: addIncompatibleReturnTypeProposals
import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
public static void addIncompatibleReturnTypeProposals(IInvocationContext context, IProblemLocation problem,
Collection<CUCorrectionProposal> proposals) throws JavaModelException {
CompilationUnit astRoot= context.getASTRoot();
ASTNode selectedNode= problem.getCoveringNode(astRoot);
if (selectedNode == null) {
return;
}
MethodDeclaration decl= ASTResolving.findParentMethodDeclaration(selectedNode);
if (decl == null) {
return;
}
IMethodBinding methodDeclBinding= decl.resolveBinding();
if (methodDeclBinding == null) {
return;
}
ITypeBinding returnType= methodDeclBinding.getReturnType();
IMethodBinding overridden= Bindings.findOverriddenMethod(methodDeclBinding, false);
if (overridden == null || overridden.getReturnType() == returnType) {
return;
}
ICompilationUnit cu= context.getCompilationUnit();
IMethodBinding methodDecl= methodDeclBinding.getMethodDeclaration();
ITypeBinding overriddenReturnType= overridden.getReturnType();
if (! JavaModelUtil.is50OrHigher(context.getCompilationUnit().getJavaProject())) {
overriddenReturnType= overriddenReturnType.getErasure();
}
proposals.add(new TypeChangeCorrectionProposal(cu, methodDecl, astRoot, overriddenReturnType, false, IProposalRelevance.CHANGE_RETURN_TYPE));
ICompilationUnit targetCu= cu;
IMethodBinding overriddenDecl= overridden.getMethodDeclaration();
ITypeBinding overridenDeclType= overriddenDecl.getDeclaringClass();
if (overridenDeclType.isFromSource()) {
targetCu= ASTResolving.findCompilationUnitForBinding(cu, astRoot, overridenDeclType);
if (targetCu != null && ASTResolving.isUseableTypeInContext(returnType, overriddenDecl, false)) {
TypeChangeCorrectionProposal proposal= new TypeChangeCorrectionProposal(targetCu, overriddenDecl, astRoot, returnType, false, IProposalRelevance.CHANGE_RETURN_TYPE_OF_OVERRIDDEN);
if (overridenDeclType.isInterface()) {
proposal.setDisplayName(Messages.format(CorrectionMessages.TypeMismatchSubProcessor_changereturnofimplemented_description, BasicElementLabels.getJavaElementName(overriddenDecl.getName())));
} else {
proposal.setDisplayName(Messages.format(CorrectionMessages.TypeMismatchSubProcessor_changereturnofoverridden_description, BasicElementLabels.getJavaElementName(overriddenDecl.getName())));
}
proposals.add(proposal);
}
}
}
示例8: 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));
}
}
}
}
}
}
}
}
示例9: isFromSource
import org.eclipse.jdt.core.dom.ITypeBinding; //導入方法依賴的package包/類
public static boolean isFromSource(ITypeBinding typeBinding) {
if (typeBinding != null) {
return typeBinding.isFromSource();
}
return false;
}