use of org.eclipse.jface.viewers.ColumnLabelProvider in project dbeaver by serge-rider.
the class FilterValueEditDialog method createMultiValueSelector.
private void createMultiValueSelector(Composite composite) {
table = CheckboxTableViewer.newCheckList(composite, SWT.BORDER | SWT.MULTI | SWT.CHECK | SWT.FULL_SELECTION);
table.getTable().setLinesVisible(true);
table.getTable().setHeaderVisible(true);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.widthHint = 400;
gd.heightHint = 300;
table.getTable().setLayoutData(gd);
table.setContentProvider(new ListContentProvider());
ViewerColumnController columnController = new ViewerColumnController(getClass().getName(), table);
columnController.addColumn("Value", "Value", SWT.LEFT, true, true, new ColumnLabelProvider() {
@Override
public String getText(Object element) {
return attr.getValueHandler().getValueDisplayString(attr, ((DBDLabelValuePair) element).getValue(), DBDDisplayFormat.UI);
}
});
columnController.addColumn("Description", "Row description (composed from dictionary columns)", SWT.LEFT, true, true, new ColumnLabelProvider() {
@Override
public String getText(Object element) {
return ((DBDLabelValuePair) element).getLabel();
}
});
columnController.createColumns();
MenuManager menuMgr = new MenuManager();
menuMgr.addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(IMenuManager manager) {
UIUtils.fillDefaultTableContextMenu(manager, table.getTable());
manager.add(new Separator());
manager.add(new Action("Select &All") {
@Override
public void run() {
for (DBDLabelValuePair row : getMultiValues()) {
table.setChecked(row, true);
}
}
});
manager.add(new Action("Select &None") {
@Override
public void run() {
for (DBDLabelValuePair row : getMultiValues()) {
table.setChecked(row, false);
}
}
});
}
});
menuMgr.setRemoveAllWhenShown(true);
table.getTable().setMenu(menuMgr.createContextMenu(table.getTable()));
if (attr.getDataKind() == DBPDataKind.STRING) {
// Create filter text
final Text valueFilterText = new Text(composite, SWT.BORDER);
valueFilterText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
valueFilterText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
filterPattern = valueFilterText.getText();
if (filterPattern.isEmpty()) {
filterPattern = null;
}
loadValues();
}
});
}
filterPattern = null;
loadValues();
}
use of org.eclipse.jface.viewers.ColumnLabelProvider in project translationstudio8 by heartsome.
the class NewProjectTbPage method createColumn.
/**
* 创建Table列
* @param viewer
* ;
*/
private void createColumn(final TableViewer viewer) {
String[] clmnTitles = { Messages.getString("newproject.NewProjectTbPage.clmnTitles1"), Messages.getString("newproject.NewProjectTbPage.clmnTitles2"), Messages.getString("newproject.NewProjectTbPage.clmnTitles3"), Messages.getString("newproject.NewProjectTbPage.clmnTitles4"), Messages.getString("newproject.NewProjectTbPage.clmnTitles5") };
int[] clmnBounds = { 100, 100, 200, 90, 70 };
TableViewerColumn col = createTableViewerColumn(viewer, clmnTitles[0], clmnBounds[0], 0);
col.setLabelProvider(new ColumnLabelProvider() {
public String getText(Object element) {
DatabaseModelBean dbModel = (DatabaseModelBean) element;
return dbModel.getDbName();
}
});
col = createTableViewerColumn(viewer, clmnTitles[1], clmnBounds[1], 1);
col.setLabelProvider(new ColumnLabelProvider() {
public String getText(Object element) {
DatabaseModelBean dbModel = (DatabaseModelBean) element;
if (dbModel.getDbType().equals(Constants.DBTYPE_SQLITE)) {
return Messages.getString("tb.dbtype.sqlite");
}
return dbModel.getDbType();
}
});
col = createTableViewerColumn(viewer, clmnTitles[2], clmnBounds[2], 2);
col.setLabelProvider(new ColumnLabelProvider() {
public String getText(Object element) {
DatabaseModelBean dbModel = (DatabaseModelBean) element;
if (dbModel.getDbType().equals(Constants.DBTYPE_INTERNALDB) || dbModel.getDbType().equals(Constants.DBTYPE_SQLITE)) {
return dbModel.getItlDBLocation();
}
return dbModel.getHost();
}
});
col = createTableViewerColumn(viewer, clmnTitles[3], clmnBounds[3], 3);
col.setLabelProvider(new ColumnLabelProvider() {
public String getText(Object element) {
DatabaseModelBean dbModel = (DatabaseModelBean) element;
if (dbModel.isHasMatch()) {
return Messages.getString("newproject.NewProjectTbPage.yes");
} else {
return Messages.getString("newproject.NewProjectTbPage.no");
}
}
});
col = createTableViewerColumn(viewer, clmnTitles[4], clmnBounds[4], 4);
col.setLabelProvider(new ColumnLabelProvider() {
public Image getImage(Object element) {
DatabaseModelBean dbModel = (DatabaseModelBean) element;
if (dbModel.isDefault()) {
return checkedImage;
} else {
return uncheckedImage;
}
}
public String getText(Object element) {
return null;
}
});
col.setEditingSupport(new ReadableEditingSupport(viewer));
}
use of org.eclipse.jface.viewers.ColumnLabelProvider in project translationstudio8 by heartsome.
the class TermDbManagerDialog method createColumn.
/**
* 创建Table列
* @param viewer
* ;
*/
private void createColumn(final TableViewer viewer) {
String[] clmnTitles = { Messages.getString("dialog.TermDbManagerDialog.clmnTitles1"), Messages.getString("dialog.TermDbManagerDialog.clmnTitles2"), Messages.getString("dialog.TermDbManagerDialog.clmnTitles3") };
int[] clmnBounds = { 50, 100, 100 };
TableViewerColumn col = createTableViewerColumn(viewer, clmnTitles[0], clmnBounds[0], 0);
col.setLabelProvider(new ColumnLabelProvider() {
public String getText(Object element) {
DatabaseManagerDbListBean bean = (DatabaseManagerDbListBean) element;
return bean.getIndex();
}
});
col = createTableViewerColumn(viewer, clmnTitles[1], clmnBounds[1], 1);
col.setLabelProvider(new ColumnLabelProvider() {
public String getText(Object element) {
DatabaseManagerDbListBean bean = (DatabaseManagerDbListBean) element;
return bean.getDbName();
}
});
col = createTableViewerColumn(viewer, clmnTitles[2], clmnBounds[2], 2);
col.setLabelProvider(new ColumnLabelProvider() {
public String getText(Object element) {
DatabaseManagerDbListBean bean = (DatabaseManagerDbListBean) element;
return bean.getLangs();
}
});
}
use of org.eclipse.jface.viewers.ColumnLabelProvider in project translationstudio8 by heartsome.
the class ProjectSettingTBPage method createColumn.
/**
* 创建Table列
* @param viewer
* ;
*/
private void createColumn(final TableViewer viewer) {
String[] clmnTitles = { Messages.getString("projectsetting.ProjectSettingTBPage.clmnTitles1"), Messages.getString("projectsetting.ProjectSettingTBPage.clmnTitles2"), Messages.getString("projectsetting.ProjectSettingTBPage.clmnTitles3"), Messages.getString("projectsetting.ProjectSettingTBPage.clmnTitles4"), Messages.getString("projectsetting.ProjectSettingTBPage.clmnTitles5") };
int[] clmnBounds = { 100, 100, 200, 90, 70 };
TableViewerColumn col = createTableViewerColumn(viewer, clmnTitles[0], clmnBounds[0], 0);
col.setLabelProvider(new ColumnLabelProvider() {
public String getText(Object element) {
DatabaseModelBean dbModel = (DatabaseModelBean) element;
return dbModel.getDbName();
}
});
col = createTableViewerColumn(viewer, clmnTitles[1], clmnBounds[1], 1);
col.setLabelProvider(new ColumnLabelProvider() {
public String getText(Object element) {
DatabaseModelBean dbModel = (DatabaseModelBean) element;
String dbType = dbModel.getDbType();
if (dbType.equals(Constants.DBTYPE_MYSQL)) {
dbType = Constants.DBTYPE_MYSQL_FOR_UI;
} else if (dbType.equals(Constants.DBTYPE_MSSQL2005)) {
dbType = Constants.DBTYPE_MSSQL2005_FOR_UI;
} else if (dbType.equals(Constants.DBTYPE_SQLITE)) {
dbType = Messages.getString("tb.dbtype.sqlite");
}
return dbType;
}
});
col = createTableViewerColumn(viewer, clmnTitles[2], clmnBounds[2], 2);
col.setLabelProvider(new ColumnLabelProvider() {
public String getText(Object element) {
DatabaseModelBean dbModel = (DatabaseModelBean) element;
if (dbModel.getDbType().equals("Internal DB") || dbModel.getDbType().equals("SQLite")) {
return dbModel.getItlDBLocation();
}
return dbModel.getHost();
}
});
col = createTableViewerColumn(viewer, clmnTitles[3], clmnBounds[3], 3);
col.setLabelProvider(new ColumnLabelProvider() {
public String getText(Object element) {
DatabaseModelBean dbModel = (DatabaseModelBean) element;
if (dbModel.isHasMatch()) {
return Messages.getString("projectsetting.ProjectSettingTBPage.yes");
} else {
return Messages.getString("projectsetting.ProjectSettingTBPage.no");
}
}
});
col = createTableViewerColumn(viewer, clmnTitles[4], clmnBounds[4], 4);
col.setLabelProvider(new ColumnLabelProvider() {
public Image getImage(Object element) {
DatabaseModelBean dbModel = (DatabaseModelBean) element;
if (dbModel.isDefault()) {
return checkedImage;
} else {
return uncheckedImage;
}
}
public String getText(Object element) {
return null;
}
});
col.setEditingSupport(new ReadableEditingSupport(viewer));
}
use of org.eclipse.jface.viewers.ColumnLabelProvider in project translationstudio8 by heartsome.
the class TmDbManagerDialog method createColumn.
/**
* 创建Table列
* @param viewer
* ;
*/
private void createColumn(final TableViewer viewer) {
String[] clmnTitles = { Messages.getString("dialog.TmDbManagerDialog.clmnTitles1"), Messages.getString("dialog.TmDbManagerDialog.clmnTitles2"), Messages.getString("dialog.TmDbManagerDialog.clmnTitles3") };
int[] clmnBounds = { 50, 100, 100 };
TableViewerColumn col = createTableViewerColumn(viewer, clmnTitles[0], clmnBounds[0], 0);
col.setLabelProvider(new ColumnLabelProvider() {
public String getText(Object element) {
DatabaseManagerDbListBean bean = (DatabaseManagerDbListBean) element;
return bean.getIndex();
}
});
col = createTableViewerColumn(viewer, clmnTitles[1], clmnBounds[1], 1);
col.setLabelProvider(new ColumnLabelProvider() {
public String getText(Object element) {
DatabaseManagerDbListBean bean = (DatabaseManagerDbListBean) element;
return bean.getDbName();
}
});
col = createTableViewerColumn(viewer, clmnTitles[2], clmnBounds[2], 2);
col.setLabelProvider(new ColumnLabelProvider() {
public String getText(Object element) {
DatabaseManagerDbListBean bean = (DatabaseManagerDbListBean) element;
return bean.getLangs();
}
});
}
Aggregations