use of org.eclipse.titan.log.viewer.views.DetailsView in project titan.EclipsePlug-ins by eclipse.
the class ActionUtils method closeView.
private static void closeView(IFile file, IWorkbenchPage activePage, IViewReference reference) {
IViewPart view = reference.getView(false);
// a restored view with faulty content
if (view == null) {
activePage.hideView(reference);
return;
}
if (!(view instanceof ILogViewerView)) {
return;
}
final ILogViewerView logViewerView = (ILogViewerView) view;
final LogFileMetaData metadata = logViewerView.getLogFileMetaData();
if (metadata == null) {
activePage.hideView(reference);
return;
}
if (file.getLocationURI().equals(metadata.getFilePath())) {
if (logViewerView instanceof DetailsView) {
((DetailsView) logViewerView).setData(null, false);
}
activePage.hideView(reference);
}
}
use of org.eclipse.titan.log.viewer.views.DetailsView 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.DetailsView in project titan.EclipsePlug-ins by eclipse.
the class CloseAllAction method run.
@Override
public void run() {
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IViewReference[] viewReferences = activePage.getViewReferences();
for (IViewReference reference : viewReferences) {
IViewPart view = reference.getView(false);
// memento restored views that never have had focus are null!!!
if (view == null) {
activePage.hideView(reference);
} else if (view instanceof TextTableView) {
activePage.hideView(reference);
}
}
// Clear Details View if needed
DetailsView detailsView = (DetailsView) activePage.findView(Constants.DETAILS_VIEW_ID);
if (detailsView != null && "".equals(detailsView.getTestCaseName())) {
detailsView.setData(null, false);
}
}
use of org.eclipse.titan.log.viewer.views.DetailsView in project titan.EclipsePlug-ins by eclipse.
the class TextTableView method dispose.
@Override
public void dispose() {
if (this.cachedLogReader != null) {
this.cachedLogReader.close();
}
if (this.filteredLogReader != null) {
this.filteredLogReader.close();
}
// Clear Details View if needed
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
if (activePage != null) {
DetailsView detailsView = (DetailsView) activePage.findView(Constants.DETAILS_VIEW_ID);
if ((detailsView != null) && (this.selectedEventObject != null)) {
URI dvFullPath = detailsView.getFullPath();
URI ttFullPath = this.logFileMetaData.getFilePath();
if ((dvFullPath != null) && (ttFullPath != null) && dvFullPath.equals(ttFullPath)) {
detailsView.setData(null, false);
}
}
}
super.dispose();
}
use of org.eclipse.titan.log.viewer.views.DetailsView in project titan.EclipsePlug-ins by eclipse.
the class OpenValueViewMenuAction method run.
@Override
public void run() {
if (this.eventSelection == null) {
return;
}
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
LogFileMetaData logFileMetaData;
if (this.view instanceof MSCView) {
logFileMetaData = ((MSCView) this.view).getLogFileMetaData();
} else if (this.view instanceof TextTableView) {
logFileMetaData = ((TextTableView) this.view).getLogFileMetaData();
} else {
return;
}
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceRoot root = workspace.getRoot();
IProject project = root.getProject(logFileMetaData.getProjectName());
IFile logFile = project.getFile(logFileMetaData.getProjectRelativePath().substring(logFileMetaData.getProjectName().length() + 1));
if (!logFile.exists()) {
IViewReference[] viewReferences = activePage.getViewReferences();
ActionUtils.closeAssociatedViews(activePage, viewReferences, logFile);
if (this.view instanceof TextTableView) {
// $NON-NLS-1$
TitanLogExceptionHandler.handleException(new UserException("The log file could not be found.\n Please perform the Open Text Table action again."));
} else {
// $NON-NLS-1$
TitanLogExceptionHandler.handleException(new UserException(Messages.getString("OpenValueViewMenuAction.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("MSCView.1") + e.getMessage()));
return;
}
}
// pass log file meta data
detailsview.setLogFileMetaData(logFileMetaData);
EventObject eventObject = this.eventSelection.getEventObject();
String testCase = this.eventSelection.getTestCaseName();
if ((eventObject == null) || (testCase == null)) {
return;
}
// get value
LogRecord logrecord;
try {
logrecord = ValueReader.getInstance().readLogRecordFromLogFile(logFileMetaData.getFilePath(), eventObject);
} catch (final IOException e) {
ErrorReporter.logExceptionStackTrace(e);
// $NON-NLS-1$
TitanLogExceptionHandler.handleException(new TechnicalException(Messages.getString("MSCView.8")));
return;
} catch (final ParseException e) {
ErrorReporter.logExceptionStackTrace(e);
// $NON-NLS-1$
TitanLogExceptionHandler.handleException(new TechnicalException(Messages.getString("MSCView.8")));
return;
}
String message = logrecord.getMessage();
DetailData detailData = new DetailData(eventObject.getName(), eventObject.getPort(), message, testCase, eventObject.getEventType(), logrecord.getSourceInformation());
detailsview.setData(detailData, false);
detailsview.setFocus();
}
Aggregations