Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Make the button in DialogCellEditor visible in TableViewer
Make the button in DialogCellEditor visible in TableViewer [message #187229] Fri, 30 January 2004 10:52 Go to next message
Eclipse UserFriend
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 #188229 is a reply to message #187229] Mon, 02 February 2004 07:49 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Make the button in DialogCellEditor visible in TableViewer [message #266731 is a reply to message #188229] Thu, 12 August 2004 12:07 Go to previous message
Eclipse UserFriend
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
>>
>>
>
>
>
Previous Topic:Silent failure to build
Next Topic:webstart/jnlp
Goto Forum:
  


Current Time: Sun May 11 21:03:24 EDT 2025

Powered by FUDForum. Page generated in 0.03763 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top