Java Code Examples for org.eclipse.jface.viewers.TableViewer#setColumnProperties()
The following examples show how to use
org.eclipse.jface.viewers.TableViewer#setColumnProperties() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ModuleTableViewer.java From hybris-commerce-eclipse-plugin with Apache License 2.0 | 6 votes |
private void createTableViewer() { tableViewer = new TableViewer(table); tableViewer.setUseHashlookup(true); tableViewer.setColumnProperties(columnNames); // Create the cell editors CellEditor[] editors = new CellEditor[columnNames.length]; // Column 1 : nothing editors[0] = null; // Columns 2 : checkbox editors[1] = new CheckboxCellEditor(table); // Assign the cell editors to the viewer tableViewer.setCellEditors(editors); // Set the cell modifier for the viewer tableViewer.setCellModifier(new ExtensionCellModifier(this)); }
Example 2
Source File: ModuleTableViewer.java From hybris-commerce-eclipse-plugin with Apache License 2.0 | 6 votes |
private void createTableViewer() { tableViewer = new TableViewer(table); tableViewer.setUseHashlookup(true); tableViewer.setColumnProperties(columnNames); // Create the cell editors CellEditor[] editors = new CellEditor[columnNames.length]; // Column 1 : nothing editors[0] = null; // Columns 2,3,4 : checkboxes editors[1] = new CheckboxCellEditor(table); editors[2] = new CheckboxCellEditor(table); editors[3] = new CheckboxCellEditor(table); // Assign the cell editors to the viewer tableViewer.setCellEditors(editors); // Set the cell modifier for the viewer tableViewer.setCellModifier(new ExtensionCellModifier(this)); // Set the default sorter for the viewer //tableViewer.setSorter(new ExtensionSorter(ExtensionSorter.NAME)); }
Example 3
Source File: SortingFormPropertyDescriptor.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * Creates the TableViewer and set all kinds of processors. * */ private void createTableViewer( ) { tableViewer = new TableViewer( table ); tableViewer.setUseHashlookup( true ); tableViewer.setColumnProperties( ( (ISortingFormProvider) getDescriptorProvider( ) ).getColumnNames( ) ); tableViewer.setContentProvider( ( (AbstractSortingFormHandleProvider) getDescriptorProvider( ) ).getFormContentProvider( this, getDescriptorProvider( ) ) ); tableViewer.setLabelProvider( new FormLabelProvider( ) ); }
Example 4
Source File: SortingFormPage.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * Creates the TableViewer and set all kinds of processors. * */ private void createTableViewer( ) { tableViewer = new TableViewer( table ); tableViewer.setUseHashlookup( true ); tableViewer.setColumnProperties( provider.getColumnNames( ) ); tableViewer.setContentProvider( new FormContentProvider( ) ); tableViewer.setLabelProvider( new FormLabelProvider( ) ); }
Example 5
Source File: FormPage.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * Creates the TableViewer and set all kinds of processors. * */ private void createTableViewer( ) { tableViewer = new TableViewer( table ); tableViewer.setUseHashlookup( true ); tableViewer.setColumnProperties( provider.getColumnNames( ) ); tableViewer.setCellEditors( provider.getEditors( table ) ); tableViewer.setContentProvider( new FormContentProvider( ) ); tableViewer.setLabelProvider( new FormLabelProvider( ) ); tableViewer.setCellModifier( new FormCellModifier( ) ); }
Example 6
Source File: ElementNamesConfigurationBlock.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * create a tableview for the existed table * */ private void createTableViewer( ) { tableViewer = new TableViewer( table ); tableViewer.setUseHashlookup( true ); tableViewer.setColumnProperties( elementNames ); // Create the cell editors CellEditor[] editors = new CellEditor[elementNames.length]; for ( int i = 0; i < elementNames.length; i++ ) { TextCellEditor textEditor = new TextCellEditor( table ); ( (Text) textEditor.getControl( ) ).setTextLimit( 60 ); if ( i == 1 ) { // assure that the CUSTOM NAME column doesn't contain // ReportPlugin.PREFERENCE_DELIMITER ( (Text) textEditor.getControl( ) ).addVerifyListener( new VerifyListener( ) { public void verifyText( VerifyEvent e ) { e.doit = e.text.indexOf( ReportPlugin.PREFERENCE_DELIMITER ) < 0; } } ); } editors[i] = textEditor; } // Assign the cell editors to the viewer tableViewer.setCellEditors( editors ); // Set the cell modifier for the viewer tableViewer.setCellModifier( new ElementNamesCellModifier( this ) ); }
Example 7
Source File: FormPage.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * Creates the TableViewer and set all kinds of processors. * */ private void createTableViewer( ) { tableViewer = new TableViewer( table ); tableViewer.setUseHashlookup( true ); tableViewer.setColumnProperties( provider.getColumnNames( ) ); tableViewer.setCellEditors( provider.getEditors( table ) ); tableViewer.setContentProvider( new FormContentProvider( ) ); tableViewer.setLabelProvider( new FormLabelProvider( ) ); tableViewer.setCellModifier( new FormCellModifier( ) ); }
Example 8
Source File: ReportItemParametersDialog.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * Creates the TableViewer and set all kinds of processors. */ private void createTableViewer( ) { tableViewer = new TableViewer( table ); tableViewer.setUseHashlookup( true ); tableViewer.setColumnProperties( columnNames ); expressionCellEditor = new ExpressionDialogCellEditor( table ); tableViewer.setCellEditors( new CellEditor[]{ null, null, expressionCellEditor } ); tableViewer.setContentProvider( new BindingContentProvider( ) ); tableViewer.setLabelProvider( new BindingLabelProvider( ) ); tableViewer.setCellModifier( new BindingCellModifier( ) ); }
Example 9
Source File: RemapTable.java From depan with Apache License 2.0 | 5 votes |
private Control setupControl(Composite parent) { Composite topLevel = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); topLevel.setLayout(layout); tableViewer = new TableViewer(topLevel, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL); Table tableData = tableViewer.getTable(); tableData.setHeaderVisible(true); EditColTableDef.setupTable(TABLE_DEF, tableData); CellEditor[] cellEditors = new CellEditor[4]; cellEditors[0] = null; cellEditors[1] = null; cellEditors[2] = new TextCellEditor(tableData); cellEditors[3] = new TextCellEditor(tableData); tableViewer.setCellEditors(cellEditors); tableViewer.setColumnProperties(EditColTableDef.getProperties(TABLE_DEF)); RemapTableHelper cellHelper = new RemapTableHelper(); tableViewer.setLabelProvider(cellHelper); tableData.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); remapContent = new TableContentProvider<MigrationRule<?>>(); remapContent.initViewer(tableViewer); return topLevel; }
Example 10
Source File: FormPropertyDescriptor.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * Creates the TableViewer and set all kinds of processors. * */ private void createTableViewer( ) { tableViewer = new TableViewer( table ); tableViewer.setUseHashlookup( true ); tableViewer.setColumnProperties( ( (IFormProvider) getDescriptorProvider( ) ).getColumnNames( ) ); CellEditor[] editors = ( (IFormProvider) getDescriptorProvider( ) ).getEditors( table ); if ( editors != null && editors.length > 0 ) { tableViewer.setCellEditors( ( (IFormProvider) getDescriptorProvider( ) ).getEditors( table ) ); tableViewer.setCellModifier( new FormCellModifier( ) ); } else { tableViewer.setCellModifier( new FormCellModifier( ) { public boolean canModify( Object element, String property ) { return false; } } ); } tableViewer.setContentProvider( ( (AbstractFormHandleProvider) getDescriptorProvider( ) ).getFormContentProvider( this, getDescriptorProvider( ) ) ); tableViewer.setLabelProvider( new FormLabelProvider( ) ); }
Example 11
Source File: EdgeMatcherTableControl.java From depan with Apache License 2.0 | 5 votes |
public EdgeMatcherTableControl(Composite parent) { super(parent, SWT.NONE); setLayout(Widgets.buildContainerLayout(1)); viewer = new TableViewer(this, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL); // Layout embedded table Table relationTable = viewer.getTable(); relationTable.setLayoutData(Widgets.buildGrabFillData()); // initialize the table relationTable.setHeaderVisible(true); relationTable.setToolTipText("Edge Matcher Definition"); EditColTableDef.setupTable(TABLE_DEF, relationTable); CellEditor[] cellEditors = new CellEditor[TABLE_DEF.length]; cellEditors[INDEX_RELATION] = null; cellEditors[INDEX_FORWARD] = new CheckboxCellEditor(relationTable); cellEditors[INDEX_BACKWARD] = new CheckboxCellEditor(relationTable); // cell content viewer.setCellEditors(cellEditors); viewer.setLabelProvider(new CellLabelProvider()); viewer.setColumnProperties(EditColTableDef.getProperties(TABLE_DEF)); viewer.setCellModifier(new CellModifier()); viewer.setContentProvider(ArrayContentProvider.getInstance()); viewer.setComparator(new AlphabeticSorter(new ViewerObjectToString() { @Override public String getString(Object object) { if (object instanceof Relation) { return ((Relation) object).toString(); } return object.toString(); } })); }
Example 12
Source File: RelationDisplayTableControl.java From depan with Apache License 2.0 | 5 votes |
public RelationDisplayTableControl(Composite parent) { super(parent, SWT.NONE); setLayout(Widgets.buildContainerLayout(1)); propViewer = new TableViewer(this, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER | SWT.V_SCROLL); // Layout embedded table Table propTable = propViewer.getTable(); propTable.setLayoutData(Widgets.buildGrabFillData()); // initialize the table propTable.setHeaderVisible(true); propTable.setToolTipText("Relations Display Properties"); EditColTableDef.setupTable(TABLE_DEF, propTable); // Configure cell editing CellEditor[] cellEditors = new CellEditor[TABLE_DEF.length]; cellEditors[INDEX_NAME] = null; cellEditors[INDEX_SOURCE] = null; cellEditors[INDEX_COLOR] = new ColorCellEditor(propTable); cellEditors[INDEX_STYLE] = new ComboBoxCellEditor(propTable, toString(EdgeDisplayProperty.LineStyle.values(), true)); cellEditors[INDEX_ARROWHEAD] = new ComboBoxCellEditor(propTable, toString(EdgeDisplayProperty.ArrowheadStyle.values(), true)); propViewer.setCellEditors(cellEditors); propViewer.setLabelProvider(new EdgeDisplayLabelProvider()); propViewer.setColumnProperties(EditColTableDef.getProperties(TABLE_DEF)); propViewer.setCellModifier(new EdgeDisplayCellModifier()); // TODO: Add column sorters, filters? configSorters(propTable); // Configure content last: use updateTable() to render relations propViewer.setContentProvider(ArrayContentProvider.getInstance()); }
Example 13
Source File: EdgeDisplayTableControl.java From depan with Apache License 2.0 | 5 votes |
public EdgeDisplayTableControl(Composite parent) { super(parent, SWT.NONE); setLayout(Widgets.buildContainerLayout(1)); propViewer = new TableViewer(this, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER | SWT.V_SCROLL); // Layout embedded table Table propTable = propViewer.getTable(); propTable.setLayoutData(Widgets.buildGrabFillData()); // initialize the table propTable.setHeaderVisible(true); propTable.setToolTipText("Edge Display Properties"); EditColTableDef.setupTable(TABLE_DEF, propTable); // Configure cell editing CellEditor[] cellEditors = new CellEditor[TABLE_DEF.length]; cellEditors[INDEX_NAME] = null; cellEditors[INDEX_HEAD] = null; cellEditors[INDEX_TAIL] = null; cellEditors[INDEX_COLOR] = new ColorCellEditor(propTable); cellEditors[INDEX_STYLE] = new ComboBoxCellEditor(propTable, toString(EdgeDisplayProperty.LineStyle.values(), true)); cellEditors[INDEX_ARROWHEAD] = new ComboBoxCellEditor(propTable, toString(EdgeDisplayProperty.ArrowheadStyle.values(), true)); propViewer.setCellEditors(cellEditors); propViewer.setLabelProvider(new EdgeDisplayLabelProvider()); propViewer.setColumnProperties(EditColTableDef.getProperties(TABLE_DEF)); propViewer.setCellModifier(new EdgeDisplayCellModifier()); propViewer.setContentProvider(ArrayContentProvider.getInstance()); configSorters(propTable); }
Example 14
Source File: NodeKindTableControl.java From depan with Apache License 2.0 | 5 votes |
/** * Create the ElementKindPicker, with all the usual sub-controls. * * @param parent containing controls * @param style standard style bits */ public NodeKindTableControl(Composite parent) { super(parent, SWT.NONE); setLayout(Widgets.buildContainerLayout(1)); // Setup selection button bar Composite buttonBar = configButtonBar(this); buttonBar.setLayoutData( new GridData(SWT.LEFT, SWT.CENTER, false, false)); // Configure the table viewer kindViewer = new TableViewer( this, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL); // Set up layout properties. Table elementKindTable = kindViewer.getTable(); elementKindTable.setLayoutData(Widgets.buildGrabFillData()); // Initialize the table. elementKindTable.setHeaderVisible(true); elementKindTable.setToolTipText("Node Kind Selector"); EditColTableDef.setupTable(TABLE_DEF, elementKindTable); // Configure the table viewer kindViewer.setLabelProvider(LABEL_PROVIDER); kindViewer.setColumnProperties(EditColTableDef.getProperties(TABLE_DEF)); configSorters(elementKindTable); setSortColumn(elementKindTable.getColumn(0), 0, SWT.DOWN); kindViewer.setContentProvider(new ArrayContentProvider()); }
Example 15
Source File: FilterTableControl.java From depan with Apache License 2.0 | 5 votes |
public FilterTableControl(Composite parent) { super(parent, SWT.NONE); setLayout(Widgets.buildContainerLayout(1)); filterViewer = new TableViewer(this, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI ); // Set up layout properties. Table filterTable = filterViewer.getTable(); filterTable.setLayoutData(Widgets.buildGrabFillData()); // Initialize the table. filterTable.setHeaderVisible(true); filterTable.setToolTipText("Node Filter Editor"); EditColTableDef.setupTable(TABLE_DEF, filterTable); CellEditor[] cellEditors = new CellEditor[TABLE_DEF.length]; cellEditors[INDEX_NAME] = new TextCellEditor(filterTable); cellEditors[INDEX_SUMMARY] = new NodeFilterCellEditor(filterTable); // Configure table properties. filterViewer.setCellEditors(cellEditors); filterViewer.setLabelProvider(LABEL_PROVIDER); filterViewer.setColumnProperties(EditColTableDef.getProperties(TABLE_DEF)); filterViewer.setCellModifier(new ControlCellModifier()); // Since the order is significant, no sorting capabilities. // Avoid setInput() invocations that come with // TableContentProvider.initViewer filterViewer.setContentProvider(ArrayContentProvider.getInstance()); }
Example 16
Source File: EnvironmentVariablesTable.java From Eclipse-Environment-Variables with MIT License | 5 votes |
public EnvironmentVariablesTable(final Composite parent) { super(parent, SWT.NONE); final TableColumnLayout tableColumnLayout = new TableColumnLayout(); setLayout(tableColumnLayout); labelProvider = new TableLabelProvider(); viewer = new TableViewer(this, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); viewer.setColumnProperties(new String[] { getKeyName(), getValueName() }); table = viewer.getTable(); table.setLinesVisible(true); table.setHeaderVisible(true); viewer.setLabelProvider(labelProvider); try { viewer.setContentProvider(new TableContentProvider(vars)); } catch (final Exception e) { // noop } createColumns(tableColumnLayout, viewer.getTable()); final CellEditor[] editors = new CellEditor[] { new TextCellEditor(table), new TextCellEditor(table) }; // Assign the cell editors to the viewer viewer.setCellEditors(editors); viewer.setCellModifier(new TableCellModifier(viewer)); }
Example 17
Source File: ValidationPreferencePage.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
private Control createValidators(Composite parent) { Composite main = new Composite(parent, SWT.NONE); main.setLayout(GridLayoutFactory.fillDefaults().spacing(0, 0).create()); Composite labelComp = new Composite(main, SWT.NONE); labelComp.setLayout(GridLayoutFactory.fillDefaults().extendedMargins(5, 0, 0, 0).numColumns(2) .spacing(2, SWT.DEFAULT).create()); labelComp.setLayoutData(GridDataFactory.swtDefaults().grab(true, false).create()); Label label = new Label(labelComp, SWT.NONE); label.setText(Messages.ValidationPreferencePage_LBL_Validators); Label helpImage = new Label(labelComp, SWT.NONE); helpImage.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_LCL_LINKTO_HELP)); helpImage.setToolTipText(Messages.ValidationPreferencePage_EnablingValidatorWarning); Group group = new Group(main, SWT.NONE); group.setLayout(GridLayoutFactory.swtDefaults().margins(4, 4).create()); group.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); Table table = new Table(group, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); table.setLayoutData(GridDataFactory.fillDefaults().hint(300, 100).grab(true, false).create()); table.setLinesVisible(true); table.setHeaderVisible(true); // set up columns // Name column TableColumn name = new TableColumn(table, SWT.LEFT); name.setWidth(250); name.setText(Messages.ValidationPreferencePage_NameColumn); name.setToolTipText(Messages.ValidationPreferencePage_NameColumn); // Build column TableColumn build = new TableColumn(table, SWT.CENTER); build.setWidth(40); build.setText(Messages.ValidationPreferencePage_BuildColumn); build.setToolTipText(Messages.ValidationPreferencePage_BuildColumn); // Reconcile column TableColumn reconcile = new TableColumn(table, SWT.CENTER); reconcile.setWidth(75); reconcile.setText(Messages.ValidationPreferencePage_ReconcileColumn); reconcile.setToolTipText(Messages.ValidationPreferencePage_ReconcileColumn); // Now set up table viewer! validatorsViewer = new TableViewer(table); // validatorsViewer.setUseHashlookup(true); validatorsViewer.setColumnProperties(new String[] { NAME, BUILD, RECONCILE }); // Assign the cell editors to the viewer validatorsViewer.setCellEditors(new CellEditor[] { null, new CheckboxCellEditor(table), new CheckboxCellEditor(table) }); // Set the cell modifier for the viewer validatorsViewer.setCellModifier(new ParticipantCellModifier(validatorsViewer)); // Now set up content/label providers validatorsViewer.setContentProvider(ArrayContentProvider.getInstance()); validatorsViewer.setLabelProvider(new ParticipantLabelProvider()); // Hide required participants validatorsViewer.addFilter(new RequiredParticipantFilter()); // check the selected build participant, show it's filters validatorsViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { updateFilterExpressions(); } }); // Now set input validatorsViewer.setInput(this.participants); return main; }
Example 18
Source File: CrosstabSortKeyBuilder.java From birt with Eclipse Public License 1.0 | 4 votes |
protected void createMemberValuesGroup( Composite content ) { group = new Group( content, SWT.NONE ); group.setText( Messages.getString( "CrosstabSortKeyBuilder.Label.SelColumnMemberValue" ) ); //$NON-NLS-1$ group.setLayout( new GridLayout( ) ); memberValueTable = new Table( group, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION ); memberValueTable.setLinesVisible( true ); memberValueTable.setHeaderVisible( true ); memberValueTable.setLayoutData( new GridData( GridData.FILL_BOTH ) ); GridData gd = new GridData( GridData.FILL_BOTH ); gd.heightHint = 150; gd.horizontalSpan = 3; group.setLayoutData( gd ); dynamicViewer = new TableViewer( memberValueTable ); TableColumn column = new TableColumn( memberValueTable, SWT.LEFT ); column.setText( columns[0] ); column.setWidth( 15 ); TableColumn column1 = new TableColumn( memberValueTable, SWT.LEFT ); column1.setResizable( columns[1] != null ); if ( columns[1] != null ) { column1.setText( columns[1] ); } column1.setWidth( 200 ); TableColumn column2 = new TableColumn( memberValueTable, SWT.LEFT ); column2.setResizable( columns[2] != null ); if ( columns[2] != null ) { column2.setText( columns[2] ); } column2.setWidth( 200 ); dynamicViewer.setColumnProperties( columns ); editor = new ExpressionValueCellEditor( dynamicViewer.getTable( ), SWT.READ_ONLY ); TextCellEditor textEditor = new TextCellEditor( dynamicViewer.getTable( ), SWT.READ_ONLY ); TextCellEditor textEditor2 = new TextCellEditor( dynamicViewer.getTable( ), SWT.READ_ONLY ); CellEditor[] cellEditors = new CellEditor[]{ textEditor, textEditor2, editor }; if ( handle != null ) { editor.setExpressionProvider( new ExpressionProvider( handle ) ); editor.setReportElement( (ExtendedItemHandle) handle ); } dynamicViewer.setCellEditors( cellEditors ); dynamicViewer.setContentProvider( contentProvider ); dynamicViewer.setLabelProvider( labelProvider ); dynamicViewer.setCellModifier( cellModifier ); dynamicViewer.addSelectionChangedListener( selectionChangeListener ); }
Example 19
Source File: CrosstabFilterConditionBuilder.java From birt with Eclipse Public License 1.0 | 4 votes |
protected void createMemberValuesGroup( Composite content ) { group = new Group( content, SWT.NONE ); group.setText( Messages.getString( "CrosstabFilterConditionBuilder.Label.SelColumnMemberValue" ) ); //$NON-NLS-1$ group.setLayout( new GridLayout( ) ); memberValueTable = new Table( group, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION ); memberValueTable.setLinesVisible( true ); memberValueTable.setHeaderVisible( true ); memberValueTable.setLayoutData( new GridData( GridData.FILL_BOTH ) ); GridData gd = new GridData( GridData.FILL_BOTH ); gd.heightHint = 150; gd.horizontalSpan = 3; group.setLayoutData( gd ); dynamicViewer = new TableViewer( memberValueTable ); TableColumn column = new TableColumn( memberValueTable, SWT.LEFT ); column.setText( columns[0] ); column.setWidth( 15 ); TableColumn column1 = new TableColumn( memberValueTable, SWT.LEFT ); column1.setResizable( columns[1] != null ); if ( columns[1] != null ) { column1.setText( columns[1] ); } column1.setWidth( 200 ); TableColumn column2 = new TableColumn( memberValueTable, SWT.LEFT ); column2.setResizable( columns[2] != null ); if ( columns[2] != null ) { column2.setText( columns[2] ); } column2.setWidth( 200 ); dynamicViewer.setColumnProperties( columns ); editor = new ExpressionValueCellEditor( dynamicViewer.getTable( ), SWT.READ_ONLY ); TextCellEditor textEditor = new TextCellEditor( dynamicViewer.getTable( ), SWT.READ_ONLY ); TextCellEditor textEditor2 = new TextCellEditor( dynamicViewer.getTable( ), SWT.READ_ONLY ); CellEditor[] cellEditors = new CellEditor[]{ textEditor, textEditor2, editor }; if ( designHandle != null ) { editor.setExpressionProvider( getCrosstabExpressionProvider( ) ); editor.setReportElement( (ExtendedItemHandle) designHandle ); } dynamicViewer.setCellEditors( cellEditors ); dynamicViewer.setContentProvider( contentProvider ); dynamicViewer.setLabelProvider( labelProvider ); dynamicViewer.setCellModifier( cellModifier ); dynamicViewer.addSelectionChangedListener( selectionChangeListener ); }
Example 20
Source File: TexTableView.java From texlipse with Eclipse Public License 1.0 | 4 votes |
/** * This is a callback that will allow us * to create the viewer and initialize it. */ public void createPartControl(Composite parent) { // Create a composite to hold the children GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_BOTH); parent.setLayoutData(gridData); //only one component... GridLayout layout = new GridLayout(1, false); layout.marginWidth = 4; parent.setLayout(layout); Table table = createTable(parent); viewer = new TableViewer(table); viewer.setUseHashlookup(true); viewer.setColumnProperties(columnNames); viewer.setContentProvider(new ViewContentProvider()); viewer.setLabelProvider(new ViewLabelProvider()); viewer.setInput(rowList); CellEditor[] editors = new CellEditor[TexRow.COLUMNS]; //ICellEditorListeners for (int i = 0; i < TexRow.COLUMNS; i++) { editors[i] = new TextCellEditor(table); ((Text) editors[i].getControl()).setTextLimit(256); editors[i].getControl().addKeyListener( new TexCellListener(viewer, rowList, i)); } // Assign the cell editors to the viewer viewer.setCellEditors(editors); // Set the cell modifier for the viewer viewer.setCellModifier(new TexCellModifier(viewer, rowList)); // Set the default sorter for the viewer //viewer.setSorter(new LaTeXRowSorter(LaTeXRowSorter.COLUMN_1)); }