Java Code Examples for org.eclipse.jface.viewers.TableViewer#setCellModifier()

The following examples show how to use org.eclipse.jface.viewers.TableViewer#setCellModifier() . 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 vote down vote up
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 vote down vote up
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: FormPropertyDescriptor.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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 4
Source File: FormPage.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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 5
Source File: ElementNamesConfigurationBlock.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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 6
Source File: FormPage.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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 7
Source File: ReportItemParametersDialog.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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 8
Source File: RelationSetTableControl.java    From depan with Apache License 2.0 5 votes vote down vote up
public RelationSetTableControl(Composite parent) {
  super(parent, SWT.NONE);
  setLayout(Widgets.buildContainerLayout(1));

  // Layout embedded table
  relSetViewer = new TableViewer(this,
      SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER | SWT.V_SCROLL);

  // Set up layout properties
  Table relSetTable = relSetViewer.getTable();
  relSetTable.setLayoutData(Widgets.buildGrabFillData());

  // initialize the table
  relSetTable.setHeaderVisible(true);
  relSetTable.setToolTipText("List of Relations");
  EditColTableDef.setupTable(TABLE_DEF, relSetTable);

  // Configure cell editing
  CellEditor[] cellEditors = new CellEditor[TABLE_DEF.length];
  cellEditors[INDEX_NAME] = null;
  cellEditors[INDEX_SOURCE] = null;
  cellEditors[INDEX_VISIBLE] = new CheckboxCellEditor(relSetTable);

  // Configure table properties.
  relSetViewer.setCellEditors(cellEditors);
  relSetViewer.setLabelProvider(new ControlLabelProvider());
  relSetViewer.setColumnProperties(EditColTableDef.getProperties(TABLE_DEF));
  relSetViewer.setCellModifier(new ControlCellModifier());
  relSetViewer.setContentProvider(ArrayContentProvider.getInstance());

  configSorters(relSetTable);
}
 
Example 9
Source File: EdgeMatcherTableControl.java    From depan with Apache License 2.0 5 votes vote down vote up
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 10
Source File: RelationDisplayTableControl.java    From depan with Apache License 2.0 5 votes vote down vote up
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 11
Source File: EdgeDisplayTableControl.java    From depan with Apache License 2.0 5 votes vote down vote up
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 12
Source File: FilterTableControl.java    From depan with Apache License 2.0 5 votes vote down vote up
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 13
Source File: EnvironmentVariablesTable.java    From Eclipse-Environment-Variables with MIT License 5 votes vote down vote up
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 14
Source File: ValidationPreferencePage.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
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 15
Source File: CrosstabSortKeyBuilder.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
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 16
Source File: CrosstabFilterConditionBuilder.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
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 17
Source File: TexTableView.java    From texlipse with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * 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));
}