Make the button in DialogCellEditor visible in TableViewer [message #187229] |
Fri, 30 January 2004 10:52  |
Eclipse User |
|
|
|
Hi,
I am having a problem with the DialogCellEditor. I have implemented a
subclass to bring up a dialog, but the button in the celleditor is never
visible. The editor is used in a table in a standalone application.
Here is a code snippet:
instanceTableViewer = new TableViewer(iTableViewerComposite, SWT.BORDER);
// only one column
TableColumn column = new TableColumn(instanceTableViewer.getTable(),
SWT.NONE);
column.setWidth(200);
// array of CellEditors - still one...
CellEditor[] cellEditor = new CellEditor[1];
InstanceDialogCellEditor instanceDialogCellEditor =
new InstanceDialogCellEditor(instanceTableViewer.getTable());
// put the only editor in array
cellEditor[0] = instanceDialogCellEditor;
instanceTableViewer.setCellEditors(cellEditor);
// the source
Instances instances = new Instances();
// content and label providers
instanceTableViewer.setContentProvider(new InstanceTableContentProvider());
instanceTableViewer.setLabelProvider(new InstanceTableLabelProvider());
// input
instanceTableViewer.setInput(instances);
Thanks/ Bj
|
|
|
|
Re: Make the button in DialogCellEditor visible in TableViewer [message #266731 is a reply to message #188229] |
Thu, 12 August 2004 12:07  |
Eclipse User |
|
|
|
I agree with you that this need to set the column properties for CellEditors to work properly is
confusing; what is the bug that you submitted?
Paul K
Björn Johansson wrote:
> Hi,
>
>
> If anyone is interested - it seems the problem was that I did not set the
> columnProperties (the String array that represent column headers) for the
> table. I find that very strange since I did not want to use any column
> headers. It is of course possible to have headers and omitt showing them.
> But it does not make any sense and it is not documented anywhere. Bad design
> or a kind of "bug" in my view or at least poorly documented...
>
> Here is what I did:
>
> String[] columnNames = {"Instances"}; // only one column...
> // ...other code
> // not showing header
> instanceTableViewer.setColumnProperties(columnNames );
> // ...other code
> // of course setCellModifier(ICellModifier);
> instanceTableViewer.setCellModifier(new
> InstanceCellModifier(instanceTableViewer));
>
> By the way - I understood that I needed to set a CellModifier. The problem
> was that when I did I only got an error pointing to a NullPointerException
> in the eventDispatcher thread (when I clicked a row in the table) - no hunch
> of what was wrong in my code
>
> I will file a bug report.
>
> /Björn J
>
> "Björn Johansson" <bjorn.johansson@capitalc.se> wrote in message
> news:bvdue3$q8p$1@eclipse.org...
>
>>Hi,
>>
>>I am having a problem with the DialogCellEditor. I have implemented a
>>subclass to bring up a dialog, but the button in the celleditor is never
>>visible. The editor is used in a table in a standalone application.
>>
>>Here is a code snippet:
>>
>>instanceTableViewer = new TableViewer(iTableViewerComposite, SWT.BORDER);
>>// only one column
>>TableColumn column = new TableColumn(instanceTableViewer.getTable(),
>>SWT.NONE);
>>column.setWidth(200);
>>
>>// array of CellEditors - still one...
>>CellEditor[] cellEditor = new CellEditor[1];
>>InstanceDialogCellEditor instanceDialogCellEditor =
>>new InstanceDialogCellEditor(instanceTableViewer.getTable());
>>// put the only editor in array
>>cellEditor[0] = instanceDialogCellEditor;
>>instanceTableViewer.setCellEditors(cellEditor);
>>
>>// the source
>>Instances instances = new Instances();
>>// content and label providers
>>instanceTableViewer.setContentProvider(new
>
> InstanceTableContentProvider());
>
>>instanceTableViewer.setLabelProvider(new InstanceTableLabelProvider());
>>// input
>>instanceTableViewer.setInput(instances);
>>
>>Thanks/ Björn
>>
>>
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03763 seconds