public static void importNotFoundProposals(IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) throws CoreException { ICompilationUnit cu= context.getCompilationUnit(); ASTNode selectedNode= problem.getCoveringNode(context.getASTRoot()); if (selectedNode == null) { return; } ImportDeclaration importDeclaration= (ImportDeclaration) ASTNodes.getParent(selectedNode, ASTNode.IMPORT_DECLARATION); if (importDeclaration == null) { return; } if (!importDeclaration.isOnDemand()) { Name name= importDeclaration.getName(); if (importDeclaration.isStatic() && name.isQualifiedName()) { name= ((QualifiedName) name).getQualifier(); } int kind= JavaModelUtil.is50OrHigher(cu.getJavaProject()) ? SimilarElementsRequestor.REF_TYPES : SimilarElementsRequestor.CLASSES | SimilarElementsRequestor.INTERFACES; UnresolvedElementsSubProcessor.addNewTypeProposals(cu, name, kind, IProposalRelevance.IMPORT_NOT_FOUND_NEW_TYPE, proposals); } String name= ASTNodes.asString(importDeclaration.getName()); if (importDeclaration.isOnDemand()) { name= JavaModelUtil.concatenateName(name, "*"); //$NON-NLS-1$ } addProjectSetupFixProposal(context, problem, name, proposals); }
public static void importNotFoundProposals(IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) throws CoreException { ICompilationUnit cu= context.getCompilationUnit(); ASTNode selectedNode= problem.getCoveringNode(context.getASTRoot()); if (selectedNode == null) { return; } ImportDeclaration importDeclaration= (ImportDeclaration) ASTNodes.getParent(selectedNode, ASTNode.IMPORT_DECLARATION); if (importDeclaration == null) { return; } if (!importDeclaration.isOnDemand()) { Name name= importDeclaration.getName(); if (importDeclaration.isStatic() && name.isQualifiedName()) { name= ((QualifiedName) name).getQualifier(); } int kind= JavaModelUtil.is50OrHigher(cu.getJavaProject()) ? TypeKinds.REF_TYPES : TypeKinds.CLASSES | TypeKinds.INTERFACES; UnresolvedElementsSubProcessor.addRequiresModuleProposals(cu, name, IProposalRelevance.IMPORT_NOT_FOUND_ADD_REQUIRES_MODULE, proposals, false); UnresolvedElementsSubProcessor.addNewTypeProposals(cu, name, kind, IProposalRelevance.IMPORT_NOT_FOUND_NEW_TYPE, proposals); } else { Name name= importDeclaration.getName(); UnresolvedElementsSubProcessor.addRequiresModuleProposals(cu, name, IProposalRelevance.IMPORT_NOT_FOUND_ADD_REQUIRES_MODULE, proposals, true); } String name= ASTNodes.asString(importDeclaration.getName()); if (importDeclaration.isOnDemand()) { name= JavaModelUtil.concatenateName(name, "*"); //$NON-NLS-1$ } addProjectSetupFixProposal(context, problem, name, proposals); }
ReorgCorrectionsSubProcessor.addProjectSetupFixProposal(context, problem, node.getFullyQualifiedName(), proposals);
ReorgCorrectionsSubProcessor.addProjectSetupFixProposal(context, problem, node.getFullyQualifiedName(), proposals);
addNewTypeProposals(cu, node, typeKind, relevance, proposals); ReorgCorrectionsSubProcessor.addProjectSetupFixProposal(context, problem, node.getFullyQualifiedName(), proposals);
addNewTypeProposals(cu, node, typeKind, relevance, proposals); ReorgCorrectionsSubProcessor.addProjectSetupFixProposal(context, problem, node.getFullyQualifiedName(), proposals);