use of org.eclipse.titan.log.viewer.views.StatisticalView in project titan.EclipsePlug-ins by eclipse.
the class OpenStatisticalViewMenuAction method run.
public void run(final IStructuredSelection selection) {
this.logFileMetaData = null;
this.logFileIsSupported = true;
if (this.selection == null) {
return;
}
Set<IFile> logFiles = new HashSet<IFile>(selection.size());
for (Iterator<?> iterator = selection.iterator(); iterator.hasNext(); ) {
Object object = iterator.next();
if (object instanceof IFile) {
logFiles.add((IFile) object);
} else if (object instanceof TestCase) {
logFiles.add(((TestCase) object).getLogFile());
}
}
if (logFiles.isEmpty()) {
return;
}
List<StatisticalData> statisticalDataVector = createStatisticalData(logFiles);
if (statisticalDataVector == null || statisticalDataVector.isEmpty()) {
return;
}
String secondId = Constants.STATISTICAL_VIEW;
if (statisticalDataVector.size() < 2) {
secondId = File.separator + this.logFile.getProject().getName() + File.separator + this.logFile.getProjectRelativePath().toOSString();
}
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IViewReference reference = activePage.findViewReference(Constants.STATISTICAL_VIEW_ID, secondId);
// get the view
if (reference != null) {
StatisticalView part = (StatisticalView) reference.getView(false);
}
// create a new view
try {
StatisticalView part = (StatisticalView) activePage.showView(Constants.STATISTICAL_VIEW_ID, secondId, IWorkbenchPage.VIEW_ACTIVATE);
part.setData(statisticalDataVector);
part.setFocus();
} catch (PartInitException e) {
ErrorReporter.logExceptionStackTrace(e);
TitanLogExceptionHandler.handleException(new TechnicalException(Messages.getString("OpenStatisticalViewMenuAction.0") + e.getMessage()));
}
}
Aggregations