use of org.jkiss.dbeaver.runtime.properties.PropertyCollector in project dbeaver by dbeaver.
the class SpreadsheetPresentation method getAdapter.
@Override
public <T> T getAdapter(Class<T> adapter) {
if (adapter == IPropertySheetPage.class) {
// Show cell properties
PropertyPageStandard page = new PropertyPageStandard();
page.setPropertySourceProvider(object -> {
if (object instanceof GridCell) {
GridCell cell = (GridCell) object;
boolean recordMode = controller.isRecordMode();
final DBDAttributeBinding attr = (DBDAttributeBinding) (recordMode ? cell.row : cell.col);
final ResultSetRow row = (ResultSetRow) (recordMode ? cell.col : cell.row);
final SpreadsheetValueController valueController = new SpreadsheetValueController(controller, attr, row, IValueController.EditType.NONE, null);
PropertyCollector props = new PropertyCollector(valueController.getBinding().getAttribute(), false);
props.collectProperties();
valueController.getValueManager().contributeProperties(props, valueController);
return new PropertySourceDelegate(props);
}
return null;
});
return adapter.cast(page);
} else if (adapter == IFindReplaceTarget.class) {
return adapter.cast(findReplaceTarget);
}
return null;
}
use of org.jkiss.dbeaver.runtime.properties.PropertyCollector in project dbeaver by dbeaver.
the class SessionManagerViewer method updatePreview.
private void updatePreview() {
if (previewFolder.getSelectionIndex() == 0) {
// Show SQL
detailsItem.setText(SessionEditorMessages.viewer_details_item_session_details);
updateSQL();
if (curSession == null) {
sessionProps.clearProperties();
} else {
PropertyCollector propCollector = new PropertyCollector(curSession, true);
propCollector.collectProperties();
sessionProps.loadProperties(propCollector);
}
} else if (planViewer != null) {
// Show execution plan
String sqlText = curSession == null ? "" : CommonUtils.notEmpty(curSession.getActiveQuery());
if (!CommonUtils.isEmpty(sqlText)) {
planViewer.explainQueryPlan(new SQLQuery(sessionManager.getDataSource(), sqlText), curSession.getActiveQueryId());
}
}
if (detailsFolder.getSelectionIndex() > 0) {
CTabItem detailsItem = detailsFolder.getItem(detailsFolder.getSelectionIndex());
Object data = detailsItem.getData();
if (data instanceof DBAServerSessionDetails) {
if (detailsItem.getControl() instanceof StyledText) {
StyledText styledText = (StyledText) detailsItem.getControl();
loadPlainTextDetails((DBAServerSessionDetails) data, styledText);
} else {
DetailsListControl detailsListControl = (DetailsListControl) detailsItem.getControl();
detailsListControl.loadData();
}
}
}
}
Aggregations