use of org.eclipse.jface.viewers.IToolTipProvider in project dbeaver by serge-rider.
the class SQLScriptTaskDataSourceSelectorDialog method createScriptColumns.
static void createScriptColumns(ColumnViewer viewer) {
final ILabelProvider mainLabelProvider = (ILabelProvider) viewer.getLabelProvider();
ViewerColumnController columnController = new ViewerColumnController("sqlTaskScriptViewer", viewer);
columnController.setForceAutoSize(true);
columnController.addColumn(ModelMessages.model_navigator_Name, DTUIMessages.sql_script_task_data_source_selection_dialog_column_description_script, SWT.LEFT, true, true, new ColumnLabelProvider() {
@Override
public String getText(Object element) {
return mainLabelProvider.getText(element);
}
@Override
public Image getImage(Object element) {
return mainLabelProvider.getImage(element);
}
@Override
public String getToolTipText(Object element) {
if (mainLabelProvider instanceof IToolTipProvider) {
return ((IToolTipProvider) mainLabelProvider).getToolTipText(element);
}
return null;
}
});
columnController.addColumn(ModelMessages.model_navigator_Connection, DTUIMessages.sql_script_task_data_source_selection_dialog_column_description_script_data_source, SWT.LEFT, true, true, new ColumnLabelProvider() {
@Override
public String getText(Object element) {
if (element instanceof DBNResource) {
Collection<DBPDataSourceContainer> containers = ((DBNResource) element).getAssociatedDataSources();
if (!CommonUtils.isEmpty(containers)) {
StringBuilder text = new StringBuilder();
for (DBPDataSourceContainer container : containers) {
if (text.length() > 0) {
text.append(", ");
}
text.append(container.getName());
}
return text.toString();
}
}
return "";
}
@Override
public Image getImage(Object element) {
return null;
}
});
columnController.createColumns(true);
}
use of org.eclipse.jface.viewers.IToolTipProvider in project dbeaver by serge-rider.
the class AdvancedList method onMouseMove.
private void onMouseMove(MouseEvent e) {
AdvancedListItem item = getItemByPos(e.x, e.y);
if (item == hoverItem) {
return;
}
AdvancedListItem[] redrawItems = new AdvancedListItem[] { item, hoverItem };
hoverItem = item;
if (item == null) {
toolTipHandler.updateToolTipText(null);
} else {
ILabelProvider labelProvider = item.getLabelProvider();
if (labelProvider instanceof IToolTipProvider) {
String toolTipText = ((IToolTipProvider) labelProvider).getToolTipText(item.getData());
if (!CommonUtils.isEmpty(toolTipText)) {
toolTipHandler.updateToolTipText(toolTipText);
}
}
}
GC gc = new GC(this);
try {
paintList(gc, redrawItems);
} finally {
gc.dispose();
}
}
Aggregations