@Override protected ICleanUp[] getCleanUps(ICompilationUnit[] units) { Map<String, String> settings= new Hashtable<>(); settings.put(CleanUpConstants.FORMAT_SOURCE_CODE, CleanUpOptions.TRUE); return new ICleanUp[] { new CodeFormatCleanUp(settings) }; }
public IFix createFix(ICompilationUnit compilationUnit) throws CoreException { if (compilationUnit == null) return null; boolean removeWhitespaces= isEnabled(CleanUpConstants.FORMAT_REMOVE_TRAILING_WHITESPACES); return CodeFormatFix.createCleanUp(compilationUnit, isEnabled(CleanUpConstants.FORMAT_SOURCE_CODE), removeWhitespaces && isEnabled(CleanUpConstants.FORMAT_REMOVE_TRAILING_WHITESPACES_ALL), removeWhitespaces && isEnabled(CleanUpConstants.FORMAT_REMOVE_TRAILING_WHITESPACES_IGNORE_EMPTY)); }
@Override protected ICleanUp[] getCleanUps(ICompilationUnit[] units) { Map<String, String> settings= new Hashtable<>(); settings.put(CleanUpConstants.FORMAT_SOURCE_CODE, CleanUpOptions.TRUE); return new ICleanUp[] { new CodeFormatCleanUp(settings) }; }
@Override protected AbstractCleanUp[] createPreviewCleanUps(Map<String, String> values) { return new AbstractCleanUp[] { new ImportsCleanUp(values), new CodeFormatCleanUp(values), new SortMembersCleanUp(values) }; }
@Override public String[] getStepDescriptions() { ArrayList<String> result= new ArrayList<>(); if (isEnabled(CleanUpConstants.FORMAT_SOURCE_CODE)) result.add(MultiFixMessages.CodeFormatCleanUp_description); if (isEnabled(CleanUpConstants.FORMAT_REMOVE_TRAILING_WHITESPACES)) { if (isEnabled(CleanUpConstants.FORMAT_REMOVE_TRAILING_WHITESPACES_ALL)) { result.add(MultiFixMessages.CodeFormatCleanUp_RemoveTrailingAll_description); } else if (isEnabled(CleanUpConstants.FORMAT_REMOVE_TRAILING_WHITESPACES_IGNORE_EMPTY)) { result.add(MultiFixMessages.CodeFormatCleanUp_RemoveTrailingNoEmpty_description); } } if (isEnabled(CleanUpConstants.FORMAT_CORRECT_INDENTATION)) result.add(MultiFixMessages.CodeFormatCleanUp_correctIndentation_description); return result.toArray(new String[result.size()]); }
@Override protected AbstractCleanUp[] createPreviewCleanUps(Map<String, String> values) { return new AbstractCleanUp[] { new ImportsCleanUp(values), new CodeFormatCleanUp(values), new SortMembersCleanUp(values) }; }
@Override public String[] getStepDescriptions() { ArrayList<String> result= new ArrayList<>(); if (isEnabled(CleanUpConstants.FORMAT_SOURCE_CODE)) result.add(MultiFixMessages.CodeFormatCleanUp_description); if (isEnabled(CleanUpConstants.FORMAT_REMOVE_TRAILING_WHITESPACES)) { if (isEnabled(CleanUpConstants.FORMAT_REMOVE_TRAILING_WHITESPACES_ALL)) { result.add(MultiFixMessages.CodeFormatCleanUp_RemoveTrailingAll_description); } else if (isEnabled(CleanUpConstants.FORMAT_REMOVE_TRAILING_WHITESPACES_IGNORE_EMPTY)) { result.add(MultiFixMessages.CodeFormatCleanUp_RemoveTrailingNoEmpty_description); } } if (isEnabled(CleanUpConstants.FORMAT_CORRECT_INDENTATION)) result.add(MultiFixMessages.CodeFormatCleanUp_correctIndentation_description); return result.toArray(new String[result.size()]); }
protected ICleanUp[] createPreviewCleanUps(Map values) { return new ICleanUp[] { new ImportsCleanUp(values), new CommentFormatCleanUp(values), new CodeFormatCleanUp(values), new SortMembersCleanUp(values) }; }
/** * {@inheritDoc} */ public String[] getDescriptions() { ArrayList result= new ArrayList(); if (isEnabled(CleanUpConstants.FORMAT_SOURCE_CODE)) result.add(MultiFixMessages.CodeFormatCleanUp_description); if (isEnabled(CleanUpConstants.FORMAT_REMOVE_TRAILING_WHITESPACES)) { if (isEnabled(CleanUpConstants.FORMAT_REMOVE_TRAILING_WHITESPACES_ALL)) { result.add(MultiFixMessages.CodeFormatCleanUp_RemoveTrailingAll_description); } else if (isEnabled(CleanUpConstants.FORMAT_REMOVE_TRAILING_WHITESPACES_IGNORE_EMPTY)) { result.add(MultiFixMessages.CodeFormatCleanUp_RemoveTrailingNoEmpty_description); } } return (String[])result.toArray(new String[result.size()]); }
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()}; }
@Override public ICleanUpFix createFix(CleanUpContext context) throws CoreException { ICompilationUnit compilationUnit= context.getCompilationUnit(); if (compilationUnit == null) return null; IRegion[] regions; if (context instanceof MultiLineCleanUpContext) { regions= ((MultiLineCleanUpContext)context).getRegions(); } else { regions= null; } boolean removeWhitespaces= isEnabled(CleanUpConstants.FORMAT_REMOVE_TRAILING_WHITESPACES); return CodeFormatFix.createCleanUp(compilationUnit, regions, isEnabled(CleanUpConstants.FORMAT_SOURCE_CODE), removeWhitespaces && isEnabled(CleanUpConstants.FORMAT_REMOVE_TRAILING_WHITESPACES_ALL), removeWhitespaces && isEnabled(CleanUpConstants.FORMAT_REMOVE_TRAILING_WHITESPACES_IGNORE_EMPTY), isEnabled(CleanUpConstants.FORMAT_CORRECT_INDENTATION)); }
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)}; } }
@Override public ICleanUpFix createFix(CleanUpContext context) throws CoreException { ICompilationUnit compilationUnit= context.getCompilationUnit(); if (compilationUnit == null) return null; IRegion[] regions; if (context instanceof MultiLineCleanUpContext) { regions= ((MultiLineCleanUpContext)context).getRegions(); } else { regions= null; } boolean removeWhitespaces= isEnabled(CleanUpConstants.FORMAT_REMOVE_TRAILING_WHITESPACES); return CodeFormatFix.createCleanUp(compilationUnit, regions, isEnabled(CleanUpConstants.FORMAT_SOURCE_CODE), removeWhitespaces && isEnabled(CleanUpConstants.FORMAT_REMOVE_TRAILING_WHITESPACES_ALL), removeWhitespaces && isEnabled(CleanUpConstants.FORMAT_REMOVE_TRAILING_WHITESPACES_IGNORE_EMPTY), isEnabled(CleanUpConstants.FORMAT_CORRECT_INDENTATION)); }
public String getPreview() { StringBuffer buf= new StringBuffer(); buf.append("public class Engine {\n"); //$NON-NLS-1$ buf.append(" public void start() {}\n"); //$NON-NLS-1$ if (isEnabled(CleanUpConstants.FORMAT_REMOVE_TRAILING_WHITESPACES) && isEnabled(CleanUpConstants.FORMAT_REMOVE_TRAILING_WHITESPACES_ALL)) { buf.append("\n"); //$NON-NLS-1$ } else { buf.append(" \n"); //$NON-NLS-1$ } if (isEnabled(CleanUpConstants.FORMAT_REMOVE_TRAILING_WHITESPACES)) { buf.append(" public\n"); //$NON-NLS-1$ } else { buf.append(" public \n"); //$NON-NLS-1$ } buf.append(" void stop() {\n"); //$NON-NLS-1$ buf.append(" }\n"); //$NON-NLS-1$ buf.append("}\n"); //$NON-NLS-1$ return buf.toString(); }
@Override public String getPreview() { StringBuilder buf= new StringBuilder(); buf.append("/**\n"); //$NON-NLS-1$ buf.append(" *A Javadoc comment\n"); //$NON-NLS-1$ buf.append("* @since 2007\n"); //$NON-NLS-1$ buf.append(" */\n"); //$NON-NLS-1$ buf.append("public class Engine {\n"); //$NON-NLS-1$ buf.append(" public void start() {}\n"); //$NON-NLS-1$ if (isEnabled(CleanUpConstants.FORMAT_REMOVE_TRAILING_WHITESPACES) && isEnabled(CleanUpConstants.FORMAT_REMOVE_TRAILING_WHITESPACES_ALL)) { buf.append("\n"); //$NON-NLS-1$ } else { buf.append(" \n"); //$NON-NLS-1$ } if (isEnabled(CleanUpConstants.FORMAT_REMOVE_TRAILING_WHITESPACES)) { buf.append(" public\n"); //$NON-NLS-1$ } else { buf.append(" public \n"); //$NON-NLS-1$ } buf.append(" void stop() {\n"); //$NON-NLS-1$ buf.append(" }\n"); //$NON-NLS-1$ buf.append("}\n"); //$NON-NLS-1$ return buf.toString(); } }
@Override public String getPreview() { StringBuffer buf= new StringBuffer(); buf.append("/**\n"); //$NON-NLS-1$ buf.append(" *A Javadoc comment\n"); //$NON-NLS-1$ buf.append("* @since 2007\n"); //$NON-NLS-1$ buf.append(" */\n"); //$NON-NLS-1$ buf.append("public class Engine {\n"); //$NON-NLS-1$ buf.append(" public void start() {}\n"); //$NON-NLS-1$ if (isEnabled(CleanUpConstants.FORMAT_REMOVE_TRAILING_WHITESPACES) && isEnabled(CleanUpConstants.FORMAT_REMOVE_TRAILING_WHITESPACES_ALL)) { buf.append("\n"); //$NON-NLS-1$ } else { buf.append(" \n"); //$NON-NLS-1$ } if (isEnabled(CleanUpConstants.FORMAT_REMOVE_TRAILING_WHITESPACES)) { buf.append(" public\n"); //$NON-NLS-1$ } else { buf.append(" public \n"); //$NON-NLS-1$ } buf.append(" void stop() {\n"); //$NON-NLS-1$ buf.append(" }\n"); //$NON-NLS-1$ buf.append("}\n"); //$NON-NLS-1$ return buf.toString(); } }