@Override public String[] getStepDescriptions() { if (isEnabled(CleanUpConstants.SORT_MEMBERS)) { if (isEnabled(CleanUpConstants.SORT_MEMBERS_ALL)) { return new String[] {MultiFixMessages.SortMembersCleanUp_AllMembers_description}; } else { return new String[] {MultiFixMessages.SortMembersCleanUp_Excluding_description}; } } return null; }
@Override protected AbstractCleanUp[] createPreviewCleanUps(Map<String, String> values) { return new AbstractCleanUp[] { new ImportsCleanUp(values), new CodeFormatCleanUp(values), new SortMembersCleanUp(values) }; }
@Override public RefactoringStatus checkPostConditions(IProgressMonitor monitor) throws CoreException { if (fTouchedFiles == null) { return super.checkPostConditions(monitor); } else { if (monitor == null) monitor= new NullProgressMonitor(); monitor.beginTask("", fTouchedFiles.size()); //$NON-NLS-1$ try { RefactoringStatus result= new RefactoringStatus(); for (Iterator<IResource> iterator= fTouchedFiles.iterator(); iterator.hasNext();) { IFile file= (IFile)iterator.next(); if (containsRelevantMarkers(file)) { String fileLocation= BasicElementLabels.getPathLabel(file.getProjectRelativePath(), false); String projectName= file.getProject().getName(); result.addWarning(MessageFormat.format(MultiFixMessages.SortMembersCleanUp_RemoveMarkersWarning0, new Object[] {fileLocation, projectName})); } monitor.worked(1); } return result; } finally { monitor.done(); fTouchedFiles= null; } } }
@Override protected AbstractCleanUp[] createPreviewCleanUps(Map<String, String> values) { return new AbstractCleanUp[] { new ImportsCleanUp(values), new CodeFormatCleanUp(values), new SortMembersCleanUp(values) }; }
public RefactoringStatus checkPostConditions(IProgressMonitor monitor) throws CoreException { if (fTouchedFiles == null) { return super.checkPostConditions(monitor); } else { if (monitor == null) monitor= new NullProgressMonitor(); monitor.beginTask("", fTouchedFiles.size()); //$NON-NLS-1$ try { RefactoringStatus result= new RefactoringStatus(); for (Iterator iterator= fTouchedFiles.iterator(); iterator.hasNext();) { IFile file= (IFile)iterator.next(); if (containsRelevantMarkers(file)) { String fileLocation= file.getProjectRelativePath().toOSString(); String projectName= file.getProject().getName(); result.addWarning(MessageFormat.format(MultiFixMessages.SortMembersCleanUp_RemoveMarkersWarning0, new Object[] {fileLocation, projectName})); } monitor.worked(1); } return result; } finally { monitor.done(); fTouchedFiles= null; } } }
@Override public String[] getStepDescriptions() { if (isEnabled(CleanUpConstants.SORT_MEMBERS)) { if (isEnabled(CleanUpConstants.SORT_MEMBERS_ALL)) { return new String[] {MultiFixMessages.SortMembersCleanUp_AllMembers_description}; } else { return new String[] {MultiFixMessages.SortMembersCleanUp_Excluding_description}; } } return null; }
protected ICleanUp[] createPreviewCleanUps(Map values) { return new ICleanUp[] { new ImportsCleanUp(values), new CommentFormatCleanUp(values), new CodeFormatCleanUp(values), new SortMembersCleanUp(values) }; }
@Override public RefactoringStatus checkPostConditions(IProgressMonitor monitor) throws CoreException { if (fTouchedFiles == null) { return super.checkPostConditions(monitor); } else { if (monitor == null) monitor= new NullProgressMonitor(); monitor.beginTask("", fTouchedFiles.size()); //$NON-NLS-1$ try { RefactoringStatus result= new RefactoringStatus(); for (Iterator<IResource> iterator= fTouchedFiles.iterator(); iterator.hasNext();) { IFile file= (IFile)iterator.next(); if (containsRelevantMarkers(file)) { String fileLocation= BasicElementLabels.getPathLabel(file.getProjectRelativePath(), false); String projectName= file.getProject().getName(); result.addWarning(MessageFormat.format(MultiFixMessages.SortMembersCleanUp_RemoveMarkersWarning0, new Object[] {fileLocation, projectName})); } monitor.worked(1); } return result; } finally { monitor.done(); fTouchedFiles= null; } } }
/** * {@inheritDoc} */ public String[] getDescriptions() { if (isEnabled(CleanUpConstants.SORT_MEMBERS)) { if (isEnabled(CleanUpConstants.SORT_MEMBERS_ALL)) { return new String[] {MultiFixMessages.SortMembersCleanUp_AllMembers_description}; } else { return new String[] {MultiFixMessages.SortMembersCleanUp_Excluding_description}; } } return null; }
/** * {@inheritDoc} */ protected ICleanUp[] createCleanUps(ICompilationUnit[] units) { try { if (!hasMembersToSort(units)) return null; } catch (JavaModelException e) { JavaPlugin.log(e); return null; } SortMembersMessageDialog dialog= new SortMembersMessageDialog(getShell()); if (dialog.open() != Window.OK) return null; Hashtable settings= new Hashtable(); settings.put(CleanUpConstants.SORT_MEMBERS, CleanUpConstants.TRUE); settings.put(CleanUpConstants.SORT_MEMBERS_ALL, !dialog.isNotSortingFieldsEnabled() ? CleanUpConstants.TRUE : CleanUpConstants.FALSE); return new ICleanUp[] { new SortMembersCleanUp(settings) }; }
public boolean requireAST(ICompilationUnit unit) throws CoreException { return isEnabled(CleanUpConstants.SORT_MEMBERS); }
@Override protected ICleanUp[] getCleanUps(ICompilationUnit[] units) { try { if (!hasMembersToSort(units)) { MessageDialog.openInformation(getShell(), ActionMessages.MultiSortMembersAction_noElementsToSortDialog_title, ActionMessages.MultiSortMembersAction_noElementsToSortDialog_message); return null; } } catch (JavaModelException e) { JavaPlugin.log(e); return null; } Map<String, String> settings= getSettings(); if (settings == null) return null; return new ICleanUp[] { new SortMembersCleanUp(settings) }; }
public String getPreview() { StringBuffer buf= new StringBuffer(); buf.append("class SortExample {\n"); //$NON-NLS-1$ if ((isEnabled(CleanUpConstants.SORT_MEMBERS) && isEnabled(CleanUpConstants.SORT_MEMBERS_ALL))) { buf.append(" private String bar;\n"); //$NON-NLS-1$ buf.append(" private String foo;\n"); //$NON-NLS-1$ } else { buf.append(" private String foo;\n"); //$NON-NLS-1$ buf.append(" private String bar;\n"); //$NON-NLS-1$ } if (isEnabled(CleanUpConstants.SORT_MEMBERS)) { buf.append(" private void bar() {}\n"); //$NON-NLS-1$ buf.append(" private void foo() {}\n"); //$NON-NLS-1$ } else { buf.append(" private void foo() {}\n"); //$NON-NLS-1$ buf.append(" private void bar() {}\n"); //$NON-NLS-1$ } buf.append("}\n"); //$NON-NLS-1$ return buf.toString(); }
@Override protected ICleanUp[] getCleanUps(ICompilationUnit[] units) { try { if (!hasMembersToSort(units)) { MessageDialog.openInformation(getShell(), ActionMessages.MultiSortMembersAction_noElementsToSortDialog_title, ActionMessages.MultiSortMembersAction_noElementsToSortDialog_message); return null; } } catch (JavaModelException e) { JavaPlugin.log(e); return null; } Map<String, String> settings= getSettings(); if (settings == null) return null; return new ICleanUp[] { new SortMembersCleanUp(settings) }; }
@Override public CleanUpRequirements getRequirements() { return new CleanUpRequirements(isEnabled(CleanUpConstants.SORT_MEMBERS), false, false, null); }
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 CleanUpRequirements getRequirements() { return new CleanUpRequirements(isEnabled(CleanUpConstants.SORT_MEMBERS), false, false, null); }
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 String getPreview() { StringBuilder buf= new StringBuilder(); buf.append("class SortExample {\n"); //$NON-NLS-1$ if ((isEnabled(CleanUpConstants.SORT_MEMBERS) && isEnabled(CleanUpConstants.SORT_MEMBERS_ALL))) { buf.append(" private String bar;\n"); //$NON-NLS-1$ buf.append(" private String foo;\n"); //$NON-NLS-1$ } else { buf.append(" private String foo;\n"); //$NON-NLS-1$ buf.append(" private String bar;\n"); //$NON-NLS-1$ } if (isEnabled(CleanUpConstants.SORT_MEMBERS)) { buf.append(" private void bar() {}\n"); //$NON-NLS-1$ buf.append(" private void foo() {}\n"); //$NON-NLS-1$ } else { buf.append(" private void foo() {}\n"); //$NON-NLS-1$ buf.append(" private void bar() {}\n"); //$NON-NLS-1$ } buf.append("}\n"); //$NON-NLS-1$ return buf.toString(); }
@Override public String getPreview() { StringBuffer buf= new StringBuffer(); buf.append("class SortExample {\n"); //$NON-NLS-1$ if ((isEnabled(CleanUpConstants.SORT_MEMBERS) && isEnabled(CleanUpConstants.SORT_MEMBERS_ALL))) { buf.append(" private String bar;\n"); //$NON-NLS-1$ buf.append(" private String foo;\n"); //$NON-NLS-1$ } else { buf.append(" private String foo;\n"); //$NON-NLS-1$ buf.append(" private String bar;\n"); //$NON-NLS-1$ } if (isEnabled(CleanUpConstants.SORT_MEMBERS)) { buf.append(" private void bar() {}\n"); //$NON-NLS-1$ buf.append(" private void foo() {}\n"); //$NON-NLS-1$ } else { buf.append(" private void foo() {}\n"); //$NON-NLS-1$ buf.append(" private void bar() {}\n"); //$NON-NLS-1$ } buf.append("}\n"); //$NON-NLS-1$ return buf.toString(); }