use of org.eclipse.titan.log.viewer.readers.SequentialLogFileReader in project titan.EclipsePlug-ins by eclipse.
the class LogSearchQuery method run.
@Override
public IStatus run(final IProgressMonitor monitor) {
result.removeAll();
int numOfRecords = 0;
for (IFile logFile : files) {
File indexFile = LogFileCacheHandler.getLogRecordIndexFileForLogFile(logFile);
numOfRecords += LogFileCacheHandler.getNumberOfLogRecordIndexes(indexFile);
}
monitor.beginTask("Searching", numOfRecords);
for (IFile logFile : files) {
if (monitor.isCanceled()) {
break;
}
if (LogFileCacheHandler.hasLogFileChanged(logFile) && !LogFileCacheHandler.processLogFile(logFile, new NullProgressMonitor(), true)) {
continue;
}
File indexFile = LogFileCacheHandler.getLogRecordIndexFileForLogFile(logFile);
try {
LogRecordIndex[] indexes = LogFileCacheHandler.readLogRecordIndexFile(indexFile, 0, LogFileCacheHandler.getNumberOfLogRecordIndexes(indexFile));
SequentialLogFileReader reader = new SequentialLogFileReader(logFile.getLocationURI(), indexes);
monitor.subTask("Filtering");
filterRecords(monitor, logFile, reader);
monitor.done();
} catch (ParseException e) {
ErrorReporter.logExceptionStackTrace(e);
TitanLogExceptionHandler.handleException(new TechnicalException(logFile.getName() + ": Could not parse the log file. Reason: " + e.getMessage()));
} catch (IOException e) {
ErrorReporter.logExceptionStackTrace(e);
TitanLogExceptionHandler.handleException(new TechnicalException(logFile.getName() + ": Error while searching. Reason: " + e.getMessage()));
}
}
monitor.done();
return new Status(IStatus.OK, Constants.PLUGIN_ID, IStatus.OK, "Search done.", null);
}
Aggregations