Coverage Report - org.jtheque.primary.controller.impl.undo.DeletedTypeEdit
 
Classes in this File Line Coverage Branch Coverage Complexity
DeletedTypeEdit
0 %
0/11
N/A
1
 
 1  
 package org.jtheque.primary.controller.impl.undo;
 2  
 
 3  
 /*
 4  
  * This file is part of JTheque.
 5  
  *
 6  
  * JTheque is free software: you can redistribute it and/or modify
 7  
  * it under the terms of the GNU General Public License as published by
 8  
  * the Free Software Foundation, either version 3 of the License.
 9  
  *
 10  
  * JTheque is distributed in the hope that it will be useful,
 11  
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 12  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 13  
  * GNU General Public License for more details.
 14  
  *
 15  
  * You should have received a copy of the GNU General Public License
 16  
  * along with JTheque.  If not, see <http://www.gnu.org/licenses/>.
 17  
  */
 18  
 
 19  
 import org.jtheque.core.managers.Managers;
 20  
 import org.jtheque.core.managers.beans.IBeansManager;
 21  
 import org.jtheque.core.managers.language.ILanguageManager;
 22  
 import org.jtheque.primary.od.able.Type;
 23  
 import org.jtheque.primary.services.able.ITypesService;
 24  
 
 25  
 import javax.annotation.Resource;
 26  
 import javax.swing.undo.AbstractUndoableEdit;
 27  
 
 28  
 /**
 29  
  * An edit corresponding to a delete of an editor.
 30  
  *
 31  
  * @author Baptiste Wicht
 32  
  */
 33  
 public final class DeletedTypeEdit extends AbstractUndoableEdit {
 34  
     private static final long serialVersionUID = -3037357344759861059L;
 35  
 
 36  
     private final Type type;
 37  
 
 38  
     @Resource
 39  
     private ITypesService typesService;
 40  
 
 41  
     /**
 42  
      * Construct a new DeletedKindEdit.
 43  
      *
 44  
      * @param type The deleted kind.
 45  
      */
 46  
     public DeletedTypeEdit(Type type) {
 47  0
         super();
 48  
 
 49  0
         Managers.getManager(IBeansManager.class).inject(this);
 50  
 
 51  0
         this.type = type;
 52  0
     }
 53  
 
 54  
     @Override
 55  
     public void undo() {
 56  0
         super.undo();
 57  
 
 58  0
         typesService.create(type);
 59  0
     }
 60  
 
 61  
     @Override
 62  
     public void redo() {
 63  0
         super.redo();
 64  
 
 65  0
         typesService.delete(type);
 66  0
     }
 67  
 
 68  
     @Override
 69  
     public String getPresentationName() {
 70  0
         return Managers.getManager(ILanguageManager.class).getMessage("undo.edits.delete");
 71  
     }
 72  
 }