use of org.jkiss.dbeaver.model.qm.QMEventFilter in project dbeaver by dbeaver.
the class TransactionInfoDialog method createTransactionLogPanel.
protected void createTransactionLogPanel(Composite composite) {
DBCExecutionContext context = getCurrentContext();
QMEventFilter filter = context == null ? VOID_FILTER : createContextFilter(context);
logViewer = new QueryLogViewer(composite, activeEditor.getSite(), filter, false);
logViewer.setUseDefaultFilter(false);
final Object gd = logViewer.getControl().getLayoutData();
if (gd instanceof GridData) {
((GridData) gd).heightHint = logViewer.getControl().getHeaderHeight() + logViewer.getControl().getItemHeight() * 5;
}
showAllCheck = UIUtils.createCheckbox(composite, "Show all queries", "Show all transaction queries. Otherwise shows only modifying queries.", false, 1);
showAllCheck.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateTransactionFilter();
}
});
showPreviousCheck = UIUtils.createCheckbox(composite, "Show previous transactions", "Show previous transactions. Otherwise shows only active one.", false, 1);
showPreviousCheck.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateTransactionFilter();
}
});
}
use of org.jkiss.dbeaver.model.qm.QMEventFilter in project dbeaver by dbeaver.
the class TransactionInfoDialog method createContextFilter.
protected QMEventFilter createContextFilter(DBCExecutionContext executionContext) {
if (executionContext == null) {
return VOID_FILTER;
}
final boolean showAll = showAllCheck != null && showAllCheck.getSelection();
final boolean showPrevious = showPreviousCheck != null && showPreviousCheck.getSelection();
final QMMSessionInfo currentSession = QMUtils.getCurrentSession(executionContext);
final QMMTransactionSavepointInfo currentSP = QMUtils.getCurrentTransaction(executionContext);
QMEventFilter filter = new QMEventFilter() {
@Override
public boolean accept(QMMetaEvent event) {
QMMObject object = event.getObject();
if (object instanceof QMMStatementExecuteInfo) {
QMMStatementExecuteInfo exec = (QMMStatementExecuteInfo) object;
if (!showPrevious && exec.getSavepoint() != currentSP) {
return false;
}
if (exec.getStatement().getSession() != currentSession) {
return false;
}
DBCExecutionPurpose purpose = exec.getStatement().getPurpose();
if (purpose == DBCExecutionPurpose.META || purpose == DBCExecutionPurpose.UTIL) {
return false;
}
return (showAll || exec.isTransactional());
}
return false;
}
};
return filter;
}
use of org.jkiss.dbeaver.model.qm.QMEventFilter in project dbeaver by dbeaver.
the class TransactionInfoDialog method updateTransactionFilter.
private void updateTransactionFilter() {
DBCExecutionContext context = getCurrentContext();
QMEventFilter filter = context == null ? VOID_FILTER : createContextFilter(context);
logViewer.setFilter(filter);
logViewer.refresh();
}
use of org.jkiss.dbeaver.model.qm.QMEventFilter in project dbeaver by serge-rider.
the class TransactionInfoDialog method createContextFilter.
protected QMEventFilter createContextFilter(DBCExecutionContext executionContext) {
if (executionContext == null) {
return VOID_FILTER;
}
final boolean showAll = showAllCheck != null && showAllCheck.getSelection();
final boolean showPrevious = showPreviousCheck != null && showPreviousCheck.getSelection();
final QMMSessionInfo currentSession = QMUtils.getCurrentSession(executionContext);
final QMMTransactionSavepointInfo currentSP = QMUtils.getCurrentTransaction(executionContext);
QMEventFilter filter = event -> {
QMMObject object = event.getObject();
if (object instanceof QMMStatementExecuteInfo) {
QMMStatementExecuteInfo exec = (QMMStatementExecuteInfo) object;
if (!showPrevious && !CommonUtils.equalObjects(exec.getSavepoint(), currentSP)) {
return false;
}
if (!showAll && !CommonUtils.equalObjects(exec.getStatement().getSession(), currentSession)) {
return false;
}
DBCExecutionPurpose purpose = exec.getStatement().getPurpose();
if (purpose == DBCExecutionPurpose.META || purpose == DBCExecutionPurpose.UTIL) {
return false;
}
return (showAll || exec.isTransactional());
}
return false;
};
return filter;
}
use of org.jkiss.dbeaver.model.qm.QMEventFilter in project dbeaver by serge-rider.
the class TransactionInfoDialog method createTransactionLogPanel.
protected void createTransactionLogPanel(Composite composite) {
DBCExecutionContext context = getCurrentContext();
QMEventFilter filter = context == null ? VOID_FILTER : createContextFilter(context);
logViewer = new QueryLogViewer(composite, activeEditor.getSite(), filter, false, true);
logViewer.setUseDefaultFilter(false);
final Object gd = logViewer.getControl().getLayoutData();
if (gd instanceof GridData) {
((GridData) gd).heightHint = logViewer.getControl().getHeaderHeight() + logViewer.getControl().getItemHeight() * 5;
}
showAllCheck = UIUtils.createCheckbox(composite, CoreMessages.transaction_info_dialog_checkbox_show_all_queries, CoreMessages.transaction_info_dialog_label_show_all_transaction_queries, false, 1);
showAllCheck.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateTransactionFilter();
}
});
showPreviousCheck = UIUtils.createCheckbox(composite, CoreMessages.transaction_info_dialog_checkbox_show_previous_transactions, CoreMessages.transaction_info_dialog_label_otherwise, false, 1);
showPreviousCheck.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateTransactionFilter();
}
});
closeOnFocusLost(logViewer.getSearchText(), logViewer.getControl(), showAllCheck, showPreviousCheck);
}
Aggregations