use of org.eclipse.titan.log.viewer.utils.LogFileHandler in project titan.EclipsePlug-ins by eclipse.
the class OpenStatisticalViewMenuAction method processLogFile.
private void processLogFile() {
try {
new ProgressMonitorDialog(null).run(false, false, new IRunnableWithProgress() {
@Override
public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
OpenStatisticalViewMenuAction.this.monitor = monitor;
OpenStatisticalViewMenuAction.this.testCaseExtractor = null;
try {
LogFileHandler logFileHandler = new LogFileHandler(logFile);
// First of all, verify that the file is a TITAN supported log file
try {
OpenStatisticalViewMenuAction.this.logFileMetaData = logFileHandler.autoDetect();
} catch (final TechnicalException e) {
ErrorReporter.logExceptionStackTrace(e);
OpenStatisticalViewMenuAction.this.logFileIsSupported = false;
TitanLogExceptionHandler.handleException(new UserException(e.getMessage()));
return;
}
OpenStatisticalViewMenuAction.this.testCaseExtractor = new TestCaseExtractor();
OpenStatisticalViewMenuAction.this.testCaseExtractor.addObserver(OpenStatisticalViewMenuAction.this);
if (OpenStatisticalViewMenuAction.this.monitor != null) {
OpenStatisticalViewMenuAction.this.monitor.beginTask(Messages.getString("OpenStatisticalViewMenuAction.4") + OpenStatisticalViewMenuAction.this.logFile.getName() + Messages.getString("OpenStatisticalViewMenuAction.3"), 100);
}
// Extract test cases from log file
OpenStatisticalViewMenuAction.this.testCaseExtractor.extractTestCasesFromLogFile(OpenStatisticalViewMenuAction.this.logFileMetaData, monitor);
LogFileCacheHandler.fillCache(logFile, logFileMetaData, testCaseExtractor.getTestCases(), testCaseExtractor.getLogRecordIndexes());
if (OpenStatisticalViewMenuAction.this.testCaseExtractor.failedDuringExtraction()) {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
MessageDialog.openInformation(null, Messages.getString("OpenStatisticalViewMenuAction.2"), Messages.getString("OpenStatisticalViewMenuAction.1"));
}
});
}
} catch (IOException e) {
ErrorReporter.logExceptionStackTrace(e);
TitanLogExceptionHandler.handleException(new TechnicalException(Messages.getString("OpenStatisticalViewMenuAction.0") + e.getMessage()));
} finally {
if (OpenStatisticalViewMenuAction.this.testCaseExtractor != null) {
OpenStatisticalViewMenuAction.this.testCaseExtractor.deleteObserver(OpenStatisticalViewMenuAction.this);
}
if (OpenStatisticalViewMenuAction.this.monitor != null) {
OpenStatisticalViewMenuAction.this.monitor.done();
}
}
}
});
} catch (InvocationTargetException e) {
ErrorReporter.logExceptionStackTrace(e);
TitanLogExceptionHandler.handleException(new TechnicalException(Messages.getString("OpenStatisticalViewMenuAction.0") + e.getTargetException()));
} catch (InterruptedException e) {
ErrorReporter.logExceptionStackTrace(e);
TitanLogExceptionHandler.handleException(new TechnicalException(Messages.getString("OpenStatisticalViewMenuAction.0") + e.getMessage()));
}
}
Aggregations