Coverage Report - org.argouml.model.euml.CommandStackImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
CommandStackImpl
0%
0/13
0%
0/4
1.25
 
 1  
 // $Id: CommandStackImpl.java 18220 2010-04-08 20:37:15Z tfmorris $
 2  
 /*******************************************************************************
 3  
  * Copyright (c) 2007,2010 Bogdan Pistol and other contributors
 4  
  * All rights reserved. This program and the accompanying materials
 5  
  * are made available under the terms of the Eclipse Public License v1.0
 6  
  * which accompanies this distribution, and is available at
 7  
  * http://www.eclipse.org/legal/epl-v10.html
 8  
  *
 9  
  * Contributors:
 10  
  *    Bogdan Pistol - initial API and implementation
 11  
  *******************************************************************************/
 12  
 package org.argouml.model.euml;
 13  
 
 14  
 //import org.argouml.model.CommandStack;
 15  
 
 16  
 /**
 17  
  * CommandStack implementation to support Undo/Redo.
 18  
  * 
 19  
  */
 20  
 public class CommandStackImpl /*implements CommandStack*/ {
 21  
 
 22  
     private EUMLModelImplementation modelImplementation;
 23  
 
 24  0
     public CommandStackImpl(EUMLModelImplementation implementation) {
 25  0
         modelImplementation = implementation;
 26  0
         implementation.getEditingDomain().getCommandStack().flush();
 27  0
     }
 28  
 
 29  
     public boolean canRedo() {
 30  0
         return modelImplementation.getEditingDomain().getCommandStack()
 31  
                 .canRedo();
 32  
     }
 33  
 
 34  
     public boolean canUndo() {
 35  0
         return modelImplementation.getEditingDomain().getCommandStack()
 36  
                 .canUndo();
 37  
     }
 38  
 
 39  
     public String getRedoLabel() {
 40  0
         return canRedo() ? modelImplementation.getEditingDomain()
 41  
                         .getCommandStack().getRedoCommand().getLabel()
 42  
                 : null;
 43  
     }
 44  
 
 45  
     public String getUndoLabel() {
 46  0
         return canUndo() ? modelImplementation.getEditingDomain()
 47  
                         .getCommandStack().getUndoCommand().getLabel()
 48  
                 : null;
 49  
     }
 50  
 
 51  
     public boolean isCommandStackCapabilityAvailable() {
 52  0
         return true;
 53  
     }
 54  
 
 55  
     public void redo() {
 56  0
         modelImplementation.getEditingDomain().getCommandStack().redo();
 57  0
     }
 58  
 
 59  
     public void undo() {
 60  0
         modelImplementation.getEditingDomain().getCommandStack().undo();
 61  0
     }
 62  
 
 63  
 }