org.eclipse.swt.SWTException: “Widget is disposed” from table refresh

别来无恙 提交于 2019-12-04 04:27:51

Seems like refresh() method is called after the viewer is disposed (closed?). You can avoid this exception by checking:

public void refresh() {
   if (viewer != null && !viewer.getControl().isDisposed()) {
      // Actual refresh code
   }
}

Try use display.isDisposed() like this.

    shell.getDisplay().asyncExec(new Runnable()
    {
        @Override
        public void run ()
        {
            if(!display.isDisposed() && !disposing)
            {
                              //you source code
            }
        }
    });

But remember that isDisposed() return true then disposing end. Thats why you shod use flag

disposing = true;

display.dispose();

disposing = false;

Just create a new work-space. Import your projects. It worked for me. :)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!