我有一个包含一些一次性标签的CTabFolder,每个标签都包含一个TreeViewer。我希望每个Viewer都有一个DragSupport。所以我自然而然地使用方法TreeViewer#addDragSupport
。一切都按预期工作,除非我关闭shell并且SWT尝试处理所有小部件。
发生的异常是:
org.eclipse.swt.SWTException: Widget is disposed
at org.eclipse.swt.SWT.error(Unknown Source)
at org.eclipse.swt.SWT.error(Unknown Source)
at org.eclipse.swt.SWT.error(Unknown Source)
at org.eclipse.swt.widgets.Widget.error(Unknown Source)
at org.eclipse.swt.widgets.Widget.checkWidget(Unknown Source)
at org.eclipse.swt.widgets.Widget.removeListener(Unknown Source)
at org.eclipse.swt.dnd.DragSource.onDispose(Unknown Source)
at org.eclipse.swt.dnd.DragSource.access$1(Unknown Source)
at org.eclipse.swt.dnd.DragSource$2.handleEvent(Unknown Source)
at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.release(Unknown Source)
at org.eclipse.swt.widgets.Widget.dispose(Unknown Source)
at org.eclipse.swt.dnd.DragSource$1.handleEvent(Unknown Source)
at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.release(Unknown Source)
at org.eclipse.swt.widgets.Composite.releaseChildren(Unknown Source)
at org.eclipse.swt.widgets.Widget.release(Unknown Source)
at org.eclipse.swt.widgets.Composite.releaseChildren(Unknown Source)
at org.eclipse.swt.widgets.Widget.release(Unknown Source)
at org.eclipse.swt.widgets.Widget.dispose(Unknown Source)
at org.eclipse.jface.viewers.ContentViewer.handleDispose(ContentViewer.java:172)
at org.eclipse.jface.viewers.StructuredViewer.handleDispose(StructuredViewer.java:2328)
at org.eclipse.jface.viewers.ContentViewer$2.widgetDisposed(ContentViewer.java:214)
at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.release(Unknown Source)
at org.eclipse.swt.widgets.Composite.releaseChildren(Unknown Source)
at org.eclipse.swt.widgets.Widget.release(Unknown Source)
at org.eclipse.swt.widgets.Composite.releaseChildren(Unknown Source)
at org.eclipse.swt.widgets.Widget.release(Unknown Source)
at org.eclipse.swt.widgets.Widget.dispose(Unknown Source)
at org.eclipse.jface.viewers.ContentViewer.handleDispose(ContentViewer.java:172)
at org.eclipse.jface.viewers.StructuredViewer.handleDispose(StructuredViewer.java:2328)
at org.eclipse.jface.viewers.ContentViewer$2.widgetDisposed(ContentViewer.java:214)
at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.release(Unknown Source)
at org.eclipse.swt.widgets.Composite.releaseChildren(Unknown Source)
at org.eclipse.swt.widgets.Widget.release(Unknown Source)
at org.eclipse.swt.widgets.Composite.releaseChildren(Unknown Source)
at org.eclipse.swt.widgets.Widget.release(Unknown Source)
at org.eclipse.swt.widgets.Widget.dispose(Unknown Source)
at org.eclipse.jface.viewers.ContentViewer.handleDispose(ContentViewer.java:172)
at org.eclipse.jface.viewers.StructuredViewer.handleDispose(StructuredViewer.java:2328)
at org.eclipse.jface.viewers.ContentViewer$2.widgetDisposed(ContentViewer.java:214)
at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.release(Unknown Source)
at org.eclipse.swt.widgets.Composite.releaseChildren(Unknown Source)
at org.eclipse.swt.widgets.Widget.release(Unknown Source)
at org.eclipse.swt.widgets.Composite.releaseChildren(Unknown Source)
at org.eclipse.swt.widgets.Widget.release(Unknown Source)
at org.eclipse.swt.widgets.Widget.dispose(Unknown Source)
at org.eclipse.jface.viewers.ContentViewer.handleDispose(ContentViewer.java:172)
at org.eclipse.jface.viewers.StructuredViewer.handleDispose(StructuredViewer.java:2328)
at org.eclipse.jface.viewers.ContentViewer$2.widgetDisposed(ContentViewer.java:214)
at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.release(Unknown Source)
at org.eclipse.swt.widgets.Composite.releaseChildren(Unknown Source)
at org.eclipse.swt.widgets.Widget.release(Unknown Source)
at org.eclipse.swt.widgets.Composite.releaseChildren(Unknown Source)
at org.eclipse.swt.widgets.Widget.release(Unknown Source)
at org.eclipse.swt.widgets.Composite.releaseChildren(Unknown Source)
at org.eclipse.swt.widgets.Widget.release(Unknown Source)
at org.eclipse.swt.widgets.Composite.releaseChildren(Unknown Source)
at org.eclipse.swt.widgets.Widget.release(Unknown Source)
at org.eclipse.swt.widgets.Composite.releaseChildren(Unknown Source)
at org.eclipse.swt.widgets.Canvas.releaseChildren(Unknown Source)
at org.eclipse.swt.widgets.Decorations.releaseChildren(Unknown Source)
at org.eclipse.swt.widgets.Shell.releaseChildren(Unknown Source)
at org.eclipse.swt.widgets.Widget.release(Unknown Source)
at org.eclipse.swt.widgets.Widget.dispose(Unknown Source)
at org.eclipse.swt.widgets.Decorations.dispose(Unknown Source)
at org.eclipse.swt.widgets.Shell.dispose(Unknown Source)
at org.eclipse.jface.window.Window.close(Window.java:335)
at org.eclipse.jface.window.ApplicationWindow.close(ApplicationWindow.java:307)
at org.eclipse.jface.window.Window.handleShellCloseEvent(Window.java:741)
at org.eclipse.jface.window.Window$3.shellClosed(Window.java:687)
at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Decorations.closeWidget(Unknown Source)
at org.eclipse.swt.widgets.Decorations.WM_CLOSE(Unknown Source)
at org.eclipse.swt.widgets.Control.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Canvas.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Decorations.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Shell.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Display.windowProc(Unknown Source)
at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
at org.eclipse.swt.internal.win32.OS.DefWindowProc(Unknown Source)
at org.eclipse.swt.widgets.Shell.callWindowProc(Unknown Source)
at org.eclipse.swt.widgets.Control.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Canvas.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Decorations.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Shell.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Display.windowProc(Unknown Source)
at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
at org.eclipse.swt.internal.win32.OS.DefWindowProc(Unknown Source)
at org.eclipse.swt.widgets.Shell.callWindowProc(Unknown Source)
at org.eclipse.swt.widgets.Control.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Canvas.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Decorations.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Shell.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Display.windowProc(Unknown Source)
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(Unknown Source)
at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
at org.eclipse.jface.window.Window.open(Window.java:801)
这似乎有点广泛。似乎SWT尝试在处理后从树中删除DragListener。我真的不明白这是怎么回事。
我不认为我在实现Source / Target和Transfer类型时犯了一个错误,因为拖放就像魅力一样。
将拖动支持添加到包含在一次性Widget中的TreeViewer时,是否可能存在任何陷阱?
如果您需要代码示例,请与我们联系。
答案 0 :(得分:0)
这应该不是问题。您有两个选择:编写一段代码来提供错误,或者只是在文件夹上添加一个dispose侦听器事件并删除那里的拖动支持。