private static ParameterizedType getParameterizedType(CompilationUnit compilationUnit, IProblemLocation problem) { ASTNode selectedNode= problem.getCoveringNode(compilationUnit); if (selectedNode == null) return null; while (!(selectedNode instanceof ParameterizedType) && !(selectedNode instanceof Statement)) { selectedNode= selectedNode.getParent(); } if (selectedNode instanceof ParameterizedType) { return (ParameterizedType) selectedNode; } return null; }
private static SimpleName getName(CompilationUnit compilationUnit, IProblemLocation problem) { ASTNode selectedNode= problem.getCoveringNode(compilationUnit); while (selectedNode instanceof QualifiedName) { selectedNode= ((QualifiedName) selectedNode).getQualifier(); } if (!(selectedNode instanceof SimpleName)) { return null; } return (SimpleName) selectedNode; }
private static ImportDeclaration getImportDeclaration(IProblemLocation problem, CompilationUnit compilationUnit) { ASTNode selectedNode= problem.getCoveringNode(compilationUnit); if (selectedNode != null) { ASTNode node= ASTNodes.getParent(selectedNode, ASTNode.IMPORT_DECLARATION); if (node instanceof ImportDeclaration) { return (ImportDeclaration)node; } } return null; }
private static SimpleName getUnusedName(CompilationUnit compilationUnit, IProblemLocation problem) { ASTNode selectedNode= problem.getCoveringNode(compilationUnit); if (selectedNode instanceof MethodDeclaration) { return ((MethodDeclaration) selectedNode).getName(); } else if (selectedNode instanceof SimpleName) { return (SimpleName) selectedNode; } return null; }
private static ImportDeclaration getImportDeclaration(IProblemLocation problem, CompilationUnit compilationUnit) { ASTNode selectedNode= problem.getCoveringNode(compilationUnit); if (selectedNode != null) { ASTNode node= ASTNodes.getParent(selectedNode, ASTNode.IMPORT_DECLARATION); if (node instanceof ImportDeclaration) { return (ImportDeclaration)node; } } return null; }
private static ParameterizedType getParameterizedType(CompilationUnit compilationUnit, IProblemLocation problem) { ASTNode selectedNode= problem.getCoveringNode(compilationUnit); if (selectedNode == null) return null; while (!(selectedNode instanceof ParameterizedType) && !(selectedNode instanceof Statement)) { selectedNode= selectedNode.getParent(); } if (selectedNode instanceof ParameterizedType) { return (ParameterizedType) selectedNode; } return null; }
private static SimpleName getName(CompilationUnit compilationUnit, IProblemLocation problem) { ASTNode selectedNode= problem.getCoveringNode(compilationUnit); while (selectedNode instanceof QualifiedName) { selectedNode= ((QualifiedName) selectedNode).getQualifier(); } if (!(selectedNode instanceof SimpleName)) { return null; } return (SimpleName) selectedNode; }
private static SimpleName getUnusedName(CompilationUnit compilationUnit, IProblemLocation problem) { ASTNode selectedNode= problem.getCoveringNode(compilationUnit); if (selectedNode instanceof MethodDeclaration) { return ((MethodDeclaration) selectedNode).getName(); } else if (selectedNode instanceof SimpleName) { return (SimpleName) selectedNode; } return null; }
private static SimpleName getName(CompilationUnit compilationUnit, IProblemLocation problem) { ASTNode selectedNode= problem.getCoveringNode(compilationUnit); while (selectedNode instanceof QualifiedName) { selectedNode= ((QualifiedName) selectedNode).getQualifier(); } if (!(selectedNode instanceof SimpleName)) { return null; } return (SimpleName) selectedNode; }
public static void getGenerateForLoopProposals(IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) { ASTNode coveringNode= problem.getCoveringNode(context.getASTRoot()); if (coveringNode != null) { QuickAssistProcessor.getGenerateForLoopProposals(context, coveringNode, null, proposals); } }
public static void getGenerateForLoopProposals(IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) { ASTNode coveringNode= problem.getCoveringNode(context.getASTRoot()); if (coveringNode != null) { QuickAssistProcessor.getGenerateForLoopProposals(context, coveringNode, null, proposals); } }
public static void getConvertLambdaToAnonymousClassCreationsProposals(IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) { ASTNode coveringNode= problem.getCoveringNode(context.getASTRoot()); if (coveringNode != null) { QuickAssistProcessor.getConvertLambdaToAnonymousClassCreationsProposals(context, coveringNode, proposals); } }
public static void addUnreachableCatchProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) { ASTNode selectedNode= problem.getCoveringNode(context.getASTRoot()); if (selectedNode == null) { return; } QuickAssistProcessor.getCatchClauseToThrowsProposals(context, selectedNode, proposals); }
public static void addUnreachableCatchProposals(IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) { ASTNode selectedNode= problem.getCoveringNode(context.getASTRoot()); if (selectedNode == null) { return; } QuickAssistProcessor.getCatchClauseToThrowsProposals(context, selectedNode, proposals); }
public static void addValueForAnnotationProposals(IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) { ICompilationUnit cu= context.getCompilationUnit(); ASTNode selectedNode= problem.getCoveringNode(context.getASTRoot()); if (selectedNode instanceof Annotation) { Annotation annotation= (Annotation) selectedNode; if (annotation.resolveTypeBinding() == null) { return; } MissingAnnotationAttributesProposal proposal= new MissingAnnotationAttributesProposal(cu, annotation, 10); proposals.add(proposal); } }
public static void addValueForAnnotationProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) { ICompilationUnit cu= context.getCompilationUnit(); ASTNode selectedNode= problem.getCoveringNode(context.getASTRoot()); if (selectedNode instanceof Annotation) { Annotation annotation= (Annotation) selectedNode; if (annotation.resolveTypeBinding() == null) { return; } MissingAnnotationAttributesProposal proposal= new MissingAnnotationAttributesProposal(cu, annotation, 10); proposals.add(proposal); } }
public static void addValueForAnnotationProposals(IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) { ICompilationUnit cu= context.getCompilationUnit(); ASTNode selectedNode= problem.getCoveringNode(context.getASTRoot()); if (selectedNode instanceof Annotation) { Annotation annotation= (Annotation) selectedNode; if (annotation.resolveTypeBinding() == null) { return; } MissingAnnotationAttributesProposal proposal= new MissingAnnotationAttributesProposal(cu, annotation, 10); proposals.add(proposal); } }
public static void addReturnAndArgumentTypeProposal(IInvocationContext context, IProblemLocation problem, ChangeKind changeKind, Collection<ICommandAccess> proposals) { CompilationUnit astRoot= context.getASTRoot(); ASTNode selectedNode= problem.getCoveringNode(astRoot); boolean isArgumentProblem= NullAnnotationsFix.isComplainingAboutArgument(selectedNode); if (isArgumentProblem || NullAnnotationsFix.isComplainingAboutReturn(selectedNode)) addNullAnnotationInSignatureProposal(context, problem, proposals, changeKind, isArgumentProblem); }
public static UnusedCodeFix createRemoveUnusedCastFix(CompilationUnit compilationUnit, IProblemLocation problem) { if (problem.getProblemId() != IProblem.UnnecessaryCast) return null; ASTNode selectedNode= problem.getCoveringNode(compilationUnit); ASTNode curr= selectedNode; while (curr instanceof ParenthesizedExpression) { curr= ((ParenthesizedExpression) curr).getExpression(); } if (!(curr instanceof CastExpression)) return null; return new UnusedCodeFix(FixMessages.UnusedCodeFix_RemoveCast_description, compilationUnit, new CompilationUnitRewriteOperation[] {new RemoveCastOperation((CastExpression)curr)}); }
public static IFix createRemoveUnusedCastFix(CompilationUnit compilationUnit, IProblemLocation problem) { if (problem.getProblemId() != IProblem.UnnecessaryCast) return null; ASTNode selectedNode= problem.getCoveringNode(compilationUnit); ASTNode curr= selectedNode; while (curr instanceof ParenthesizedExpression) { curr= ((ParenthesizedExpression) curr).getExpression(); } if (!(curr instanceof CastExpression)) return null; return new UnusedCodeFix(FixMessages.UnusedCodeFix_RemoveCast_description, compilationUnit, new IFixRewriteOperation[] {new RemoveCastOperation((CastExpression)curr, selectedNode)}); }