use of org.eclipse.titan.log.viewer.views.msc.model.EventSelection in project titan.EclipsePlug-ins by eclipse.
the class TextTableView method addListeners.
private void addListeners() {
this.table.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
if (logFileMetaData == null) {
return;
}
final IFile logFile = logFileMetaData.getLogfile();
if (logFile == null) {
return;
}
if (LogFileCacheHandler.hasLogFileChanged(logFile)) {
LogFileCacheHandler.handleLogFileChange(logFile);
return;
}
setContentDescription(TextTableView.this.logFileMetaData.getProjectRelativePath() + " [" + (TextTableView.this.table.getSelectionIndex() + 1) + "/" + TextTableView.this.filteredLogReader.size() + "]");
if (e.getSource() instanceof Table) {
updateSelection((Table) e.getSource());
}
}
});
this.table.addMouseListener(new MouseAdapter() {
@Override
public void mouseDoubleClick(final MouseEvent e) {
if (logFileMetaData == null) {
return;
}
final IFile logFile = logFileMetaData.getLogfile();
if (logFile == null) {
return;
}
if (LogFileCacheHandler.hasLogFileChanged(logFile)) {
LogFileCacheHandler.handleLogFileChange(logFile);
return;
}
if (!(e.getSource() instanceof Table)) {
return;
}
Table table = (Table) e.getSource();
int index = table.getSelectionIndex();
if (index < 0 || index >= table.getItemCount()) {
return;
}
TableItem tableItem = table.getItem(index);
Object data = tableItem.getData();
if (data instanceof LogRecord) {
LogRecord logrecord = (LogRecord) data;
EventObject eventObject = createEventObject(logrecord);
// $NON-NLS-1$
TextTableView.this.eventSelection = new EventSelection(eventObject, "");
TextTableView.this.openValueViewMenuAction.run();
silentOpenSourceViewMenuAction.selectionChanged(eventSelection);
silentOpenSourceViewMenuAction.run();
} else {
TextTableView.this.eventSelection = new EventSelection(null, null);
}
fireSelectionChangeEvent();
}
});
this.table.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(final KeyEvent e) {
int moves = e.keyCode;
if (moves != SWT.CR) {
return;
}
if (e.getSource() instanceof Table) {
Table table = (Table) e.getSource();
TableItem tableItem = table.getItem(table.getSelectionIndex());
Object data = tableItem.getData();
if (data instanceof LogRecord) {
LogRecord logrecord = (LogRecord) data;
EventObject eventObject = createEventObject(logrecord);
// $NON-NLS-1$
TextTableView.this.eventSelection = new EventSelection(eventObject, "");
} else {
TextTableView.this.eventSelection = new EventSelection(null, null);
}
}
fireSelectionChangeEvent();
TextTableView.this.openValueViewMenuAction.run();
silentOpenSourceViewMenuAction.selectionChanged(eventSelection);
silentOpenSourceViewMenuAction.run();
}
});
}
use of org.eclipse.titan.log.viewer.views.msc.model.EventSelection in project titan.EclipsePlug-ins by eclipse.
the class TextTableView method updateSelection.
/**
* Update the selection in the provided table
*
* @param table to work on
*/
private void updateSelection(Table table1) {
TableItem tableItem = table1.getItem(table1.getSelectionIndex());
Object data = tableItem.getData();
if (data instanceof LogRecord) {
LogRecord logrecord = (LogRecord) data;
TextTableView.this.selectedEventObject = createEventObject(logrecord);
TextTableView.this.eventSelection = new EventSelection(TextTableView.this.selectedEventObject, "");
} else {
TextTableView.this.eventSelection = new EventSelection(null, null);
}
fireSelectionChangeEvent();
silentOpenSourceViewMenuAction.delayedRun(eventSelection);
silentOpenValueViewMenuAction.delayedRun(eventSelection);
}
Aggregations