List of usage examples for org.eclipse.jface.viewers TableViewer getTable
public Table getTable()
From source file:com.google.eclipse.mechanic.plugin.ui.TaskSelectionDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite container) { Control area = super.createDialogArea(container); TableViewer tableViewer = getTableViewer(); Table table = tableViewer.getTable(); tableViewer.setLabelProvider(new DefaultCellLabelProvider()); ColumnViewerToolTipSupport.enableFor(tableViewer, ToolTip.NO_RECREATE); table.setHeaderVisible(true);/* ww w . j a va 2 s . c om*/ newTableColumn(table, "Description", 200); newTableColumn(table, "ID", 200); newTableColumn(table, "Name", 200); tableViewer.refresh(); return area; }
From source file:com.google.gapid.widgets.Widgets.java
License:Apache License
public static TableViewer createTableViewer(Composite parent, int style) { TableViewer table = new VisibilityTrackingTableViewer(new Table(parent, style)); table.getTable().setHeaderVisible(true); table.getTable().setLinesVisible(true); table.setUseHashlookup(true);//from w w w.j av a 2s .c o m return table; }
From source file:com.google.gapid.widgets.Widgets.java
License:Apache License
@SafeVarargs public static <T> void sorting(TableViewer table, ColumnAndComparator<T>... columns) { int[] sortState = { 0, SWT.UP }; for (int i = 0; i < columns.length; i++) { final int idx = i; columns[idx].getColumn().addListener(SWT.Selection, e -> { table.getTable().setSortColumn(columns[idx].getColumn()); if (idx == sortState[0]) { sortState[1] = (sortState[1] == SWT.UP) ? SWT.DOWN : SWT.UP; table.getTable().setSortDirection(sortState[1]); } else { table.getTable().setSortDirection(SWT.UP); sortState[0] = idx;/*from www .j a v a 2 s.com*/ sortState[1] = SWT.UP; } table.setComparator(columns[idx].getComparator(sortState[1] == SWT.DOWN)); }); } table.getTable().setSortColumn(columns[0].getColumn()); table.getTable().setSortDirection(SWT.UP); table.setComparator(columns[0].getComparator(false)); }
From source file:com.google.gdt.eclipse.designer.gxt.databinding.DatabindingsProvider.java
License:Open Source License
public void configureBindingViewer(IDialogSettings settings, TableViewer viewer) { // prepare table Table table = viewer.getTable(); // binding type image column TableColumn bindingColumn = new TableColumn(table, SWT.NONE); bindingColumn.setWidth(23);/*w w w . j a v a 2 s . c om*/ bindingColumn.setResizable(false); // target column TableColumn targetColumn = UiUtils.createSmartColumn(table, settings, "TargetColumn", 300); targetColumn.setText("Target"); // model column TableColumn modelColumn = UiUtils.createSmartColumn(table, settings, "ModelColumn", 300); modelColumn.setText("Model"); // binding variable column TableColumn variableBindingColumn = UiUtils.createSmartColumn(table, settings, "VariableBindingColumn", 250); variableBindingColumn.setText("Binding"); // label provider viewer.setLabelProvider(new BindingLabelProvider()); }
From source file:com.hangum.tadpole.engine.sql.util.tables.SQLHistoryCreateColumn.java
License:Open Source License
/** * tablecolumn adapter// w ww . j av a 2 s . c o m * @param viewer * @param comparator * @param column * @param index sort index * @return */ private static SelectionAdapter getSelectionAdapter(final TableViewer viewer, final DefaultViewerSorter comparator, final TableColumn column, final int index) { SelectionAdapter selectionAdapter = new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { comparator.setColumn(index); viewer.getTable().setSortDirection(comparator.getDirection()); viewer.getTable().setSortColumn(column); viewer.refresh(); } }; return selectionAdapter; }
From source file:com.hangum.tadpole.engine.sql.util.tables.SQLResultLabelProvider.java
License:Open Source License
/** * table? Column? ?./*w w w .j av a 2 s . com*/ */ public static void createTableColumn(final TableViewer tableViewer, final ResultSetUtilDTO rsDAO, final SQLResultSorter tableSorter) { // column? . Table table = tableViewer.getTable(); int columnCount = table.getColumnCount(); for (int i = 0; i < columnCount; i++) { table.getColumn(0).dispose(); } if (rsDAO.getColumnName() == null) return; try { for (int i = 0; i < rsDAO.getColumnName().size(); i++) { final int index = i; final int columnAlign = RDBTypeToJavaTypeUtils.isNumberType(rsDAO.getColumnType().get(i)) ? SWT.RIGHT : SWT.LEFT; String strColumnName = rsDAO.getColumnName().get(i); /** ? ? ? */ if (StringUtils.startsWithIgnoreCase(strColumnName, PublicTadpoleDefine.SPECIAL_USER_DEFINE_HIDE_COLUMN)) continue; final TableViewerColumn tv = new TableViewerColumn(tableViewer, columnAlign); final TableColumn tc = tv.getColumn(); tc.setText(strColumnName); tc.setResizable(true); tc.setMoveable(true); tc.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { tableSorter.setColumn(index); int dir = tableViewer.getTable().getSortDirection(); if (tableViewer.getTable().getSortColumn() == tc) { dir = dir == SWT.UP ? SWT.DOWN : SWT.UP; } else { dir = SWT.DOWN; } tableViewer.getTable().setSortDirection(dir); tableViewer.getTable().setSortColumn(tc); tableViewer.refresh(); } }); // tc.setEditingSupport(new FirstNameEditingSupport(viewer)); } // end for } catch (Exception e) { logger.error("SQLResult TableViewer", e); } }
From source file:com.hangum.tadpole.engine.sql.util.tables.TableUtil.java
License:Open Source License
public static void makeTableColumnViewer(TableViewer tableViewer, String[] header) { Table table = tableViewer.getTable(); int columnCount = table.getColumnCount(); for (int i = 0; i < columnCount; i++) { table.getColumn(0).dispose();//from w ww.ja va 2 s . c o m } for (int i = 0; i < header.length; i++) { TableViewerColumn column = new TableViewerColumn(tableViewer, SWT.LEFT); column.getColumn().setText(header[i]); column.getColumn().setResizable(true); column.getColumn().setMoveable(true); column.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(Object element) { return element.toString(); } }); } }
From source file:com.hangum.tadpole.manager.core.editor.transaction.connection.TransactionConnectionListEditor.java
License:Open Source License
/** * connection pool composite//from ww w. ja v a 2s.c o m * * @param composte */ private void createConnectionPoolComposite(Composite compositeConnectionPool) { Composite compositeCToolbar = new Composite(compositeConnectionPool, SWT.NONE); compositeCToolbar.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); GridLayout gl_compositeCToolbar = new GridLayout(1, false); gl_compositeCToolbar.verticalSpacing = 1; gl_compositeCToolbar.horizontalSpacing = 1; gl_compositeCToolbar.marginHeight = 1; gl_compositeCToolbar.marginWidth = 1; compositeCToolbar.setLayout(gl_compositeCToolbar); ToolBar toolBar = new ToolBar(compositeCToolbar, SWT.FLAT | SWT.RIGHT); toolBar.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); ToolItem tltmCRefresh = new ToolItem(toolBar, SWT.NONE); tltmCRefresh.setText("Refresh"); TableViewer tableViewerCon = new TableViewer(compositeConnectionPool, SWT.BORDER | SWT.FULL_SELECTION); tableCon = tableViewerCon.getTable(); tableCon.setLinesVisible(true); tableCon.setHeaderVisible(true); tableCon.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); }
From source file:com.hangum.tadpole.mongodb.core.composite.result.MongodbResultComposite.java
License:Open Source License
/** * table column adapter// ww w. j ava2s .co m * * @param column * @param index * @return */ private SelectionAdapter getSelectionAdapter(final TableViewer viewer, final DefaultViewerSorter comparator, final TableColumn column, final int index) { SelectionAdapter selectionAdapter = new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { comparator.setColumn(index); viewer.getTable().setSortDirection(comparator.getDirection()); viewer.getTable().setSortColumn(column); viewer.refresh(); } }; return selectionAdapter; }
From source file:com.hangum.tadpole.monitoring.core.dialogs.schedule.AddScheduleDialog.java
License:Open Source License
public SQLOrderEditingSupport(TableViewer viewer) { super(viewer); this.viewer = viewer; this.editor = new TextCellEditor(viewer.getTable()); }