1 19 27 28 package org.netbeans.modules.xml.refactoring.actions; 29 30 import java.text.MessageFormat ; 31 import org.netbeans.modules.xml.refactoring.RefactoringManager; 32 import org.netbeans.modules.xml.refactoring.impl.UndoRedoProgress; 33 import org.openide.nodes.Node; 34 import org.openide.util.HelpCtx; 35 import org.openide.util.NbBundle; 36 import org.openide.util.RequestProcessor; 37 import org.openide.util.actions.CallableSystemAction; 38 39 43 public class RefactoringUndoAction extends CallableSystemAction { 44 45 private static final long serialVersionUID = 1L; 46 47 54 public void performAction() { 55 UndoRedoProgress progress = new UndoRedoProgress(); 56 progress.start(); 57 try { 58 RefactoringManager.getInstance().undo(); 59 } finally { 60 progress.stop(); 61 } 62 } 63 64 72 public boolean isEnabled() { 73 return RefactoringManager.getInstance().canUndo(); 74 } 75 76 85 public String getName() { 86 String undoType = ""; if (RefactoringManager.getInstance().canUndo()) { 88 undoType = 89 RefactoringManager.getInstance().getLastRefactorRequest().getDescription(); 90 91 return MessageFormat.format(NbBundle.getMessage(RefactoringUndoAction.class, 92 "LBL_Undo"), 93 new Object []{undoType}); 94 } 95 return NbBundle.getMessage(RefactoringUndoAction.class, 96 "LBL_Undo_Disabled"); 97 } 98 99 104 public HelpCtx getHelpCtx() { 105 return HelpCtx.DEFAULT_HELP; 106 } 107 108 127 protected boolean asynchronous() { 128 return true; 129 } 130 } 131 | Popular Tags |