| TableViewer in Dialog does not show any labels [message #1719255] |
Wed, 06 January 2016 10:52  |
Eclipse User |
|
|
|
Hi there,
i got following the problem:
I build a costum dialog extending the jface dialog class. There i want to show a table using the jface tableViewer with one column and text in it.
I did the following in my dialog class to create the tableviewer:
@Override
protected Control createDialogArea(Composite parent) {
Composite comp = (Composite) super.createDialogArea(parent);
comp.setLayout(new GridLayout(1, true));
tableViewer = new TableViewer(comp, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
tableViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true,true,1,1));
final Table table = tableViewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
tableViewer.setContentProvider(new MyContentProvider());
TableViewerColumn col1 = new TableViewerColumn(tableViewer, SWT.NONE);
col1.getColumn().setText("Component Model Name");
col1.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
return "test";
}
});
tableViewer.setInput(inputObject);
}
Now the table viewer shows elements in it and you can choose them and when you click the ok button it knows the tableViewer.getSelection() element and everything works fine. Besides the problem that the viewer does not show the string "test" or any string in its appearance.
the outcome looks like:


Any suggestions? 
Greetings, lars
Attachment: 2.PNG
(Size: 5.39KB, Downloaded 352 times)
Attachment: 1.PNG
(Size: 5.88KB, Downloaded 319 times)
[Updated on: Wed, 06 January 2016 10:54] by Moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03014 seconds