use of org.eclipse.jdt.ls.core.internal.corext.fix.UnusedCodeFix in project eclipse.jdt.ls by eclipse.
the class LocalCorrectionsSubProcessor method addUnusedMemberProposal.
public static void addUnusedMemberProposal(IInvocationContext context, IProblemLocation problem, Collection<CUCorrectionProposal> proposals) {
int problemId = problem.getProblemId();
UnusedCodeFix fix = UnusedCodeFix.createUnusedMemberFix(context.getASTRoot(), problem, false);
if (fix != null) {
try {
CompilationUnitChange change = fix.createChange(null);
CUCorrectionProposal proposal = new CUCorrectionProposal(change.getName(), change.getCompilationUnit(), change, IProposalRelevance.UNUSED_MEMBER);
proposals.add(proposal);
} catch (CoreException e) {
JavaLanguageServerPlugin.log(e);
}
}
if (problemId == IProblem.ArgumentIsNeverUsed) {
JavadocTagsSubProcessor.getUnusedAndUndocumentedParameterOrExceptionProposals(context, problem, proposals);
}
if (problemId == IProblem.UnusedPrivateField) {
GetterSetterCorrectionSubProcessor.addGetterSetterProposal(context, problem, proposals);
}
}
Aggregations