use of org.eclipse.titan.log.viewer.actions.OpenMSCViewAction in project titan.EclipsePlug-ins by eclipse.
the class StatisticalView method createStatisticalViewContextMenuActions.
private void createStatisticalViewContextMenuActions() {
this.openMSCViewAction = new OpenMSCViewAction();
this.openMSCViewAction.setEnabled(false);
this.openMSCViewAction.setImageDescriptor(Activator.getDefault().getCachedImageDescriptor(Constants.ICONS_MSC_VIEW));
this.addSelectionChangedListener(openMSCViewAction);
this.openTextTableStatisticalViewMenuAction = new OpenTextTableStatisticalViewMenuAction(this);
this.openTextTableStatisticalViewMenuAction.setEnabled(false);
this.openTextTableStatisticalViewMenuAction.setImageDescriptor(Activator.getDefault().getCachedImageDescriptor(Constants.ICONS_TEXT_TABLE_VIEW));
}
use of org.eclipse.titan.log.viewer.actions.OpenMSCViewAction in project titan.EclipsePlug-ins by eclipse.
the class SwitchToMscAction method run.
@Override
public void run() {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceRoot root = workspace.getRoot();
LogFileMetaData logFileMetaData = textTableView.getLogFileMetaData();
IProject project = root.getProject(logFileMetaData.getProjectName());
IFile logFile = project.getFile(logFileMetaData.getProjectRelativePath().substring(logFileMetaData.getProjectName().length() + 1));
if (LogFileCacheHandler.hasLogFileChanged(logFile)) {
LogFileCacheHandler.handleLogFileChange(logFile);
return;
}
final IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
TestCaseExtractor extractor = new TestCaseExtractor();
try {
extractor.extractTestCasesFromIndexedLogFile(logFile);
} catch (IOException e) {
ErrorReporter.logExceptionStackTrace(e);
MessageBox mb = new MessageBox(activePage.getActivePart().getSite().getShell(), SWT.ICON_ERROR | SWT.OK);
mb.setText("Test case extraction failed.");
mb.setMessage("Error while extracting the test cases.");
return;
} catch (ClassNotFoundException e) {
ErrorReporter.logExceptionStackTrace(e);
MessageBox mb = new MessageBox(activePage.getActivePart().getSite().getShell(), SWT.ICON_ERROR | SWT.OK);
mb.setText("Test case extraction failed.");
mb.setMessage("Error while extracting the test cases.");
return;
}
List<TestCase> testCases = extractor.getTestCases();
if (textTableView.getSelectedRecord() == null) {
MessageBox mb = new MessageBox(activePage.getActivePart().getSite().getShell(), SWT.ICON_ERROR | SWT.OK);
mb.setText("Invalid selection.");
mb.setMessage("Please select a record to open the MSC view.");
return;
}
int recordNumber = textTableView.getSelectedRecord().getRecordNumber();
int testCaseNumber = findContainingTestCase(testCases, recordNumber);
if (testCaseNumber == -1) {
MessageBox mb = new MessageBox(activePage.getActivePart().getSite().getShell(), SWT.ICON_ERROR | SWT.OK);
mb.setText("Testcase can not be found.");
mb.setMessage("The testcase containing the selected log record can not be found.");
return;
}
final OpenMSCViewAction openMSCAction = new OpenMSCViewAction();
openMSCAction.selectionChanged(null, new StructuredSelection(testCases.get(testCaseNumber)));
openMSCAction.setFirstRow(recordNumber);
openMSCAction.run();
}
Aggregations