KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > refactoring > XMLRefactoringCommit


1 /*
2  * XMLRefactoringCommit.java
3  *
4  * Created on February 1, 2007, 2:32 PM
5  *
6  * To change this template, choose Tools | Template Manager
7  * and open the template in the editor.
8  */

9
10 package org.netbeans.modules.xml.refactoring;
11
12 import java.io.IOException JavaDoc;
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 /**
19  *
20  * @author Sonali
21  */

22 public class XMLRefactoringCommit implements Transaction {
23     
24     RefactorRequest request;
25     /** Creates a new instance of XMLRefactoringCommit */
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 JavaDoc ioe) {
35             String JavaDoc 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