1 19 20 package org.netbeans.lib.cvsclient.command.checkout; 21 22 import java.util.*; 23 24 import org.netbeans.lib.cvsclient.command.*; 25 import org.netbeans.lib.cvsclient.event.*; 26 27 33 public class ModuleListBuilder implements Builder { 34 37 private ModuleListInformation moduleInformation; 38 39 42 private final EventManager eventManager; 43 44 private final CheckoutCommand checkoutCommand; 45 46 public ModuleListBuilder(EventManager eventMan, CheckoutCommand comm) { 47 eventManager = eventMan; 48 checkoutCommand = comm; 49 } 50 51 public void outputDone() { 52 if (moduleInformation != null) { 53 eventManager.fireCVSEvent(new FileInfoEvent(this, moduleInformation)); 54 moduleInformation = null; 55 } 56 } 57 58 public void parseLine(String line, boolean isErrorMessage) { 59 line = line.replace('\t', ' '); 60 if (!line.startsWith(" ")) { processModule(line, true); 62 } 63 else { 64 processModule(line, false); 65 } 66 } 67 68 protected void processModule(String line, boolean firstLine) { 69 StringTokenizer tok = new StringTokenizer(line, " ", false); if (firstLine) { 71 outputDone(); 72 moduleInformation = new ModuleListInformation(); 73 String modName = tok.nextToken(); 74 moduleInformation.setModuleName(modName); 75 if (checkoutCommand.isShowModulesWithStatus()) { 76 String stat = tok.nextToken(); 77 moduleInformation.setModuleStatus(stat); 78 } 79 } 80 while (tok.hasMoreTokens()) { 81 String nextTok = tok.nextToken(); 82 if (nextTok.startsWith("-")) { moduleInformation.setType(nextTok); 84 continue; 85 } 86 moduleInformation.addPath(nextTok); 87 } 88 } 89 90 public void parseEnhancedMessage(String key, Object value) { 91 } 92 } 93 | Popular Tags |