Search in sources :

Example 1 with ControlStatementsCleanUp

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

the class QuickAssistProcessor method getRemoveBlockProposals.

private static boolean getRemoveBlockProposals(IInvocationContext context, ASTNode coveringNode, Collection<ICommandAccess> resultingCollections) {
    IProposableFix[] fixes = ControlStatementsFix.createRemoveBlockFix(context.getASTRoot(), coveringNode);
    if (fixes != null) {
        if (resultingCollections == null) {
            return true;
        }
        Map<String, String> options = new Hashtable<String, String>();
        options.put(CleanUpConstants.CONTROL_STATEMENTS_USE_BLOCKS, CleanUpOptions.TRUE);
        options.put(CleanUpConstants.CONTROL_STATMENTS_USE_BLOCKS_NEVER, CleanUpOptions.TRUE);
        ICleanUp cleanUp = new ControlStatementsCleanUp(options);
        for (int i = 0; i < fixes.length; i++) {
            IProposableFix fix = fixes[i];
            Image image = JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
            FixCorrectionProposal proposal = new FixCorrectionProposal(fix, cleanUp, IProposalRelevance.REMOVE_BLOCK_FIX, image, context);
            resultingCollections.add(proposal);
        }
        return true;
    }
    return false;
}
Also used : FixCorrectionProposal(org.eclipse.jdt.internal.ui.text.correction.proposals.FixCorrectionProposal) ICleanUp(org.eclipse.jdt.ui.cleanup.ICleanUp) Hashtable(java.util.Hashtable) IProposableFix(org.eclipse.jdt.internal.corext.fix.IProposableFix) Image(org.eclipse.swt.graphics.Image) ControlStatementsCleanUp(org.eclipse.jdt.internal.ui.fix.ControlStatementsCleanUp)

Aggregations

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