Search in sources :

Example 1 with ColumnLabelProvider

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();
}
Also used : ViewerColumnController(org.jkiss.dbeaver.ui.controls.ViewerColumnController) ModifyListener(org.eclipse.swt.events.ModifyListener) ColumnLabelProvider(org.eclipse.jface.viewers.ColumnLabelProvider) ListContentProvider(org.jkiss.dbeaver.ui.controls.ListContentProvider) ModifyEvent(org.eclipse.swt.events.ModifyEvent) GridData(org.eclipse.swt.layout.GridData) DBDLabelValuePair(org.jkiss.dbeaver.model.data.DBDLabelValuePair)

Example 2 with ColumnLabelProvider

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));
}
Also used : ColumnLabelProvider(org.eclipse.jface.viewers.ColumnLabelProvider) DatabaseModelBean(net.heartsome.cat.common.bean.DatabaseModelBean) Image(org.eclipse.swt.graphics.Image) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Example 3 with ColumnLabelProvider

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();
        }
    });
}
Also used : ColumnLabelProvider(org.eclipse.jface.viewers.ColumnLabelProvider) DatabaseManagerDbListBean(net.heartsome.cat.database.ui.bean.DatabaseManagerDbListBean) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Example 4 with ColumnLabelProvider

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));
}
Also used : ColumnLabelProvider(org.eclipse.jface.viewers.ColumnLabelProvider) DatabaseModelBean(net.heartsome.cat.common.bean.DatabaseModelBean) Image(org.eclipse.swt.graphics.Image) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Example 5 with ColumnLabelProvider

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();
        }
    });
}
Also used : ColumnLabelProvider(org.eclipse.jface.viewers.ColumnLabelProvider) DatabaseManagerDbListBean(net.heartsome.cat.database.ui.bean.DatabaseManagerDbListBean) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Aggregations

ColumnLabelProvider (org.eclipse.jface.viewers.ColumnLabelProvider)13 TableViewerColumn (org.eclipse.jface.viewers.TableViewerColumn)11 DatabaseModelBean (net.heartsome.cat.common.bean.DatabaseModelBean)4 Image (org.eclipse.swt.graphics.Image)4 ExportDatabaseBean (net.heartsome.cat.database.bean.ExportDatabaseBean)2 DatabaseManagerDbListBean (net.heartsome.cat.database.ui.bean.DatabaseManagerDbListBean)2 ModifyEvent (org.eclipse.swt.events.ModifyEvent)2 ModifyListener (org.eclipse.swt.events.ModifyListener)2 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 Composite (org.eclipse.swt.widgets.Composite)2 Baseline (aQute.bnd.differ.Baseline)1 Info (aQute.bnd.differ.Baseline.Info)1 ViewFailedSQLTableContentProvider (com.cubrid.common.ui.common.sqlrunner.ViewFailedSQLTableContentProvider)1 ViewFailedSQLTableLabelProvider (com.cubrid.common.ui.common.sqlrunner.ViewFailedSQLTableLabelProvider)1 SqlRunnerFailed (com.cubrid.common.ui.common.sqlrunner.model.SqlRunnerFailed)1 AzureDockerPreferredSettings (com.microsoft.azure.docker.model.AzureDockerPreferredSettings)1 DockerHost (com.microsoft.azure.docker.model.DockerHost)1 EditableDockerHost (com.microsoft.azure.docker.model.EditableDockerHost)1 Azure (com.microsoft.azure.management.Azure)1