/** * Convert set of IProblems to IProblemLocations * @param problems the problems to convert * @return the converted set */ protected static IProblemLocation[] convertProblems(IProblem[] problems) { IProblemLocation[] result= new IProblemLocation[problems.length]; for (int i= 0; i < problems.length; i++) { result[i]= new ProblemLocation(problems[i]); } return result; }
/** * Convert set of IProblems to IProblemLocations * @param problems the problems to convert * @return the converted set */ protected static IProblemLocation[] convertProblems(IProblem[] problems) { IProblemLocation[] result= new IProblemLocation[problems.length]; for (int i= 0; i < problems.length; i++) { result[i]= new ProblemLocation(problems[i]); } return result; }
public static ICleanUpFix createCleanUp(CompilationUnit compilationUnit, boolean addSerialVersionIds) { IProblem[] problems= compilationUnit.getProblems(); IProblemLocation[] locations= new IProblemLocation[problems.length]; for (int i= 0; i < problems.length; i++) { locations[i]= new ProblemLocation(problems[i]); } return createCleanUp(compilationUnit, locations, addSerialVersionIds); }
public static ICleanUpFix createCleanUp(CompilationUnit compilationUnit, boolean insertInferredTypeArguments, boolean removeRedundantTypeArguments) { IProblem[] problems= compilationUnit.getProblems(); IProblemLocation[] locations= new IProblemLocation[problems.length]; for (int i= 0; i < problems.length; i++) { locations[i]= new ProblemLocation(problems[i]); } return createCleanUp(compilationUnit, locations, insertInferredTypeArguments, removeRedundantTypeArguments); }
public static ICleanUpFix createCleanUp(CompilationUnit compilationUnit, boolean addSerialVersionIds) { IProblem[] problems= compilationUnit.getProblems(); IProblemLocation[] locations= new IProblemLocation[problems.length]; for (int i= 0; i < problems.length; i++) { locations[i]= new ProblemLocation(problems[i]); } return createCleanUp(compilationUnit, locations, addSerialVersionIds); }
public static IFix createCleanUp(CompilationUnit compilationUnit, boolean addNLSTag, boolean removeNLSTag) throws CoreException, JavaModelException { if (!addNLSTag && !removeNLSTag) return null; IProblem[] problems= compilationUnit.getProblems(); IProblemLocation[] locations= new IProblemLocation[problems.length]; for (int i= 0; i < problems.length; i++) { locations[i]= new ProblemLocation(problems[i]); } return createCleanUp(compilationUnit, addNLSTag, removeNLSTag, locations); }
private static ImportDeclaration getProblematicImport(IProblem problem, CompilationUnit cu) { ASTNode coveringNode= new ProblemLocation(problem).getCoveringNode(cu); if (coveringNode != null) { ASTNode importNode= ASTNodes.getParent(coveringNode, ASTNode.IMPORT_DECLARATION); if (importNode instanceof ImportDeclaration) { return (ImportDeclaration) importNode; } } return null; }
public static ICleanUpFix createCleanUp(CompilationUnit compilationUnit, boolean addNLSTag, boolean removeNLSTag) throws CoreException, JavaModelException { if (!addNLSTag && !removeNLSTag) return null; IProblem[] problems= compilationUnit.getProblems(); IProblemLocation[] locations= new IProblemLocation[problems.length]; for (int i= 0; i < problems.length; i++) { locations[i]= new ProblemLocation(problems[i]); } return createCleanUp(compilationUnit, addNLSTag, removeNLSTag, locations); }
public static ICleanUpFix createCleanUp(CompilationUnit compilationUnit, boolean addNLSTag, boolean removeNLSTag) throws CoreException, JavaModelException { if (!addNLSTag && !removeNLSTag) return null; IProblem[] problems= compilationUnit.getProblems(); IProblemLocation[] locations= new IProblemLocation[problems.length]; for (int i= 0; i < problems.length; i++) { locations[i]= new ProblemLocation(problems[i]); } return createCleanUp(compilationUnit, addNLSTag, removeNLSTag, locations); }
public static ICleanUpFix createCleanUp(CompilationUnit compilationUnit, boolean insertInferredTypeArguments, boolean removeRedundantTypeArguments) { IProblem[] problems= compilationUnit.getProblems(); IProblemLocation[] locations= new IProblemLocation[problems.length]; for (int i= 0; i < problems.length; i++) { locations[i]= new ProblemLocation(problems[i]); } return createCleanUp(compilationUnit, locations, insertInferredTypeArguments, removeRedundantTypeArguments); }
public static IFix createCleanUp(CompilationUnit compilationUnit, boolean addSerialVersionIds) { IProblem[] problems= compilationUnit.getProblems(); IProblemLocation[] locations= new IProblemLocation[problems.length]; for (int i= 0; i < problems.length; i++) { locations[i]= new ProblemLocation(problems[i]); } return createCleanUp(compilationUnit, locations, addSerialVersionIds); }
private static ProblemLocation getProblemLocation(IJavaAnnotation javaAnnotation, IAnnotationModel model) { int problemId= javaAnnotation.getId(); if (problemId != -1) { Position pos= model.getPosition((Annotation) javaAnnotation); if (pos != null) { return new ProblemLocation(pos.getOffset(), pos.getLength(), javaAnnotation); // java problems all handled by the quick assist processors } } return null; }
private static ProblemLocation getProblemLocation(IJavaAnnotation javaAnnotation, IAnnotationModel model) { int problemId= javaAnnotation.getId(); if (problemId != -1) { Position pos= model.getPosition((Annotation) javaAnnotation); if (pos != null) { return new ProblemLocation(pos.getOffset(), pos.getLength(), javaAnnotation); // java problems all handled by the quick assist processors } } return null; }
private static ProblemLocation getProblemLocation(IJavaAnnotation javaAnnotation, IAnnotationModel model) { int problemId= javaAnnotation.getId(); if (problemId != -1) { Position pos= model.getPosition((Annotation) javaAnnotation); if (pos != null) { return new ProblemLocation(pos.getOffset(), pos.getLength(), javaAnnotation); // java problems all handled by the quick assist processors } } return null; }
private static ProblemLocation getProblemLocation(IJavaAnnotation javaAnnotation, IAnnotationModel model) { int problemId= javaAnnotation.getId(); if (problemId != -1) { Position pos= model.getPosition((Annotation) javaAnnotation); if (pos != null) { return new ProblemLocation(pos.getOffset(), pos.getLength(), javaAnnotation); // java problems all handled by the quick assist processors } } return null; }
private ICompletionProposal[] getJavaAnnotationFixes(IJavaAnnotation javaAnnotation) { ProblemLocation location= new ProblemLocation(position.getOffset(), position.getLength(), javaAnnotation); ICompilationUnit cu= javaAnnotation.getCompilationUnit(); if (cu == null) return NO_PROPOSALS; ISourceViewer sourceViewer= null; if (viewer instanceof ISourceViewer) sourceViewer= (ISourceViewer) viewer; IInvocationContext context= new AssistContext(cu, sourceViewer, location.getOffset(), location.getLength(), SharedASTProviderCore.WAIT_ACTIVE_ONLY); if (!SpellingAnnotation.TYPE.equals(javaAnnotation.getType()) && !hasProblem(context.getASTRoot().getProblems(), location)) return NO_PROPOSALS; ArrayList<IJavaCompletionProposal> proposals= new ArrayList<>(); JavaCorrectionProcessor.collectCorrections(context, new IProblemLocation[] { location }, proposals); Collections.sort(proposals, new CompletionProposalComparator()); return proposals.toArray(new ICompletionProposal[proposals.size()]); }
private ICompletionProposal[] getJavaAnnotationFixes(IJavaAnnotation javaAnnotation) { ProblemLocation location= new ProblemLocation(position.getOffset(), position.getLength(), javaAnnotation); ICompilationUnit cu= javaAnnotation.getCompilationUnit(); if (cu == null) return NO_PROPOSALS; ISourceViewer sourceViewer= null; if (viewer instanceof ISourceViewer) sourceViewer= (ISourceViewer) viewer; IInvocationContext context= new AssistContext(cu, sourceViewer, location.getOffset(), location.getLength(), SharedASTProvider.WAIT_ACTIVE_ONLY); if (!SpellingAnnotation.TYPE.equals(javaAnnotation.getType()) && !hasProblem(context.getASTRoot().getProblems(), location)) return NO_PROPOSALS; ArrayList<IJavaCompletionProposal> proposals= new ArrayList<>(); JavaCorrectionProcessor.collectCorrections(context, new IProblemLocation[] { location }, proposals); Collections.sort(proposals, new CompletionProposalComparator()); return proposals.toArray(new ICompletionProposal[proposals.size()]); }
private static IProblemLocation createFromMarker(IMarker marker, ICompilationUnit cu) { try { int id= marker.getAttribute(IJavaModelMarker.ID, -1); int start= marker.getAttribute(IMarker.CHAR_START, -1); int end= marker.getAttribute(IMarker.CHAR_END, -1); int severity= marker.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO); String[] arguments= CorrectionEngine.getProblemArguments(marker); String markerType= marker.getType(); if (cu != null && id != -1 && start != -1 && end != -1 && arguments != null) { boolean isError= (severity == IMarker.SEVERITY_ERROR); return new ProblemLocation(start, end - start, id, arguments, isError, markerType); } } catch (CoreException e) { JavaPlugin.log(e); } return null; }
private static IProblemLocation createFromMarker(IMarker marker, ICompilationUnit cu) { try { int id= marker.getAttribute(IJavaModelMarker.ID, -1); int start= marker.getAttribute(IMarker.CHAR_START, -1); int end= marker.getAttribute(IMarker.CHAR_END, -1); int severity= marker.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO); String[] arguments= CorrectionEngine.getProblemArguments(marker); String markerType= marker.getType(); if (cu != null && id != -1 && start != -1 && end != -1 && arguments != null) { boolean isError= (severity == IMarker.SEVERITY_ERROR); return new ProblemLocation(start, end - start, id, arguments, isError, markerType); } } catch (CoreException e) { JavaPlugin.log(e); } return null; }
private static IProblemLocation createFromMarker(IMarker marker, ICompilationUnit cu) { try { int id= marker.getAttribute(IJavaModelMarker.ID, -1); int start= marker.getAttribute(IMarker.CHAR_START, -1); int end= marker.getAttribute(IMarker.CHAR_END, -1); int severity= marker.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO); String[] arguments= CorrectionEngine.getProblemArguments(marker); String markerType= marker.getType(); if (cu != null && id != -1 && start != -1 && end != -1 && arguments != null) { boolean isError= (severity == IMarker.SEVERITY_ERROR); return new ProblemLocation(start, end - start, id, arguments, isError, markerType); } } catch (CoreException e) { JavaPlugin.log(e); } return null; }