0

I am stuck in one of the scenerio. Based on input text field value i click button to display result in tableviewer. Below is the code,

btnSearch.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {

                        String plant=text_workplace.getText();


                        IStructuredSelection selection = (IStructuredSelection) m_workplaceViewer
                                .getSelection();
                         workplaceDetail = (WorkplaceDetail) selection.getFirstElement();


                            if (plant!=""){                     
                                workplaceDetail= workplaceDaoImpl.getWorkplaceDetailsSearchByPlant(plant);  

                                }

                         m_workplaceViewer.setInput(workplaceDetail);
                         m_workplaceViewer.refresh();

                        m_bindingContext.updateModels();
                    }
                });

I am able to get result of query fired on button click in console, but i don get result in table viewer, instead get below exception

org.eclipse.core.runtime.AssertionFailedException: assertion failed: This content provider only works with input of type IObservableList

4

1 回答 1

1

它告诉你错误是什么:你正在打电话

m_workplaceViewer.setInput(workplaceDetail);

workplaceDetail不是IObservableList,并且您正在使用需要IObservableList输入的内容提供程序。因此,您可以更改您的内容提供者或从workplaceDetail.

于 2013-02-28T04:33:46.837 回答