Argus Codewatch Code and the Clean Up Wizard

The "Clean Up..." wizard

Since 3.2, Eclipse can automatically apply quick fixes with the help of a new wizard. This wizard can be reached through Source > Clean Up.... Eclipse has already defined some tabs. Every tab contains some quick fixes, which can be enabled or disabled. Argus Codewatch should also support this wizard by defining 3 new tabs for the categories defined in plugin.xml. Currently, Eclipse does not support extension of this wizard as there are no extension points available yet. To change this, substantial changes in Eclipse are necessary. Eclipse does not have, at this point in time, August / September, the manpower to do this.

Note: look at the comments of bug 153775 in the Eclipse bug tracker for more information.

Eclipse Clean Up internals

In org.eclipse.jdt.ui > plugin.xml some entries related to the clean up wizard were found.

Of course these 2 entries were to be found, otherwise the wizard wouldn't be accessible via the Source menu. However, no extension point is defined.

CleanUpRefactoring.java in org.eclipse.jdt.ui > core extension > org.eclipse.jdt.internal.corext.fix provide methods to manage the ICleanUp interface, which can be found in org.eclipse.jdt.ui > ui > org.eclipse.jdt.internal.ui.fix. This interface provides a way to manage a clean up. It can also return an IFix which is used to manage a quick fix. org.eclipse.jdt.internal.ui.fix is also the location of several *CleanUp.java files, which represent the tabs in the clean up wizard. They extend AbstractCleanUp.

One more important class is CleanUpRefactoringWizard. This class has an inner private class called SelectCUPage. This class has a method called createAllCleanUps(). If you look at the implementation of this method, you see it manually adds *CleanUp instances to an array. You will probably realize by now, that the Clean Up wizard is pretty hard-coded in its initial implementation.