如何解决 "No more handles exception", Eclipse Oxygen, Windowbuilder Pro

How to solve "No more handles exception", Eclipse Oxygen, Windowbuilder Pro

我在 Debian Buster 下使用 Eclipse Oxygen 和 WindowBuilder Pro,当我想在设计选项卡中打开一个 .java 文件(带有 Swing JFrame)时,我得到一个 "Designer, No more handles"-错误。之后,系统询问我是否要退出 workbench,因为可能会出现更多 SWT 错误并且它可能会意外关闭。

单击“否”后,我仍然可以看到设计器,但它不会对试图更改 JFrame 的任何单击或移动做出反应。

错误堆栈跟踪:

org.eclipse.swt.SWTError: No more handles
    at org.eclipse.swt.SWT.error(SWT.java:4559)
    at org.eclipse.swt.SWT.error(SWT.java:4448)
    at org.eclipse.swt.SWT.error(SWT.java:4419)
    at org.eclipse.swt.graphics.Cursor.<init>(Cursor.java:180)
    at org.eclipse.wb.draw2d.ICursorConstants.<clinit>(ICursorConstants.java:98)
    at org.eclipse.wb.gef.graphical.tools.MarqueeSelectionTool.<init>(MarqueeSelectionTool.java:61)
    at org.eclipse.wb.core.editor.palette.model.entry.MarqueeSelectionToolEntryInfo.<init>(MarqueeSelectionToolEntryInfo.java:29)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.lang.Class.newInstance(Class.java:442)
    at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:184)
    at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:905)
    at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
    at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55)
    at org.eclipse.wb.internal.core.editor.palette.PaletteManager.run(PaletteManager.java:443)
    at org.eclipse.wb.internal.core.utils.execution.ExecutionUtils.runLog(ExecutionUtils.java:106)
    at org.eclipse.wb.internal.core.editor.palette.PaletteManager.processCategoryChild(PaletteManager.java:429)
    at org.eclipse.wb.internal.core.editor.palette.PaletteManager.processPaletteChildren(PaletteManager.java:418)
    at org.eclipse.wb.internal.core.editor.palette.PaletteManager.processCategory(PaletteManager.java:388)
    at org.eclipse.wb.internal.core.editor.palette.PaletteManager.parseExtensionPalette(PaletteManager.java:360)
    at org.eclipse.wb.internal.core.editor.palette.PaletteManager.access[=11=](PaletteManager.java:345)
    at org.eclipse.wb.internal.core.editor.palette.PaletteManager.run(PaletteManager.java:139)
    at org.eclipse.wb.internal.core.utils.execution.ExecutionUtils.runLog(ExecutionUtils.java:106)
    at org.eclipse.wb.internal.core.editor.palette.PaletteManager.reloadPalette(PaletteManager.java:137)
    at org.eclipse.wb.internal.core.editor.palette.DesignerPalette.reloadPalette(DesignerPalette.java:171)
    at org.eclipse.wb.internal.core.editor.palette.DesignerPalette.setInput(DesignerPalette.java:138)
    at org.eclipse.wb.internal.core.editor.JavaDesignComposite.refresh(JavaDesignComposite.java:146)
    at org.eclipse.wb.internal.core.editor.DesignPage.internal_refreshGEF(DesignPage.java:585)
    at org.eclipse.wb.internal.core.editor.DesignPage.access(DesignPage.java:522)
    at org.eclipse.wb.internal.core.editor.DesignPage.run(DesignPage.java:449)
    at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:233)
    at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:144)
    at org.eclipse.swt.widgets.Display.syncExec(Display.java:5439)
    at org.eclipse.wb.internal.core.editor.DesignPage.run(DesignPage.java:446)
    at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:437)
    at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:353)
    at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:483)
    at org.eclipse.wb.internal.core.editor.DesignPage.internal_refreshGEF_withProgress(DesignPage.java:465)
    at org.eclipse.wb.internal.core.editor.DesignPage.internal_refreshGEF(DesignPage.java:415)
    at org.eclipse.wb.internal.core.editor.UndoManager.refreshDesignerEditor(UndoManager.java:381)
    at org.eclipse.wb.internal.core.editor.UndoManager.activate(UndoManager.java:90)
    at org.eclipse.wb.internal.core.editor.DesignPage.handleActiveState_True(DesignPage.java:263)
    at org.eclipse.wb.internal.core.editor.DesignPage.handleActiveState(DesignPage.java:241)
    at org.eclipse.wb.internal.core.editor.multi.DefaultMultiMode.showPage(DefaultMultiMode.java:125)
    at org.eclipse.wb.internal.core.editor.multi.DefaultMultiMode.widgetSelected(DefaultMultiMode.java:63)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:249)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5252)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1348)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1374)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1357)
    at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1142)
    at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:3187)
    at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1870)
    at org.eclipse.swt.custom.CTabFolder.lambda[=11=](CTabFolder.java:328)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5252)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1348)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4522)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4107)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1155)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1044)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
    at org.eclipse.ui.internal.Workbench.lambda(Workbench.java:680)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1472)

它解决了问题(以及其他问题,例如偶尔严重抖动的上下文菜单),只需像这样启动 eclipse 并使用 GTK2 而不是 GTK3:SWT_GTK3=0 ./eclipse

编辑:它似乎也可以这样工作:https://askubuntu.com/a/838703 我用上述方法丢失了我的菜单图标。链接方法没有这个缺陷。

在命令行中输入:

daniel@DanielPC:~/eclipse/jee-oxygen/eclipse$ 导出 SWT_GTK3=0 daniel@DanielPC:~/eclipse/jee-oxygen/eclipse$ ./eclipse

问题出在 GTK3。上面的命令强制 Eclipse 使用 GTK2。