+ Added RefactoringCommit and ModificationResult SPI classes. +
+@@ -89,6 +90,7 @@ ** * You can register your own implementation via META-INF services. + * * @see Transaction * @see RefactoringElementImplementation#performChange * @see RefactoringElementImplementation#undoChange @@ -97,15 +99,17 @@ * @see BackupFacility.Handle * @author Jan Becicka */ -public abstract class BackupFacility { +abstract class BackupFacility2 { - private BackupFacility() { + private static final Logger LOG = Logger.getLogger("org.netbeans.modules.refactoring.Undo"); + + private BackupFacility2() { } + private static BackupFacility2 defaultInstance; - private static BackupFacility defaultInstance; - /** - * does beckup + * does backup + * * @param file file(s) to backup * @return handle which can be used to restore files * @throws java.io.IOException if backup failed @@ -114,6 +118,7 @@ /** * does backup + * * @param fileObjects FileObjects to backup * @return handle which can be used to restore files * @throws java.io.IOException @@ -123,10 +128,8 @@ } /** - * do cleanup - * all backup files are deleted - * all internal structures cleared - * default implementa + * do cleanup all backup files are deleted all internal structures cleared + * default implemntation */ public abstract void clear(); @@ -135,12 +138,12 @@ * class in META-INF services -> this class is returned. Otherwise default * implementation is used. */ - public static BackupFacility getDefault() { - BackupFacility instance = Lookup.getDefault().lookup(BackupFacility.class); + public static BackupFacility2 getDefault() { + BackupFacility2 instance = Lookup.getDefault().lookup(BackupFacility2.class); return (instance != null) ? instance : getDefaultInstance(); } - private static synchronized BackupFacility getDefaultInstance() { + private static synchronized BackupFacility2 getDefaultInstance() { if (defaultInstance == null) { defaultInstance = new DefaultImpl(); } @@ -149,57 +152,188 @@ } /** - * Handle class representing handle to file(s), which were backuped - * by - * {@link org.netbeans.modules.refactoring.spi.BackupFacility#backup()} + * Handle class representing handle to file(s), which were backuped by {@link org.netbeans.modules.refactoring.spi.BackupFacility#backup()} */ public interface Handle { + /** - * restore file(s), which was stored by {@link org.netbeans.modules.refactoring.spi.BackupFacility#backup()} + * restore file(s), which was stored by {@link org.netbeans.modules.refactoring.spi.BackupFacility#backup()} + * * @throws java.io.IOException if restore failed. */ - void restore() throws IOException; + public abstract void restore() throws java.io.IOException; + + void storeChecksum() throws IOException; + + public Collection