1 9 10 package org.enhydra.jawe.actions; 11 12 import org.enhydra.jawe.*; 13 14 import java.util.*; 15 import java.awt.event.ActionEvent ; 16 import javax.swing.Action ; 17 import javax.swing.undo.*; 18 19 22 public class Redo extends ActionBase { 23 public Redo (AbstractEditor editor) { 24 super(editor); 25 setEnabled(false); 26 } 27 28 public void actionPerformed(ActionEvent e) { 29 try { 30 Set s1=JaWEGraphModel.getAllCellsInModel(editor.getGraph().getModel()); 31 editor.getUndoManager().redo(editor.getGraph().getGraphLayoutCache()); 32 Set s2=JaWEGraphModel.getAllCellsInModel(editor.getGraph().getModel()); 33 editor.refreshCollections(s1,s2); 34 } catch (CannotRedoException ex) { 35 System.err.println("Unable to redo: " + ex); 36 ex.printStackTrace(); 37 } 38 update(); 39 editor.getUndo().update(); 40 editor.getGraph().repaint(); 41 } 43 44 public void update() { 45 if(editor.getUndoManager().canRedo(editor.getGraph().getGraphLayoutCache())) { 46 setEnabled(true); 47 putValue(Action.NAME, editor.getUndoManager().getRedoPresentationName()); 48 editor.getToolbarComponent("Redo").setToolTipText(editor.getUndoManager().getRedoPresentationName()); 49 } 50 else { 51 setEnabled(false); 52 putValue(Action.NAME,ResourceManager.getLanguageDependentString("RedoLabel")); 53 } 54 } 55 } 56 | Popular Tags |