use of org.jkiss.dbeaver.ui.navigator.INavigatorNodeActionHandler in project dbeaver by dbeaver.
the class StatisticsNavigatorNodeRenderer method getDetailsTipText.
private String getDetailsTipText(DBNNode element, Tree tree, Event event) {
if (element instanceof DBNDatabaseNode) {
if (element instanceof DBNDataSource) {
if (DBWorkbench.getPlatform().getPreferenceStore().getBoolean(NavigatorPreferences.NAVIGATOR_SHOW_NODE_ACTIONS)) {
// Detect active action
INavigatorNodeActionHandler overActionButton = getActionButtonFor(element, tree, event);
if (overActionButton != null) {
return overActionButton.getNodeActionToolTip(view, element);
}
}
if (DBWorkbench.getPlatform().getPreferenceStore().getBoolean(NavigatorPreferences.NAVIGATOR_SHOW_CONNECTION_HOST_NAME)) {
return DataSourceUtils.getDataSourceAddressText(((DBNDataSource) element).getDataSourceContainer());
}
return null;
}
if (DBWorkbench.getPlatform().getPreferenceStore().getBoolean(NavigatorPreferences.NAVIGATOR_SHOW_STATISTICS_INFO)) {
if (event.x > getTreeWidth(tree) - PERCENT_FILL_WIDTH) {
DBSObject object = ((DBNDatabaseNode) element).getObject();
if (object instanceof DBPObjectStatistics && ((DBPObjectStatistics) object).hasStatistics()) {
long statObjectSize = ((DBPObjectStatistics) object).getStatObjectSize();
if (statObjectSize > 0) {
String formattedSize;
try {
DBDDataFormatter formatter = object.getDataSource().getContainer().getDataFormatterProfile().createFormatter(DBDDataFormatter.TYPE_NAME_NUMBER, null);
formattedSize = formatter.formatValue(statObjectSize);
} catch (Exception e) {
formattedSize = String.valueOf(statObjectSize);
}
return "Object size on disk: " + formattedSize + " bytes";
}
}
}
// renderObjectStatistics((DBNDatabaseNode) element, tree, gc, event);
}
}
return null;
}
Aggregations