use of org.eclipse.titan.log.viewer.views.msc.model.ExecutionModel in project titan.EclipsePlug-ins by eclipse.
the class JumpToNextSetverdictAction method run.
@Override
public void run() {
if (this.widget == null) {
return;
}
ExecutionModel model = this.view.getModel();
if (model == null) {
return;
}
int[] setverdictPlaces = model.getSetverdict();
int selectedLine = (Integer) this.selection.getFirstElement();
selectSetVerdict(setverdictPlaces, selectedLine);
}
use of org.eclipse.titan.log.viewer.views.msc.model.ExecutionModel in project titan.EclipsePlug-ins by eclipse.
the class JumpToNextSetverdictAction method selectionChanged.
@Override
public void selectionChanged(final IStructuredSelection selection) {
this.selection = selection;
int selectedLine = (Integer) this.selection.getFirstElement();
boolean enable = false;
ExecutionModel model = this.view.getModel();
if (model == null) {
setEnabled(false);
return;
}
for (int j = 0; j < model.getSetverdict().length; j++) {
if (model.getSetverdict()[j] > selectedLine) {
enable = true;
break;
}
}
setEnabled(enable);
}
use of org.eclipse.titan.log.viewer.views.msc.model.ExecutionModel in project titan.EclipsePlug-ins by eclipse.
the class JumpToPreviousSetverdictAction method selectionChanged.
@Override
public void selectionChanged(final IStructuredSelection selection) {
this.selection = selection;
int selectedLine = (Integer) this.selection.getFirstElement();
boolean enable = false;
ExecutionModel model = this.view.getModel();
if (model == null) {
setEnabled(false);
return;
}
for (int j = 0; j < model.getSetverdict().length; j++) {
if (model.getSetverdict()[j] < selectedLine) {
enable = true;
break;
}
}
setEnabled(enable);
}
use of org.eclipse.titan.log.viewer.views.msc.model.ExecutionModel in project titan.EclipsePlug-ins by eclipse.
the class OpenValueViewAction method run.
@Override
public void run() {
if (selectedLine == null || this.mscView == null || selectedLine < 2 || selectedLine >= this.mscView.getModel().getNumberOfEvents() + 2) {
return;
}
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
if (activePage == null) {
return;
}
LogFileMetaData logFileMetaData = this.mscView.getLogFileMetaData();
IProject project = getProjectByName(logFileMetaData);
IFile logFile = getLogFileFromProject(logFileMetaData, project);
if (!logFile.exists()) {
IViewReference[] viewReferences = activePage.getViewReferences();
ActionUtils.closeAssociatedViews(activePage, viewReferences, logFile);
// $NON-NLS-1$
TitanLogExceptionHandler.handleException(new UserException(Messages.getString("OpenValueViewAction.1")));
return;
}
if (LogFileCacheHandler.hasLogFileChanged(logFile)) {
LogFileCacheHandler.handleLogFileChange(logFile);
return;
}
DetailsView detailsview = (DetailsView) activePage.findView(Constants.DETAILS_VIEW_ID);
if (detailsview == null && !forceEditorOpening) {
return;
}
if (forceEditorOpening) {
try {
detailsview = (DetailsView) activePage.showView(Constants.DETAILS_VIEW_ID);
} catch (PartInitException e) {
ErrorReporter.logExceptionStackTrace(e);
// $NON-NLS-1$
TitanLogExceptionHandler.handleException(new TechnicalException(Messages.getString("OpenValueViewAction.4") + e.getMessage()));
return;
}
}
// pass log file meta data
detailsview.setLogFileMetaData(this.mscView.getLogFileMetaData());
ExecutionModel model = this.mscView.getModel();
IEventObject ieventObject = model.getEvent(selectedLine - 2);
if (!(ieventObject instanceof EventObject)) {
return;
}
EventObject eventObject = (EventObject) ieventObject;
String testCase = model.getTestCase().getTestCaseName();
if ((testCase == null) || eventObject.getRecordNumber() == 0) {
return;
}
// get value
LogRecord logrecord;
try {
logrecord = ValueReader.getInstance().readLogRecordFromLogFileCached(this.mscView.getLogFileMetaData().getFilePath(), eventObject);
} catch (Exception e) {
ErrorReporter.logExceptionStackTrace(e);
// $NON-NLS-1$
TitanLogExceptionHandler.handleException(new TechnicalException(Messages.getString("OpenValueViewAction.3")));
return;
}
String message = logrecord.getMessage();
DetailData detailData = new DetailData(eventObject.getName(), eventObject.getPort(), message, testCase, eventObject.getEventType(), logrecord.getSourceInformation());
detailsview.setData(detailData, false);
}
use of org.eclipse.titan.log.viewer.views.msc.model.ExecutionModel in project titan.EclipsePlug-ins by eclipse.
the class RefreshMSCViewAction method run.
@Override
public void run() {
// Set current log file meta data
final LogFileMetaData logFileMetaData = this.mscView.getLogFileMetaData();
ExecutionModel model = this.mscView.getModel();
final PreferencesHolder preferences = PreferencesHandler.getInstance().getPreferences(logFileMetaData.getProjectName());
if (preferences.getVisualOrderComponents().isEmpty()) {
// $NON-NLS-1$
String userE = Messages.getString("RefreshMSCViewAction.3");
TitanLogExceptionHandler.handleException(new UserException(userE));
return;
}
final IFile logFile = getSelectedLogFile(logFileMetaData);
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
// Check if the log file exists
if (!logFile.exists()) {
IViewReference[] viewReferences = activePage.getViewReferences();
ActionUtils.closeAssociatedViews(activePage, viewReferences, logFile);
// $NON-NLS-1$
TitanLogExceptionHandler.handleException(new UserException(Messages.getString("RefreshMSCViewAction.1")));
return;
}
// Check if the log file has been modified
if (LogFileCacheHandler.hasLogFileChanged(logFile)) {
LogFileCacheHandler.handleLogFileChange(logFile);
return;
}
// Get log record index file for selected log file - No need to check is exists due to
// LogFileCacheHandler.hasLogFileChanged(logFile) returning false above
File logRecordIndexFile = LogFileCacheHandler.getLogRecordIndexFileForLogFile(logFile);
try {
// Read/parse log file
final TestCase tc = model.getTestCase();
final LogRecordIndex[] logRecordIndexes = LogFileCacheHandler.readLogRecordIndexFile(logRecordIndexFile, tc.getStartRecordNumber(), tc.getNumberOfRecords());
WorkspaceJob job = new WorkspaceJob("Loading log information") {
@Override
public IStatus runInWorkspace(final IProgressMonitor monitor) throws CoreException {
ExecutionModel model;
try {
model = parseLogFile();
} catch (Exception e) {
ErrorReporter.logExceptionStackTrace(e);
TitanLogExceptionHandler.handleException(new TechnicalException(// $NON-NLS-1$
Messages.getString("RefreshMSCViewAction.5") + e.getMessage()));
return Status.CANCEL_STATUS;
}
final int firstRow = getFirstRow(model, preferences);
final ExecutionModel finalModel = model;
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
RefreshMSCViewAction.this.mscView.setModel(finalModel, firstRow);
}
});
return Status.OK_STATUS;
}
private ExecutionModel parseLogFile() throws TechnicalException {
ExecutionModel model;
if (logFileMetaData.getExecutionMode() == null) {
throw new TechnicalException("Error while parsing of the log file: ExecutionMode is null");
}
try {
// re-parse tc
Parser parser = new Parser(logFileMetaData);
model = parser.preParse(tc, logRecordIndexes, preferences, mscView.getFilterPattern(), null);
} catch (IOException e) {
throw new TechnicalException("Error while parsing of the log file");
} catch (ParseException e) {
throw new TechnicalException("Error while parsing of the log file");
}
return model;
}
};
job.schedule();
} catch (IOException e) {
ErrorReporter.logExceptionStackTrace("Error while parsing of the log file", e);
TitanLogExceptionHandler.handleException(new TechnicalException(e.getMessage()));
}
}
Aggregations