1 11 package org.eclipse.help.internal; 12 13 import java.util.*; 14 15 import org.eclipse.core.runtime.*; 16 17 21 22 public class RuntimeHelpStatus { 23 private static RuntimeHelpStatus inst = null; 24 25 private ArrayList errorList = new ArrayList(); 27 28 private ArrayList badFilesList = new ArrayList(); 30 31 private ArrayList parserErrorMessagesList = new ArrayList(); 33 34 37 public RuntimeHelpStatus() { 38 super(); 39 } 40 public synchronized void addParseError(String message, 41 String invalidFileName) { 42 if (!badFilesList.contains(invalidFileName)) 46 badFilesList.add(invalidFileName); 47 48 parserErrorMessagesList.add(message); 50 51 } 52 public boolean errorsExist() { 53 if (errorList.isEmpty() && parserErrorMessagesList.isEmpty() 54 && badFilesList.isEmpty()) 55 return false; 56 else 57 return true; 58 } 59 public static synchronized RuntimeHelpStatus getInstance() { 60 if (inst == null) inst = new RuntimeHelpStatus(); 62 return inst; 63 } 64 67 public void reset() { 68 errorList.clear(); 69 badFilesList.clear(); 70 parserErrorMessagesList.clear(); 71 } 72 public synchronized String toString() { 73 StringBuffer fullText = new StringBuffer (); 74 if (!errorList.isEmpty()) { 75 fullText.append(HelpResources.getString("E006")); fullText.append("******************** \n"); for (int i = 0; i < errorList.size(); i++) { 78 fullText.append(((Status) (errorList.get(i))).getMessage()); 79 fullText.append("\n"); } 81 } 82 83 if (fullText.length() > 0) 84 fullText.append("\n"); 86 if (!parserErrorMessagesList.isEmpty()) { 87 fullText.append(HelpResources.getString("E007")); fullText.append("******************** \n"); for (int i = 0; i < badFilesList.size(); i++) { 91 fullText.append(((String ) (badFilesList.get(i)))); 92 fullText.append("\n"); } 94 95 fullText.append("\n"); 97 fullText.append(HelpResources.getString("E008")); fullText.append("******************** \n"); for (int i = 0; i < parserErrorMessagesList.size(); i++) { 101 fullText.append(((String ) (parserErrorMessagesList.get(i)))); 102 fullText.append("\n"); } 104 } 105 106 if (fullText.length() > 0) 107 return fullText.toString(); 108 else 109 return ""; 111 } 112 } 113 | Popular Tags |