use of org.eclipse.jdt.internal.ui.fix.LambdaExpressionsCleanUp in project che by eclipse.
the class QuickAssistProcessor method getConvertLambdaToAnonymousClassCreationsProposals.
private static boolean getConvertLambdaToAnonymousClassCreationsProposals(IInvocationContext context, ASTNode covering, Collection<ICommandAccess> resultingCollections) {
LambdaExpression lambda;
if (covering instanceof LambdaExpression) {
lambda = (LambdaExpression) covering;
} else if (covering.getLocationInParent() == LambdaExpression.BODY_PROPERTY) {
lambda = (LambdaExpression) covering.getParent();
} else {
return false;
}
IProposableFix fix = LambdaExpressionsFix.createConvertToAnonymousClassCreationsFix(lambda);
if (fix == null)
return false;
if (resultingCollections == null)
return true;
// add correction proposal
Image image = JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
Map<String, String> options = new Hashtable<String, String>();
options.put(CleanUpConstants.CONVERT_FUNCTIONAL_INTERFACES, CleanUpOptions.TRUE);
options.put(CleanUpConstants.USE_ANONYMOUS_CLASS_CREATION, CleanUpOptions.TRUE);
FixCorrectionProposal proposal = new FixCorrectionProposal(fix, new LambdaExpressionsCleanUp(options), IProposalRelevance.CONVERT_TO_ANONYMOUS_CLASS_CREATION, image, context);
resultingCollections.add(proposal);
return true;
}
Aggregations