Coverage Report - net.sf.jabref.journals.AbbreviateAction
 
Classes in this File Line Coverage Branch Coverage Complexity
AbbreviateAction
75%
18/24
62%
5/8
2.25
 
 1  
 package net.sf.jabref.journals;
 2  
 
 3  
 import net.sf.jabref.BibtexEntry;
 4  
 import net.sf.jabref.Globals;
 5  
 import net.sf.jabref.BasePanel;
 6  
 import net.sf.jabref.AbstractWorker;
 7  
 import net.sf.jabref.undo.NamedCompound;
 8  
 
 9  
 /**
 10  
  * Created by IntelliJ IDEA.
 11  
  * User: alver
 12  
  * Date: Sep 17, 2005
 13  
  * Time: 12:48:23 AM
 14  
  * To browseOld this template use File | Settings | File Templates.
 15  
  */
 16  
 public class AbbreviateAction extends AbstractWorker {
 17  
     BasePanel panel;
 18  88986687792
     String message = "";
 19  
     boolean iso;
 20  
 
 21  88986687792
     public AbbreviateAction(BasePanel panel, boolean iso) {
 22  88986687792
         this.panel = panel;
 23  88986687792
         this.iso = iso;
 24  88986687792
     }
 25  
 
 26  
 
 27  
     public void init() {
 28  
         //  new FieldWeightDialog(frame).setVisible(true);
 29  176484006
         panel.output("Abbreviating...");
 30  176484006
     }
 31  
 
 32  
     public void run() {
 33  
         //net.sf.jabref.journals.JournalList.downloadJournalList(frame);
 34  
 
 35  
 
 36  176484006
         BibtexEntry[] entries = panel.getSelectedEntries();
 37  176484006
         if (entries == null)
 38  0
             return;
 39  176484006
         NamedCompound ce = new NamedCompound("Abbreviate journal names");
 40  176484006
         int count = 0;
 41  176542961
         for (int i = 0; i < entries.length; i++) {
 42  58955
             if (Globals.journalAbbrev.abbreviate(panel.database(), entries[i], "journal", ce, iso))
 43  0
                 count++;
 44  
         }
 45  176484006
         if (count > 0) {
 46  0
             ce.end();
 47  0
             panel.undoManager.addEdit(ce);
 48  0
             panel.markBaseChanged();
 49  0
             message = Globals.lang("Abbreviated %0 journal names.", String.valueOf(count));
 50  
         } else {
 51  176484006
             message = Globals.lang("No journal names could be abbreviated.");
 52  
         }
 53  176484006
     }
 54  
 
 55  
     public void update() {
 56  176484006
         panel.output(message);
 57  176484006
     }
 58  
 }