@Override protected TableViewer createViewer(final Composite parent, final AbstractColumnLayout columnLayout, final int style) { final TableViewer viewer = new TableViewer(parent, style); final Table table = viewer.getTable(); table.setLinesVisible(linesVisible); table.setHeaderVisible(headerVisible); int columnIndex = 0; for (final String columnLabel : columnLabels) { final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, NONE); final TableColumn column = viewerColumn.getColumn(); columnLayout.setColumnData(column, createColumnLayoutData(columnIndex)); column.setText(columnLabel); column.setMoveable(moveable); columnIndex++; } return viewer; }
private void createSourceTable(SashForm sashForm) { avaliableFieldTableViewer = new TableViewer(sashForm, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION); table_1 = avaliableFieldTableViewer.getTable(); table_1.setLinesVisible(true); table_1.setHeaderVisible(true); avaliableFieldTableViewer.setContentProvider(new IStructuredContentProvider() { @Override public Object[] getElements(Object inputElement) { return ((List) inputElement).toArray(); } }); avaliableFieldTableViewer.setInput(schemaFields); TableViewerColumn tableViewerColumn_2 = new TableViewerColumn(avaliableFieldTableViewer, SWT.NONE); TableColumn tblclmnNewColumn_2 = tableViewerColumn_2.getColumn(); tblclmnNewColumn_2.setWidth(196); tblclmnNewColumn_2.setText(Messages.AVAILABLE_FIELDS_HEADER); tableViewerColumn_2.setLabelProvider(new ColumnLabelProvider()); attachDragListener(); }
private TableViewer createTableColumns(Composite tableComposite) { TableViewer tableViewer = new TableViewer(tableComposite, SWT.BORDER | SWT.FULL_SELECTION); excelFormatterTable = tableViewer.getTable(); excelFormatterTable.setHeaderVisible(true); excelFormatterTable.setLinesVisible(true); excelFormatterTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); TableViewerColumn tableViewerColumn = new TableViewerColumn(tableViewer, SWT.NONE); TableColumn parameterNameColumn = tableViewerColumn.getColumn(); parameterNameColumn.setWidth(254); parameterNameColumn.setText(Messages.PARAMETER_NAME); tableViewerColumn.setLabelProvider(new ParameterNameLabelProvider()); TableViewerColumn tableViewerColumn_1 = new TableViewerColumn(tableViewer, SWT.NONE); TableColumn parameterValueColumn = tableViewerColumn_1.getColumn(); parameterValueColumn.setWidth(251); parameterValueColumn.setText(Messages.PARAMETER_VALUE); tableViewerColumn_1.setLabelProvider(new ParameterValueLabelProvider()); return tableViewer; }
private void createTableControl(Composite container) { tableViewer = new TableViewer(container, SWT.FULL_SELECTION | SWT.BORDER); String[] columnIndex = new String[] { "主键", "外键", "列名", "名称", "类型", "不能为空", "是否唯一" }; Integer[] columnWidth = new Integer[] { 40, 40, 120, 120, 120, 80, 80 }; Integer[] columnAlign = new Integer[] { SWT.CENTER, SWT.CENTER, SWT.LEFT, SWT.LEFT, SWT.LEFT, SWT.CENTER, SWT.CENTER }; for (int i = 0; i < columnIndex.length; i++) { TableViewerColumn choice = new TableViewerColumn(tableViewer, SWT.BORDER); choice.getColumn().setText(columnIndex[i]); choice.getColumn().setWidth(columnWidth[i]); choice.getColumn().setAlignment(columnAlign[i]); } tableViewer.getTable().setHeaderVisible(true); tableViewer.getTable().setLinesVisible(true); GridData gd = new GridData(GridData.FILL_BOTH); gd.horizontalSpan = 4; tableViewer.getTable().setLayoutData(gd); tableViewer.setContentProvider(new ArrayContentProvider()); tableViewer.setLabelProvider(new TableColumnLabelProvider()); tableViewer.setInput(model.getColumns()); }
private void createColumns(final TableViewer tableViewer) { final String[] titles = { "Icon", "Name", "Small", "Medium", "Large", "Source", "Class" }; final int[] bounds = { 40, 200, 60, 60, 60, 200, 200 }; for (int i = 0; i < titles.length; i++) { final TableViewerColumn viewerColumn = new TableViewerColumn(tableViewer, SWT.NONE); tableViewer.setSorter(new TableViewerSorter(titles)); viewerColumn.setLabelProvider(new TableCellLabelProvider()); final TableColumn column = viewerColumn.getColumn(); column.addSelectionListener(new ColumnSelectionListener(column, tableViewer)); column.setText(titles[i]); column.setWidth(bounds[i]); column.setResizable(true); column.setMoveable(false); } final Table table = tableViewer.getTable(); table.setHeaderVisible(true); table.setLinesVisible(true); ColumnViewerToolTipSupport.enableFor(tableViewer, ToolTip.RECREATE); }
private void createColumns(final TableViewer tableViewer) { final String[] titles = { "Relation", "Type", "Name" }; final int[] bounds = { 120, 100, 200 }; for (int i = 0; i < titles.length; i++) { final TableViewerColumn viewerColumn = new TableViewerColumn(tableViewer, SWT.NONE); tableViewer.setSorter(new TableViewerSorter(titles)); viewerColumn.setLabelProvider(new TableCellLabelProvider()); final TableColumn column = viewerColumn.getColumn(); column.addSelectionListener(new ColumnSelectionListener(column, tableViewer)); column.setText(titles[i]); column.setWidth(bounds[i]); column.setResizable(true); column.setMoveable(false); } final Table table = tableViewer.getTable(); table.setHeaderVisible(true); table.setLinesVisible(true); ColumnViewerToolTipSupport.enableFor(tableViewer, ToolTip.RECREATE); // Object[] projectsToSelect = openProjects.toArray(); // IViewPart view = window.getActivePage().showView( "org.eclipse.jdt.ui.PackageExplorer" ); // view.getSite().getSelectionProvider().setSelection( new StructuredSelection( projectsToSelect ) ); }
private void createColumns(final TableViewer tableViewer) { final String[] titles = { "Class" }; final int[] bounds = { 120, 100, 200 }; for (int i = 0; i < titles.length; i++) { final TableViewerColumn viewerColumn = new TableViewerColumn(tableViewer, SWT.NONE); tableViewer.setSorter(new TableViewerSorter(titles)); viewerColumn.setLabelProvider(new TableCellLabelProvider()); final TableColumn column = viewerColumn.getColumn(); column.addSelectionListener(new ColumnSelectionListener(column, tableViewer)); column.setText(titles[i]); column.setWidth(bounds[i]); column.setResizable(true); column.setMoveable(false); } final Table table = tableViewer.getTable(); table.setHeaderVisible(true); table.setLinesVisible(true); ColumnViewerToolTipSupport.enableFor(tableViewer, ToolTip.RECREATE); }
public ColumnViewerSorter(ColumnViewer viewer, TableViewerColumn column) { this.column = column; this.viewer = viewer; this.column.getColumn().addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if( ColumnViewerSorter.this.viewer.getComparator() != null ) { if( ColumnViewerSorter.this.viewer.getComparator() == ColumnViewerSorter.this ) { int tdirection = ColumnViewerSorter.this.direction; if( tdirection == ASC ) { setSorter(ColumnViewerSorter.this, DESC); } else if( tdirection == DESC ) { setSorter(ColumnViewerSorter.this, NONE); } } else { setSorter(ColumnViewerSorter.this, ASC); } } else { setSorter(ColumnViewerSorter.this, ASC); } } }); }
private void createColumn(int idx, int align) { TableViewerColumn viewerColumn = new TableViewerColumn(viewer, align, idx); viewerColumn.setEditingSupport(new TableEditingSupport(viewer, idx)); viewerColumn.setLabelProvider(new ColumnLabelProvider() { private int col = idx; public String getText(Object element) { if (element instanceof Row) { return ((Row) element).data[col]; } return super.getText(element); } }); TableColumn column = viewerColumn.getColumn(); column.setResizable(true); column.setMoveable(true); column.setText(tableModel.headers[idx]); int width = convertWidthInCharsToPixels(tableModel.colWidths[idx]); width = Math.max(width, 50); column.setWidth(width); }
private TableViewerColumn createTableViewerColumn(String title, int width, int alignment, boolean resizable, boolean moveable, final boolean isNumber) { final TableViewerColumn viewerColumn = new TableViewerColumn(tableViewer, SWT.NONE); final TableColumn column = viewerColumn.getColumn(); column.setText(title); column.setAlignment(alignment); column.setMoveable(moveable); tableColumnLayout.setColumnData(column, new ColumnWeightData(width, width, resizable)); column.setData("isNumber", isNumber); column.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { ColumnLabelSorter sorter = (ColumnLabelSorter) tableViewer.getComparator(); TableColumn selectedColumn = (TableColumn) e.widget; sorter.setColumn(selectedColumn); } }); return viewerColumn; }
private TableViewerColumn createTableViewerColumn(String title, int width, int alignment, boolean resizable, boolean moveable, final boolean isNumber) { final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE); final TableColumn column = viewerColumn.getColumn(); column.setText(title); column.setAlignment(alignment); column.setMoveable(moveable); tableColumnLayout.setColumnData(column, new ColumnWeightData(width, 20, resizable)); column.setData("isNumber", isNumber); column.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { ColumnLabelSorter sorter = (ColumnLabelSorter) viewer.getComparator(); sorter.setColumn(column); } }); return viewerColumn; }
private TableViewerColumn createTableViewerColumn(String title, int width, int alignment, boolean resizable, boolean moveable, final boolean isNumber) { final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE); final TableColumn column = viewerColumn.getColumn(); column.setText(title); column.setAlignment(alignment); column.setMoveable(moveable); tableColumnLayout.setColumnData(column, new ColumnWeightData(width, 10, resizable)); column.setData("isNumber", isNumber); column.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { ColumnLabelSorter sorter = (ColumnLabelSorter) viewer.getComparator(); TableColumn selectedColumn = (TableColumn) e.widget; sorter.setColumn(selectedColumn); } }); return viewerColumn; }
private TableViewerColumn createTableViewerColumn(String title, int width, int alignment, boolean resizable, boolean moveable, final boolean isNumber) { final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE); final TableColumn column = viewerColumn.getColumn(); column.setText(title); column.setAlignment(alignment); column.setMoveable(moveable); tableColumnLayout.setColumnData(column, new ColumnWeightData(width, width, resizable)); column.setData("isNumber", isNumber); column.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { ColumnLabelSorter sorter = (ColumnLabelSorter) viewer.getComparator(); TableColumn selectedColumn = (TableColumn) e.widget; sorter.setColumn(selectedColumn); } }); return viewerColumn; }
private TableViewerColumn createTableViewerColumn(String title, int width, int alignment, boolean resizable, boolean moveable, final boolean isNumber) { final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE); final TableColumn column = viewerColumn.getColumn(); column.setText(title); column.setAlignment(alignment); column.setMoveable(moveable); tableColumnLayout.setColumnData(column, new ColumnWeightData(30, width, resizable)); column.setData("isNumber", isNumber); column.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { ColumnLabelSorter sorter = (ColumnLabelSorter) viewer.getComparator(); TableColumn selectedColumn = (TableColumn) e.widget; sorter.setColumn(selectedColumn); } }); return viewerColumn; }
private TableViewerColumn createTableViewerColumn(String title, int weight, int alignment, boolean resizable, boolean moveable, final boolean isNumber) { final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE); final TableColumn column = viewerColumn.getColumn(); column.setText(title); column.setAlignment(alignment); column.setMoveable(moveable); tableColumnLayout.setColumnData(column, new ColumnWeightData(weight, 10, resizable)); column.setData("isNumber", isNumber); column.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { ColumnLabelSorter sorter = (ColumnLabelSorter) viewer.getComparator(); TableColumn selectedColumn = (TableColumn) e.widget; sorter.setColumn(selectedColumn); } }); return viewerColumn; }
private TableViewerColumn createTableViewerColumn(String title, int width, int alignment, final boolean isNumber) { final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE); final TableColumn column = viewerColumn.getColumn(); column.setText(title); column.setAlignment(alignment); tableColumnLayout.setColumnData(column, new ColumnWeightData(30, width, true)); column.setData("isNumber", isNumber); column.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { ColumnLabelSorter sorter = (ColumnLabelSorter) viewer.getComparator(); TableColumn selectedColumn = (TableColumn) e.widget; sorter.setColumn(selectedColumn); } }); return viewerColumn; }
private TableViewerColumn createTableViewerColumn(String title, int width, int alignment, boolean resizable, boolean moveable, final boolean isNumber) { final TableViewerColumn viewerColumn = new TableViewerColumn(tableViewer, SWT.NONE); final TableColumn column = viewerColumn.getColumn(); column.setText(title); column.setAlignment(alignment); column.setMoveable(moveable); tableColumnLayout.setColumnData(column, new ColumnWeightData(width, width, resizable)); column.setData("isNumber", isNumber); column.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { TableLabelSorter sorter = (TableLabelSorter) tableViewer.getComparator(); TableColumn selectedColumn = (TableColumn) e.widget; sorter.setColumn(selectedColumn); } }); return viewerColumn; }
private TableViewerColumn createTableViewerColumn(String title, int width, int alignment, boolean resizable, boolean moveable, final boolean isNumber) { final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE); final TableColumn column = viewerColumn.getColumn(); column.setText(title); column.setAlignment(alignment); column.setMoveable(moveable); tableColumnLayout.setColumnData(column, new ColumnWeightData(30, width, resizable)); column.setData("isNumber", isNumber); column.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { ColumnLabelSorter sorter = (ColumnLabelSorter) viewer.getComparator(); sorter.setColumn(column); } }); return viewerColumn; }
private TableViewerColumn createTableViewerColumn(String title, int width, int alignment, boolean resizable, boolean moveable, final boolean isNumber) { final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE); final TableColumn column = viewerColumn.getColumn(); column.setText(title); column.setAlignment(alignment); column.setMoveable(moveable); tableColumnLayout.setColumnData(column, new ColumnPixelData(width, resizable)); column.setData("isNumber", isNumber); column.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { TableLabelSorter sorter = (TableLabelSorter) viewer.getComparator(); TableColumn selectedColumn = (TableColumn) e.widget; sorter.setColumn(selectedColumn); } }); return viewerColumn; }
protected TableViewerColumn createTableViewerColumn(String title, int width, int alignment, boolean resizable, boolean moveable, final boolean isNumber) { final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE); final TableColumn column = viewerColumn.getColumn(); column.setText(title); column.setAlignment(alignment); column.setMoveable(moveable); tableColumnLayout.setColumnData(column, new ColumnWeightData(30, width, resizable)); column.setData("isNumber", isNumber); column.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { ColumnLabelSorter sorter = (ColumnLabelSorter) viewer.getComparator(); TableColumn selectedColumn = (TableColumn) e.widget; sorter.setColumn(selectedColumn); } }); return viewerColumn; }
protected TableViewerColumn createTableViewerColumn(String title, int width, int alignment, final boolean isNumber) { final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE); final TableColumn column = viewerColumn.getColumn(); column.setText(title); column.setAlignment(alignment); column.setMoveable(true); tableColumnLayout.setColumnData(column, new ColumnPixelData(width, true)); column.setData("isNumber", isNumber); column.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { ColumnLabelSorter sorter = (ColumnLabelSorter) viewer.getComparator(); TableColumn selectedColumn = (TableColumn) e.widget; sorter.setColumn(selectedColumn); } }); return viewerColumn; }
private void createColumns(final Composite parent, final TableViewer viewer) { TableViewerColumn viewerColumn1 = new TableViewerColumn(viewer, SWT.NONE); TableColumn column1 = viewerColumn1.getColumn(); column1.setText(Activator.getResourceString("easyshell.menu.page.header.title.column0")); column1.setWidth(200); column1.setResizable(true); column1.setMoveable(true); TableViewerColumn viewerColumn2 = new TableViewerColumn(viewer, SWT.NONE); TableColumn column2 = viewerColumn2.getColumn(); column2.setText(Activator.getResourceString("easyshell.menu.page.header.title.column1")); column2.setWidth(400); column2.setResizable(true); column2.setMoveable(true); }
private void createColumns(final Composite parent, final TableViewer viewer) { String[] titles = { Activator.getResourceString("easyshell.command.page.header.title.column0"), Activator.getResourceString("easyshell.command.page.header.title.column1"), Activator.getResourceString("easyshell.command.page.header.title.column2"), Activator.getResourceString("easyshell.command.page.header.title.column3") }; int[] bounds = { 100, 100, 80, 400 }; // create for (int i=0;i<titles.length;i++) { TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE); TableColumn column = viewerColumn.getColumn(); column.setText(titles[i]); column.setWidth(bounds[i]); column.setResizable(true); column.setMoveable(true); } }
private TableViewer createPropertiesTable(Composite parent) { Composite cmpItemPropertiesTableViewer=new Composite(parent, SWT.NONE); cmpItemPropertiesTableViewer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true,1,3)); TableColumnLayout tl_itemPropertiesTableViewer = new TableColumnLayout(); cmpItemPropertiesTableViewer.setLayout(tl_itemPropertiesTableViewer); TableViewer tv = new TableViewer(cmpItemPropertiesTableViewer,SWT.BORDER | SWT.V_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION); tv.getTable().setHeaderVisible(true); tv.getTable().setLinesVisible(true); TableViewerColumn tvcName = new TableViewerColumn(tv, SWT.NONE); tvcName.getColumn().setText(Messages.SPCVItemPropertiesList_ColName); tvcName.setLabelProvider(new ItemPropertyNameLabelProvider()); tl_itemPropertiesTableViewer.setColumnData(tvcName.getColumn(), new ColumnWeightData(1, ColumnWeightData.MINIMUM_WIDTH, true)); TableViewerColumn tvcValue = new TableViewerColumn(tv, SWT.NONE); tvcValue.getColumn().setText(Messages.SPCVItemPropertiesList_ColValue); tvcValue.setLabelProvider(new ItemPropertyValueLabelProvider()); tl_itemPropertiesTableViewer.setColumnData(tvcValue.getColumn(), new ColumnWeightData(1, ColumnWeightData.MINIMUM_WIDTH, true)); tv.setContentProvider(new ArrayContentProvider()); return tv; }
private TableViewer createPropertiesTable(Composite parent) { Composite cmpItemPropertiesTableViewer=new Composite(parent, SWT.NONE); cmpItemPropertiesTableViewer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true,1,3)); TableColumnLayout tl_itemPropertiesTableViewer = new TableColumnLayout(); cmpItemPropertiesTableViewer.setLayout(tl_itemPropertiesTableViewer); TableViewer tv = new TableViewer(cmpItemPropertiesTableViewer,SWT.BORDER | SWT.V_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION); tv.getTable().setHeaderVisible(true); tv.getTable().setLinesVisible(true); TableViewerColumn tvcName = new TableViewerColumn(tv, SWT.NONE); tvcName.getColumn().setText(Messages.ElementItemDialog_NameColumn); tvcName.setLabelProvider(getItemPropertyNameLabelProvider()); tl_itemPropertiesTableViewer.setColumnData(tvcName.getColumn(), new ColumnWeightData(1, ColumnWeightData.MINIMUM_WIDTH, true)); TableViewerColumn tvcValue = new TableViewerColumn(tv, SWT.NONE); tvcValue.getColumn().setText(Messages.ElementItemDialog_ValueColumn); tvcValue.setLabelProvider(getItemPropertyValueLabelProvider()); tl_itemPropertiesTableViewer.setColumnData(tvcValue.getColumn(), new ColumnWeightData(1, ColumnWeightData.MINIMUM_WIDTH, true)); tv.setContentProvider(new ArrayContentProvider()); return tv; }
/** * */ void updateTableFromTextEditor() { model.removeModelListener(csvFileListener); model.setInput(editor.getDocumentProvider().getDocument(editor.getEditorInput()).get()); final TableColumn[] columns = tableViewer.getTable().getColumns(); for (final TableColumn c : columns) { c.dispose(); } for (int i = 0; i < model.getHeader().size(); i++) { final TableViewerColumn column = new TableViewerColumn(tableViewer, SWT.LEFT); final int index = i; column.getColumn().setText(model.getHeader().get(i)); column.getColumn().setWidth(100); column.getColumn().setResizable(true); column.getColumn().setMoveable(true); column.setLabelProvider(new CSVLabelProvider()); addMenuItemToColumn(column.getColumn(), index); } tableViewer.setInput(model); model.addModelListener(csvFileListener); defineCellEditing(); }
/** * Column: Show only the checkbox */ private void defineColumn_10_Checkbox() { final TableViewerColumn tvc = new TableViewerColumn(_colorViewer, SWT.LEAD); final TableColumn tc = tvc.getColumn(); tc.setWidth(_pc.convertWidthInCharsToPixels(COLUMN_WITH_NAME)); tvc.setLabelProvider(new CellLabelProvider() { @Override public void update(final ViewerCell cell) { final Object element = cell.getElement(); if (element instanceof Map3GradientColorProvider) { final Map3ColorProfile colorProfile = ((Map3GradientColorProvider) (element)).getMap3ColorProfile(); cell.setText(colorProfile.getProfileName()); } } }); }
/** * Column: Color image */ private void defineColumn_30_ColorImage() { final TableViewerColumn tvc = new TableViewerColumn(_colorViewer, SWT.LEAD); final TableColumn tc = tvc.getColumn(); tc.setWidth(_pc.convertWidthInCharsToPixels(COLUMN_WITH_COLOR_IMAGE)); _tcProfileImage = tc; _columnIndexProfileImage = _colorViewer.getTable().getColumnCount() - 1; tc.addControlListener(new ControlAdapter() { @Override public void controlResized(final ControlEvent e) { onResizeImageColumn(); } }); tvc.setLabelProvider(new CellLabelProvider() { // !!! set dummy label provider, otherwise an error occures !!! @Override public void update(final ViewerCell cell) {} }); }
/** * Column: Description */ private void defineColumn_Description(final TableColumnLayout tableLayout) { final TableViewerColumn tvc = new TableViewerColumn(_markerViewer, SWT.CENTER); final TableColumn tc = tvc.getColumn(); tc.setText(Messages.Tour_Marker_Column_Description_ShortCut); tc.setToolTipText(Messages.Tour_Marker_Column_Description_Tooltip); tvc.setLabelProvider(new CellLabelProvider() { @Override public void update(final ViewerCell cell) { final TourMarker tourMarker = (TourMarker) cell.getElement(); final String description = tourMarker.getDescription(); cell.setText(description.length() == 0 ? UI.EMPTY_STRING : UI.SYMBOL_STAR); } }); tableLayout.setColumnData(tc, new ColumnPixelData(_pc.convertWidthInCharsToPixels(4), false)); }
/** * column: marker */ private void defineColumn_IsVisible(final TableColumnLayout tableLayout) { final TableViewerColumn tvc = new TableViewerColumn(_markerViewer, SWT.LEAD); final TableColumn tc = tvc.getColumn(); tc.setText(TOUR_MARKER_COLUMN_IS_VISIBLE); tc.setToolTipText(TOUR_MARKER_COLUMN_IS_VISIBLE_TOOLTIP); tvc.setEditingSupport(new MarkerEditingSupport(_markerViewer)); tvc.setLabelProvider(new CellLabelProvider() { @Override public void update(final ViewerCell cell) { final TourMarker tourMarker = (TourMarker) cell.getElement(); cell.setText(tourMarker.isMarkerVisible() ? Messages.App_Label_BooleanYes : Messages.App_Label_BooleanNo); } }); tableLayout.setColumnData(tc, new ColumnPixelData(_pc.convertWidthInCharsToPixels(8), false)); }
/** * column: marker */ private void defineColumn_Marker(final TableColumnLayout tableLayout) { final TableViewerColumn tvc = new TableViewerColumn(_markerViewer, SWT.LEAD); final TableColumn tc = tvc.getColumn(); tc.setText(Messages.Tour_Marker_Column_remark); tvc.setLabelProvider(new CellLabelProvider() { @Override public void update(final ViewerCell cell) { final TourMarker tourMarker = (TourMarker) cell.getElement(); cell.setText(tourMarker.getLabel()); } }); tableLayout.setColumnData(tc, new ColumnWeightData(1, true)); }