1 9 10 package org.netbeans.modules.xml.refactoring; 11 12 import java.io.IOException ; 13 import org.netbeans.modules.refactoring.spi.Transaction; 14 import org.netbeans.modules.xml.refactoring.impl.UndoRedoProgress; 15 import org.openide.DialogDisplayer; 16 import org.openide.NotifyDescriptor; 17 18 22 public class XMLRefactoringCommit implements Transaction { 23 24 RefactorRequest request; 25 26 public XMLRefactoringCommit(RefactorRequest req) { 27 request = req; 28 } 29 30 public void commit() { 31 try { 32 33 RefactoringManager.getInstance().process(request); 34 } catch (IOException ioe) { 35 String msg = ioe.getMessage(); 36 NotifyDescriptor nd = new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE); 37 DialogDisplayer.getDefault().notify(nd); 38 } 39 40 } 41 42 public void rollback() { 43 UndoRedoProgress progress = new UndoRedoProgress(); 44 progress.start(); 45 try { 46 RefactoringManager.getInstance().undo(); 47 } finally { 48 progress.stop(); 49 } 50 } 51 52 } 53 | Popular Tags |