use of org.eclipse.jdt.internal.ui.fix.ConvertLoopCleanUp in project che by eclipse.
the class QuickAssistProcessor method getConvertIterableLoopProposal.
private static boolean getConvertIterableLoopProposal(IInvocationContext context, ASTNode node, Collection<ICommandAccess> resultingCollections) {
ForStatement forStatement = getEnclosingForStatementHeader(node);
if (forStatement == null)
return false;
if (resultingCollections == null)
return true;
IProposableFix fix = ConvertLoopFix.createConvertIterableLoopToEnhancedFix(context.getASTRoot(), forStatement);
if (fix == null)
return false;
Image image = JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
Map<String, String> options = new HashMap<String, String>();
options.put(CleanUpConstants.CONTROL_STATMENTS_CONVERT_FOR_LOOP_TO_ENHANCED, CleanUpOptions.TRUE);
ICleanUp cleanUp = new ConvertLoopCleanUp(options);
FixCorrectionProposal proposal = new FixCorrectionProposal(fix, cleanUp, IProposalRelevance.CONVERT_ITERABLE_LOOP_TO_ENHANCED, image, context);
proposal.setCommandId(CONVERT_FOR_LOOP_ID);
resultingCollections.add(proposal);
return true;
}
use of org.eclipse.jdt.internal.ui.fix.ConvertLoopCleanUp in project che by eclipse.
the class QuickAssistProcessor method getConvertForLoopProposal.
private static boolean getConvertForLoopProposal(IInvocationContext context, ASTNode node, Collection<ICommandAccess> resultingCollections) {
ForStatement forStatement = getEnclosingForStatementHeader(node);
if (forStatement == null)
return false;
if (resultingCollections == null)
return true;
IProposableFix fix = ConvertLoopFix.createConvertForLoopToEnhancedFix(context.getASTRoot(), forStatement);
if (fix == null)
return false;
Image image = JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
Map<String, String> options = new HashMap<String, String>();
options.put(CleanUpConstants.CONTROL_STATMENTS_CONVERT_FOR_LOOP_TO_ENHANCED, CleanUpOptions.TRUE);
ICleanUp cleanUp = new ConvertLoopCleanUp(options);
FixCorrectionProposal proposal = new FixCorrectionProposal(fix, cleanUp, IProposalRelevance.CONVERT_FOR_LOOP_TO_ENHANCED, image, context);
proposal.setCommandId(CONVERT_FOR_LOOP_ID);
resultingCollections.add(proposal);
return true;
}
Aggregations