protected ICleanUp[] createPreviewCleanUps(Map values) { return new ICleanUp[] { new UnusedCodeCleanUp(values), new UnnecessaryCodeCleanUp(values), new StringCleanUp(values) }; }
public static void getUnnecessaryNLSTagProposals(IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) throws CoreException { IProposableFix fix= StringFix.createFix(context.getASTRoot(), problem, true, false); if (fix != null) { Image image= JavaPlugin.getDefault().getWorkbench().getSharedImages().getImage(ISharedImages.IMG_TOOL_DELETE); Map<String, String> options= new Hashtable<>(); options.put(CleanUpConstants.REMOVE_UNNECESSARY_NLS_TAGS, CleanUpOptions.TRUE); FixCorrectionProposal proposal= new FixCorrectionProposal(fix, new StringCleanUp(options), IProposalRelevance.UNNECESSARY_NLS_TAG, image, context); proposal.setCommandId(REMOVE_UNNECESSARY_NLS_TAG_ID); proposals.add(proposal); } }
public static void getUnnecessaryNLSTagProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) throws CoreException { IFix fix= StringFix.createFix(context.getASTRoot(), problem, true, false); if (fix != null) { Image image= JavaPlugin.getDefault().getWorkbench().getSharedImages().getImage(ISharedImages.IMG_TOOL_DELETE); Map options= new Hashtable(); options.put(CleanUpConstants.REMOVE_UNNECESSARY_NLS_TAGS, CleanUpConstants.TRUE); FixCorrectionProposal proposal= new FixCorrectionProposal(fix, new StringCleanUp(options), 6, image, context); proposal.setCommandId(REMOVE_UNNECESSARY_NLS_TAG_ID); proposals.add(proposal); } }
public static void getUnnecessaryNLSTagProposals(IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) throws CoreException { IProposableFix fix= StringFix.createFix(context.getASTRoot(), problem, true, false); if (fix != null) { Image image= JavaPlugin.getDefault().getWorkbench().getSharedImages().getImage(ISharedImages.IMG_TOOL_DELETE); Map<String, String> options= new Hashtable<>(); options.put(CleanUpConstants.REMOVE_UNNECESSARY_NLS_TAGS, CleanUpOptions.TRUE); FixCorrectionProposal proposal= new FixCorrectionProposal(fix, new StringCleanUp(options), IProposalRelevance.UNNECESSARY_NLS_TAG, image, context); proposal.setCommandId(REMOVE_UNNECESSARY_NLS_TAG_ID); proposals.add(proposal); } }
@Override protected AbstractCleanUp[] createPreviewCleanUps(Map<String, String> values) { return new AbstractCleanUp[] { new UnusedCodeCleanUp(values), new UnnecessaryCodeCleanUp(values), new StringCleanUp(values), new TypeParametersCleanUp(values) }; }
public static void addNLSProposals(IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) throws CoreException { final ICompilationUnit cu= context.getCompilationUnit(); if (cu == null || !cu.exists()){ return; } String name= CorrectionMessages.LocalCorrectionsSubProcessor_externalizestrings_description; ChangeCorrectionProposal proposal= new ChangeCorrectionProposal(name, null, IProposalRelevance.EXTERNALIZE_STRINGS, JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE)) { @Override public void apply(IDocument document) { ExternalizeWizard.open(cu, JavaPlugin.getActiveWorkbenchShell()); } @Override public Object getAdditionalProposalInfo(IProgressMonitor monitor) { return CorrectionMessages.LocalCorrectionsSubProcessor_externalizestrings_additional_info; } }; proposals.add(proposal); IProposableFix fix= StringFix.createFix(context.getASTRoot(), problem, false, true); if (fix != null) { Image image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_NLS_NEVER_TRANSLATE); Map<String, String> options= new Hashtable<>(); options.put(CleanUpConstants.ADD_MISSING_NLS_TAGS, CleanUpOptions.TRUE); FixCorrectionProposal addNLS= new FixCorrectionProposal(fix, new StringCleanUp(options), IProposalRelevance.ADD_MISSING_NLS_TAGS, image, context); addNLS.setCommandId(ADD_NON_NLS_ID); proposals.add(addNLS); } }
public static void addNLSProposals(IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) throws CoreException { final ICompilationUnit cu= context.getCompilationUnit(); if (cu == null || !cu.exists()){ return; } String name= CorrectionMessages.LocalCorrectionsSubProcessor_externalizestrings_description; ChangeCorrectionProposal proposal= new ChangeCorrectionProposal(name, null, IProposalRelevance.EXTERNALIZE_STRINGS, JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE)) { @Override public void apply(IDocument document) { ExternalizeWizard.open(cu, JavaPlugin.getActiveWorkbenchShell()); } @Override public Object getAdditionalProposalInfo(IProgressMonitor monitor) { return CorrectionMessages.LocalCorrectionsSubProcessor_externalizestrings_additional_info; } }; proposals.add(proposal); IProposableFix fix= StringFix.createFix(context.getASTRoot(), problem, false, true); if (fix != null) { Image image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_NLS_NEVER_TRANSLATE); Map<String, String> options= new Hashtable<>(); options.put(CleanUpConstants.ADD_MISSING_NLS_TAGS, CleanUpOptions.TRUE); FixCorrectionProposal addNLS= new FixCorrectionProposal(fix, new StringCleanUp(options), IProposalRelevance.ADD_MISSING_NLS_TAGS, image, context); addNLS.setCommandId(ADD_NON_NLS_ID); proposals.add(addNLS); } }
Map options= new Hashtable(); options.put(CleanUpConstants.ADD_MISSING_NLS_TAGS, CleanUpConstants.TRUE); FixCorrectionProposal addNLS= new FixCorrectionProposal(fix, new StringCleanUp(options), 3, image, context); addNLS.setCommandId(ADD_NON_NLS_ID); proposals.add(addNLS);
@Override protected AbstractCleanUp[] createPreviewCleanUps(Map<String, String> values) { return new AbstractCleanUp[] { new UnusedCodeCleanUp(values), new UnnecessaryCodeCleanUp(values), new StringCleanUp(values), new TypeParametersCleanUp(values), new RedundantModifiersCleanUp(values), new RedundantSemicolonsCleanUp(values) }; }
public static ICleanUp[] createCleanUps() { return new ICleanUp[] { new CodeStyleCleanUp(), new ControlStatementsCleanUp(), new ConvertLoopCleanUp(), new VariableDeclarationCleanUp(), new ExpressionsCleanUp(), new UnusedCodeCleanUp(), new Java50CleanUp(), new PotentialProgrammingProblemsCleanUp(), new UnnecessaryCodeCleanUp(), new StringCleanUp(), new SortMembersCleanUp(), new ImportsCleanUp(), new CodeFormatCleanUp(), new CommentFormatCleanUp()}; }
public static ICleanUp[] createCleanUps(Map settings) { return new ICleanUp[] { new CodeStyleCleanUp(settings), new ControlStatementsCleanUp(settings), new ConvertLoopCleanUp(settings), new VariableDeclarationCleanUp(settings), new ExpressionsCleanUp(settings), new UnusedCodeCleanUp(settings), new Java50CleanUp(settings), new PotentialProgrammingProblemsCleanUp(settings), new UnnecessaryCodeCleanUp(settings), new StringCleanUp(settings), new SortMembersCleanUp(settings), new ImportsCleanUp(settings), new CodeFormatCleanUp(settings), new CommentFormatCleanUp(settings)}; } }