eclipse-windowbuilder / windowbuilder

Eclipse Windowbuilder
https://projects.eclipse.org/projects/tools.windowbuilder
Eclipse Public License 1.0
78 stars 30 forks source link

Set MigLayout: NullPointerException: Cannot invoke "org.eclipse.core.resources.IResource.getFullPath()" because "bundleFile" is null #819

Closed ThisOtterBeGood closed 1 month ago

ThisOtterBeGood commented 1 month ago

Hi there, when i try to set MigLayout as layout I get this Error: image

The project references the following miglayout libraries:

Regards, Bernhard

eclipse.buildId=4.32.0.20240606-1231
java.version=21.0.3
java.vendor=Eclipse Adoptium
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.java.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product -data file:/C:/Users/gobe/eclipse-workspace-24-06-2024/

org.eclipse.wb.core
Error
Thu Jul 11 13:08:59 CEST 2024
Designer [1.16.0.202405211655.202407111308]: Cannot invoke "org.eclipse.core.resources.IResource.getFullPath()" because "bundleFile" is null

java.lang.NullPointerException: Cannot invoke "org.eclipse.core.resources.IResource.getFullPath()" because "bundleFile" is null
    at org.eclipse.wb.internal.core.editor.palette.model.entry.BundleLibraryInfo.ensure(BundleLibraryInfo.java:79)
    at org.eclipse.wb.internal.core.model.description.LayoutDescription.ensureLibraries(LayoutDescription.java:156)
    at org.eclipse.wb.internal.swing.model.component.ContainerInfo$5.runEx(ContainerInfo.java:200)
    at org.eclipse.wb.internal.core.model.util.ObjectInfoAction$1$1.run(ObjectInfoAction.java:70)
    at org.eclipse.wb.internal.core.utils.execution.ExecutionUtils.run(ExecutionUtils.java:331)
    at org.eclipse.wb.internal.core.model.util.ObjectInfoAction$1.run(ObjectInfoAction.java:67)
    at org.eclipse.wb.internal.core.utils.execution.ExecutionUtils.runLog(ExecutionUtils.java:107)
    at org.eclipse.wb.internal.core.model.util.ObjectInfoAction.run(ObjectInfoAction.java:63)
    at org.eclipse.jface.action.Action.runWithEvent(Action.java:474)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:581)
    at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:415)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:91)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4285)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1160)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4083)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3673)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1151)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1042)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:152)
    at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:639)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:546)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:173)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:208)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:143)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:109)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:439)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:271)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:668)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:605)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1481)
ThisOtterBeGood commented 1 month ago

I've downgraded WindowBuilder to 1.11 and now MigLayout 5.2 seems to work again. I couldn't find any documentation as to which MigLayout version is compatible with which WindowBuilder version.

ThisOtterBeGood commented 1 month ago

Unfortunately some other panels aren't showing up at all now (different errors in eclipses log), so I probably try to update miglayout to 11.x and see if that fixes this problem

ptziegler commented 1 month ago

I couldn't find any documentation as to which MigLayout version is compatible with which WindowBuilder version.

The error has nothing to do with the version of MigLayout you're using. Regardless, the latest version of WindowBuilder is using 11.4:

https://github.com/eclipse-windowbuilder/windowbuilder/blob/44d48e7c7fb16ea420d6c1dad59f66902962354c/target-platform/mvn/wb-mvn.target#L7-L18

But I don't believe that this is the cause of the exception. Based on the stack-trace, this issue might occur when those jars are not located in the workspace...

As a workaround, can you try to remove those jars from the classpath and try to use MigLayout again? If WindowBuilder can't find those dependencies, it should use the ones WindowBuilder is installed with.

ptziegler commented 1 month ago

I was able to reproduce this issue when adding the jars as an external dependency. In such a case, WindowBuilder will no longer try to update the libraries and it is up to the user to keep them up-to-date.

Thank you for reporting the issue!

ThisOtterBeGood commented 1 month ago

Does this mean the current version of WindowBuilder will not work with MigLayout if miglayout-core and miglayout-swing ist listed as external dependency in Eclipse? So basically for any maven or gradle build. image

So with the next release this should be working?

ptziegler commented 1 month ago

Does this mean the current version of WindowBuilder will not work with MigLayout if miglayout-core and miglayout-swing ist listed as external dependency in Eclipse? So basically for any maven or gradle build.

That is correct.

So with the next release this should be working?

That is also correct. It's also already fixed in the current nightly build @ https://download.eclipse.org/windowbuilder/updates/nightly/latest