Search in sources :

Example 1 with UnnecessaryCodeCleanUp

use of org.eclipse.jdt.internal.ui.fix.UnnecessaryCodeCleanUp in project che by eclipse.

the class LocalCorrectionsSubProcessor method addUnnecessaryCastProposal.

public static void addUnnecessaryCastProposal(IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) {
    IProposableFix fix = UnusedCodeFix.createRemoveUnusedCastFix(context.getASTRoot(), problem);
    if (fix != null) {
        Image image = JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
        Map<String, String> options = new Hashtable<String, String>();
        options.put(CleanUpConstants.REMOVE_UNNECESSARY_CASTS, CleanUpOptions.TRUE);
        FixCorrectionProposal proposal = new FixCorrectionProposal(fix, new UnnecessaryCodeCleanUp(options), IProposalRelevance.REMOVE_UNUSED_CAST, image, context);
        proposals.add(proposal);
    }
}
Also used : UnnecessaryCodeCleanUp(org.eclipse.jdt.internal.ui.fix.UnnecessaryCodeCleanUp) FixCorrectionProposal(org.eclipse.jdt.internal.ui.text.correction.proposals.FixCorrectionProposal) Hashtable(java.util.Hashtable) IProposableFix(org.eclipse.jdt.internal.corext.fix.IProposableFix) Image(org.eclipse.swt.graphics.Image)

Aggregations

Hashtable (java.util.Hashtable)1 IProposableFix (org.eclipse.jdt.internal.corext.fix.IProposableFix)1 UnnecessaryCodeCleanUp (org.eclipse.jdt.internal.ui.fix.UnnecessaryCodeCleanUp)1 FixCorrectionProposal (org.eclipse.jdt.internal.ui.text.correction.proposals.FixCorrectionProposal)1 Image (org.eclipse.swt.graphics.Image)1