/** DOC sgandon Comment method "createREquiredColumn". */ public void createRequiredColumn() { TableViewerCreatorColumn<ModuleToInstall, Boolean> column = new TableViewerCreatorColumn<ModuleToInstall, Boolean>(tableViewerCreator); column.setTitle( Messages.getString("ExternalModulesInstallDialog_ColumnRequired")); // $NON-NLS-1$ column.setToolTipHeader( Messages.getString("ExternalModulesInstallDialog_ColumnRequired")); // $NON-NLS-1$ column.setDisplayedValue(""); // $NON-NLS-1$ column.setSortable(true); column.setImageProvider( new IColumnImageProvider<ModuleToInstall>() { @Override public Image getImage(ModuleToInstall bean) { if (bean.isRequired()) { return ImageProvider.getImage(EImage.CHECKED_ICON); } else { return ImageProvider.getImage(EImage.UNCHECKED_ICON); } } }); column.setBeanPropertyAccessors( new IBeanPropertyAccessors<ModuleToInstall, Boolean>() { @Override public Boolean get(ModuleToInstall bean) { return bean.isRequired(); } @Override public void set(ModuleToInstall bean, Boolean value) { // read only } }); column.setModifiable(false); column.setWeight(2); }
private void configureAutoIndexColumn( TableViewerCreator<IMetadataColumn> tableViewerCreator, Table table) { TableViewerCreatorColumn<IMetadataColumn, Boolean> column = new TableViewerCreatorColumn<IMetadataColumn, Boolean>(tableViewerCreator); column.setBeanPropertyAccessors( new IBeanPropertyAccessors<IMetadataColumn, Boolean>() { @Override public Boolean get(IMetadataColumn bean) { if (bean instanceof MetadataColumnExt) { MetadataColumnExt columnExt = (MetadataColumnExt) bean; return columnExt.getData().isAutoIndexed(); } return false; } @Override public void set(IMetadataColumn bean, Boolean value) { if (bean instanceof MetadataColumnExt) { MetadataColumnExt columnExt = (MetadataColumnExt) bean; columnExt.getData().setAutoIndexed(value); } } }); String title = "Auto indexed"; // TODO: Internationalize this column.setTitle(title); column.setToolTipHeader(title); column.setModifiable(true); column.setWidth(76); column.setDisplayedValue(""); column.setTableColumnSelectionListener( new CheckColumnSelectionListener(column, tableViewerCreator)); column.setImageHeader(ImageProvider.getImage(EImage.CHECKED_ICON)); CheckboxTableEditorContent checkbox = new CheckboxTableEditorContent(); checkbox.setToolTipText(title); column.setTableEditorContent(checkbox); }