@Override public String[] getArguments() { return isProblem() ? fProblem.getArguments() : null; }
@Override public String[] getArguments() { return isProblem() ? fProblem.getArguments() : null; }
public String[] getArguments() { return isProblem() ? fProblem.getArguments() : null; }
sb.append("]\n"); String[] args = problem.getArguments(); for (int i = 0; i < args.length; i++) { String arg = args[i];
/** * Performs code correction for the given IProblem, * reporting results to the given correction requestor. * * Correction results are answered through a requestor. * * @param problem * the problem which describe the problem to correct. * @param targetUnit * denote the compilation unit in which correction occurs. Cannot be null. * @param requestor * the given correction requestor * @exception IllegalArgumentException if <code>targetUnit</code> or <code>requestor</code> is <code>null</code> * @exception JavaModelException currently this exception is never thrown, but the opportunity to thrown an exception * when the correction failed is kept for later. * @since 2.0 */ public void computeCorrections(IProblem problem, ICompilationUnit targetUnit, ICorrectionRequestor requestor) throws JavaModelException { if (requestor == null) { throw new IllegalArgumentException(Messages.correction_nullUnit); } this.computeCorrections( targetUnit, problem.getID(), problem.getSourceStart(), problem.getSourceEnd(), problem.getArguments(), requestor); }
/** * Performs code correction for the given IProblem, * reporting results to the given correction requestor. * * Correction results are answered through a requestor. * * @param problem * the problem which describe the problem to correct. * @param targetUnit * denote the compilation unit in which correction occurs. Cannot be null. * @param requestor * the given correction requestor * @exception IllegalArgumentException if <code>targetUnit</code> or <code>requestor</code> is <code>null</code> * @exception JavaModelException currently this exception is never thrown, but the opportunity to thrown an exception * when the correction failed is kept for later. * @since 2.0 */ public void computeCorrections(IProblem problem, ICompilationUnit targetUnit, ICorrectionRequestor requestor) throws JavaModelException { if (requestor == null) { throw new IllegalArgumentException(Messages.correction_nullUnit); } this.computeCorrections( targetUnit, problem.getID(), problem.getSourceStart(), problem.getSourceEnd(), problem.getArguments(), requestor); }
/** * Performs code correction for the given IProblem, * reporting results to the given correction requestor. * * Correction results are answered through a requestor. * * @param problem * the problem which describe the problem to correct. * @param targetUnit * denote the compilation unit in which correction occurs. Cannot be null. * @param requestor * the given correction requestor * @exception IllegalArgumentException if <code>targetUnit</code> or <code>requestor</code> is <code>null</code> * @exception JavaModelException currently this exception is never thrown, but the opportunity to thrown an exception * when the correction failed is kept for later. * @since 2.0 */ public void computeCorrections(IProblem problem, ICompilationUnit targetUnit, ICorrectionRequestor requestor) throws JavaModelException { if (requestor == null) { throw new IllegalArgumentException(Messages.correction_nullUnit); } this.computeCorrections( targetUnit, problem.getID(), problem.getSourceStart(), problem.getSourceEnd(), problem.getArguments(), requestor); }
/** * Performs code correction for the given IProblem, * reporting results to the given correction requestor. * * Correction results are answered through a requestor. * * @param problem * the problem which describe the problem to correct. * @param targetUnit * denote the compilation unit in which correction occurs. Cannot be null. * @param requestor * the given correction requestor * @exception IllegalArgumentException if <code>targetUnit</code> or <code>requestor</code> is <code>null</code> * @exception JavaModelException currently this exception is never thrown, but the opportunity to thrown an exception * when the correction failed is kept for later. * @since 2.0 */ public void computeCorrections(IProblem problem, ICompilationUnit targetUnit, ICorrectionRequestor requestor) throws JavaModelException { if (requestor == null) { throw new IllegalArgumentException(Messages.correction_nullUnit); } this.computeCorrections( targetUnit, problem.getID(), problem.getSourceStart(), problem.getSourceEnd(), problem.getArguments(), requestor); }
/** * Performs code correction for the given IProblem, * reporting results to the given correction requestor. * * Correction results are answered through a requestor. * * @param problem * the problem which describe the problem to correct. * @param targetUnit * denote the compilation unit in which correction occurs. Cannot be null. * @param requestor * the given correction requestor * @exception IllegalArgumentException if <code>targetUnit</code> or <code>requestor</code> is <code>null</code> * @exception JavaModelException currently this exception is never thrown, but the opportunity to thrown an exception * when the correction failed is kept for later. * @since 2.0 */ public void computeCorrections(IProblem problem, ICompilationUnit targetUnit, ICorrectionRequestor requestor) throws JavaModelException { if (requestor == null) { throw new IllegalArgumentException(Messages.correction_nullUnit); } this.computeCorrections( targetUnit, problem.getID(), problem.getSourceStart(), problem.getSourceEnd(), problem.getArguments(), requestor); }
/** * Performs code correction for the given IProblem, * reporting results to the given correction requestor. * * Correction results are answered through a requestor. * * @param problem * the problem which describe the problem to correct. * @param targetUnit * denote the compilation unit in which correction occurs. Cannot be null. * @param requestor * the given correction requestor * @exception IllegalArgumentException if <code>targetUnit</code> or <code>requestor</code> is <code>null</code> * @exception JavaModelException currently this exception is never thrown, but the opportunity to thrown an exception * when the correction failed is kept for later. * @since 2.0 */ public void computeCorrections(IProblem problem, ICompilationUnit targetUnit, ICorrectionRequestor requestor) throws JavaModelException { if (requestor == null) { throw new IllegalArgumentException(Messages.correction_nullUnit); } this.computeCorrections( targetUnit, problem.getID(), problem.getSourceStart(), problem.getSourceEnd(), problem.getArguments(), requestor); }
public ProblemLocation(IProblem problem) { fId= problem.getID(); fArguments= problem.getArguments(); fOffset= problem.getSourceStart(); fLength= problem.getSourceEnd() - fOffset + 1; fIsError= problem.isError(); fMarkerType= problem instanceof CategorizedProblem ? ((CategorizedProblem) problem).getMarkerType() : IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER; }
public ProblemLocation(IProblem problem) { fId= problem.getID(); fArguments= problem.getArguments(); fOffset= problem.getSourceStart(); fLength= problem.getSourceEnd() - fOffset + 1; fIsError= problem.isError(); fMarkerType= problem instanceof CategorizedProblem ? ((CategorizedProblem) problem).getMarkerType() : IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER; }
public ProblemLocationCore(IProblem problem) { fId= problem.getID(); fArguments= problem.getArguments(); fOffset= problem.getSourceStart(); fLength= problem.getSourceEnd() - fOffset + 1; fIsError= problem.isError(); fMarkerType= problem instanceof CategorizedProblem ? ((CategorizedProblem) problem).getMarkerType() : IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER; }
if (problem.getID() == IProblem.CannotImportPackage) { message = problem.getArguments()[0] + " cannot be resolved";
if (problem.getID() == IProblem.CannotImportPackage) { message = problem.getArguments()[0] + " cannot be resolved";
if (problem.getID() == IProblem.CannotImportPackage) { message = problem.getArguments()[0] + " cannot be resolved";
protected boolean removeUnused(ICompilationUnit cu, ImportsManager imports) { ASTParser parser = ASTParser.newParser(AST.JLS3); parser.setSource(cu); parser.setResolveBindings(true); CompilationUnit root = (CompilationUnit) parser.createAST(null); IProblem[] problems = root.getProblems(); boolean importRemoved = false; for (int i = 0; i < problems.length; i++) { if (problems[i].getID() == IProblem.UnusedImport) { String imp = problems[i].getArguments()[0]; imports.removeImport(imp); importRemoved = true; } } return importRemoved; }
@Override protected boolean shouldReport(IProblem problem, CompilationUnit cu) { if (!super.shouldReport(problem, cu)) return false; ASTNode node= ASTNodeSearchUtil.getAstNode(cu, problem.getSourceStart(), problem.getSourceEnd() - problem.getSourceStart() + 1); if (node instanceof Type) { Type type= (Type) node; if (problem.getID() == IProblem.UndefinedType && getClassName().equals(ASTNodes.getTypeName(type))) { return false; } } if (node instanceof Name) { Name name= (Name) node; if (problem.getID() == IProblem.ImportNotFound && getPackage().indexOf(name.getFullyQualifiedName()) != -1) return false; if (problem.getID() == IProblem.MissingTypeInMethod) { StructuralPropertyDescriptor locationInParent= name.getLocationInParent(); String[] arguments= problem.getArguments(); if ((locationInParent == MethodInvocation.NAME_PROPERTY || locationInParent == SuperMethodInvocation.NAME_PROPERTY) && arguments.length > 3 && arguments[3].endsWith(getClassName())) return false; } } return true; }
@Override protected boolean shouldReport(IProblem problem, CompilationUnit cu) { if (!super.shouldReport(problem, cu)) return false; ASTNode node= ASTNodeSearchUtil.getAstNode(cu, problem.getSourceStart(), problem.getSourceEnd() - problem.getSourceStart() + 1); if (node instanceof Type) { Type type= (Type) node; if (problem.getID() == IProblem.UndefinedType && getClassName().equals(ASTNodes.getTypeName(type))) { return false; } } if (node instanceof Name) { Name name= (Name) node; if (problem.getID() == IProblem.ImportNotFound && getPackage().indexOf(name.getFullyQualifiedName()) != -1) return false; if (problem.getID() == IProblem.MissingTypeInMethod) { StructuralPropertyDescriptor locationInParent= name.getLocationInParent(); String[] arguments= problem.getArguments(); if ((locationInParent == MethodInvocation.NAME_PROPERTY || locationInParent == SuperMethodInvocation.NAME_PROPERTY) && arguments.length > 3 && arguments[3].endsWith(getClassName())) return false; } } return true; }
if (problem.getID() == IProblem.CannotImportPackage) { message = problem.getArguments()[0] + " cannot be resolved";