Java Code Examples for org.eclipse.jface.viewers.EditingSupport

The following are top voted examples for showing how to use org.eclipse.jface.viewers.EditingSupport. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: smaccm   File: ChartHelper.java   View source code 6 votes vote down vote up
public void configureKeyTableViewer(final EditingSupport editingSupport) {
	final TableViewer keyTableViewer = (TableViewer)editingSupport.getViewer();
	final TableViewerColumn viewerElementColumn = new TableViewerColumn(keyTableViewer, SWT.LEFT);
	final TableColumn elementColumn = viewerElementColumn.getColumn();
	elementColumn.setText("Y-Axis");

	final TableColumnLayout tableColumnLayout = new TableColumnLayout();
	tableColumnLayout.setColumnData(elementColumn, new ColumnWeightData(1, 175));
	viewerElementColumn.setEditingSupport(editingSupport);
	viewerElementColumn.setLabelProvider(createElementLabelProvider());

	final TableViewerColumn viewerValueColumn = new TableViewerColumn(keyTableViewer, SWT.NONE);
	final TableColumn valueColumn = viewerValueColumn.getColumn();
	valueColumn.setText("Value");
	tableColumnLayout.setColumnData(valueColumn, new ColumnWeightData(2, 140));

	viewerValueColumn.setLabelProvider(createValueLabelProvider());

	keyTableViewer.getTable().getParent().setLayout(tableColumnLayout);
	keyTableViewer.getTable().setLinesVisible(true);
	keyTableViewer.getTable().setHeaderVisible(true);
	keyTableViewer.setUseHashlookup(true);
	keyTableViewer.setInput(yAxisTableItems.add(createYAxisTableItem()));
	keyTableViewer.getTable().getItem(yAxisTableItems.size()-1).setChecked(true);
}
 
Example 2
Project: scenarioo-example-swtbot-e4   File: OrderSearchTableHelper.java   View source code 5 votes vote down vote up
public static void initializeColumns(final TableViewer tableViewer) {

		EditingSupport[] editing_support = { null, null, null, null, null, new ImportEditingSupport(tableViewer) };

		for (int i = 0; i < TITLES.length; i++) {
			TableViewerColumn col = createTableViewerColumn(tableViewer, i);
			EditingSupport editingSupport = editing_support[i];
			if (editingSupport != null) {
				col.setEditingSupport(editingSupport);
			}
		}
	}
 
Example 3
Project: scenarioo-example-swtbot-e4   File: PositionsTableHelper.java   View source code 5 votes vote down vote up
public static void initializeColumns(final TableViewer tableViewer, final ArticleService articleService,
		final Label posAmountErrorMsg) {

	EditingSupport[] editing_support = { null, null, new ArticleEditingSupport(tableViewer, articleService), null,
			new AmountEditingSupport(tableViewer, posAmountErrorMsg), null };

	for (int i = 0; i < TITLES.length; i++) {
		TableViewerColumn col = createTableViewerColumn(tableViewer, i);
		EditingSupport editingSupport = editing_support[i];
		if (editingSupport != null) {
			col.setEditingSupport(editingSupport);
		}
	}
}
 
Example 4
Project: translationstudio8   File: GridViewerColumn.java   View source code 5 votes vote down vote up
/** {@inheritDoc} */
public void setEditingSupport(EditingSupport editingSupport)
{
    if (editingSupport instanceof CheckEditingSupport)
    {
        if (checkEditingSupport == null)
        {
            final int colIndex = getColumn().getParent().indexOf(getColumn());
            
            getColumn().getParent().addListener(SWT.Selection, new Listener()
            {                
                public void handleEvent(Event event)
                {                         
                    if (event.detail == SWT.CHECK && event.index == colIndex)
                    {
                        GridItem item = (GridItem)event.item;
                        Object element = item.getData();
                        checkEditingSupport.setValue(element, new Boolean(item.getChecked(colIndex)));
                    }
                }                
            });
        }
        checkEditingSupport = (CheckEditingSupport)editingSupport;
    }
    else
    {
        super.setEditingSupport(editingSupport);
    }        
}
 
Example 5
Project: tmxeditor8   File: GridViewerColumn.java   View source code 5 votes vote down vote up
/** {@inheritDoc} */
public void setEditingSupport(EditingSupport editingSupport)
{
    if (editingSupport instanceof CheckEditingSupport)
    {
        if (checkEditingSupport == null)
        {
            final int colIndex = getColumn().getParent().indexOf(getColumn());
            
            getColumn().getParent().addListener(SWT.Selection, new Listener()
            {                
                public void handleEvent(Event event)
                {                         
                    if (event.detail == SWT.CHECK && event.index == colIndex)
                    {
                        GridItem item = (GridItem)event.item;
                        Object element = item.getData();
                        checkEditingSupport.setValue(element, new Boolean(item.getChecked(colIndex)));
                    }
                }                
            });
        }
        checkEditingSupport = (CheckEditingSupport)editingSupport;
    }
    else
    {
        super.setEditingSupport(editingSupport);
    }        
}
 
Example 6
Project: mytourbook   File: ColumnDefinition.java   View source code 4 votes vote down vote up
public EditingSupport getEditingSupport() {
	return _editingSupport;
}
 
Example 7
Project: mytourbook   File: ColumnDefinition.java   View source code 4 votes vote down vote up
public void setEditingSupport(final EditingSupport editingSupport) {
	_editingSupport = editingSupport;
}
 
Example 8
Project: offspring   File: GenericTableColumn.java   View source code 4 votes vote down vote up
@Override
public EditingSupport getEditingSupport(ColumnViewer viewer) {
  return new GenericEditingSupport(viewer, this);
}
 
Example 9
Project: offspring   File: IGenericTableColumn.java   View source code votes vote down vote up
public EditingSupport getEditingSupport(ColumnViewer viewer);