Opens an xml or data file specified by name. @param fileName the file name
(File file)
| 53 | * @param fileName the file name |
| 54 | */ |
| 55 | public void open(File file) { |
| 56 | dataList = null; |
| 57 | data = null; |
| 58 | OSPLog.fine("opening "+file); //$NON-NLS-1$ |
| 59 | Resource res = new Resource(file); |
| 60 | Reader in = res.openReader(); |
| 61 | String firstLine = readFirstLine(in); |
| 62 | // if xml, read the file into an XML control and add tab |
| 63 | if(firstLine.startsWith("<?xml")) { //$NON-NLS-1$ |
| 64 | XMLControlElement control = new XMLControlElement(file); |
| 65 | dataList = control.getObjects(Data.class); |
| 66 | } |
| 67 | // if not xml, attempt to import data and add tab |
| 68 | else if(res.getString()!=null) { |
| 69 | data = parseData(res.getString(), file.toString()); |
| 70 | if(data!=null) { |
| 71 | } |
| 72 | } |
| 73 | OSPLog.finest("no data found"); //$NON-NLS-1$ |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Parses character-delimited data from a string. This attempts to extract |
no test coverage detected