Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move workbench running check in ColorManager to prevent SWT startup issues in headless mode #1486

Open
trancexpress opened this issue Nov 19, 2024 · 0 comments · May be fixed by #1487
Open
Assignees
Labels
bug Something isn't working

Comments

@trancexpress
Copy link
Contributor

This is a continuation of: https://bugs.eclipse.org/bugs//show_bug.cgi?id=546205

We run some emf.XSD2Java ant tasks, while updating our build environment we run into the following SWT exception:

     [xslt] Caused by: org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed]
     [xslt]     at org.eclipse.swt.SWT.error(SWT.java:4944)
     [xslt]     at org.eclipse.swt.widgets.Display.createDisplay(Display.java:1199)
     [xslt]     at org.eclipse.swt.widgets.Display.create(Display.java:1123)
     [xslt]     at org.eclipse.swt.graphics.Device.<init>(Device.java:167)
     [xslt]     at org.eclipse.swt.widgets.Display.<init>(Display.java:632)
     [xslt]     at org.eclipse.swt.widgets.Display.<init>(Display.java:623)
     [xslt]     at org.eclipse.swt.widgets.Display.getDefault(Display.java:2392)
     [xslt]     at org.eclipse.jface.preference.PreferenceConverter.<clinit>(PreferenceConverter.java:100)
     [xslt]     at org.eclipse.pde.internal.ui.editor.text.ColorManager.initializeDefaults(ColorManager.java:51)
     [xslt]     at org.eclipse.pde.internal.ui.preferences.PreferenceInitializer.initializeDefaultPreferences(PreferenceInitializer.java:28)
     [xslt]     at org.eclipse.core.internal.preferences.PreferenceServiceRegistryHelper$1.run(PreferenceServiceRegistryHelper.java:319)
     [xslt]     at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
     [xslt]     at org.eclipse.core.internal.preferences.PreferenceServiceRegistryHelper.runInitializer(PreferenceServiceRegistryHelper.java:322)
     [xslt]     at org.eclipse.core.internal.preferences.PreferenceServiceRegistryHelper.applyRuntimeDefaults(PreferenceServiceRegistryHelper.java:138)
     [xslt]     at org.eclipse.core.internal.preferences.PreferencesService.applyRuntimeDefaults(PreferencesService.java:385)
     [xslt]     at org.eclipse.core.internal.preferences.DefaultPreferences.applyRuntimeDefaults(DefaultPreferences.java:231)
     [xslt]     at org.eclipse.core.internal.preferences.DefaultPreferences.load(DefaultPreferences.java:282)
     [xslt]     at org.eclipse.core.internal.preferences.EclipsePreferences.create(EclipsePreferences.java:368)
     [xslt]     at org.eclipse.core.internal.preferences.EclipsePreferences.internalNode(EclipsePreferences.java:613)
     [xslt]     at org.eclipse.core.internal.preferences.EclipsePreferences.node(EclipsePreferences.java:744)
     [xslt]     at org.eclipse.core.internal.preferences.AbstractScope.getNode(AbstractScope.java:40)
     [xslt]     at org.eclipse.core.runtime.preferences.DefaultScope.getNode(DefaultScope.java:77)
     [xslt]     at org.eclipse.pde.internal.core.PDEPreferencesManager.<init>(PDEPreferencesManager.java:39)
     [xslt]     at org.eclipse.pde.internal.ui.PDEPlugin.getPreferenceManager(PDEPlugin.java:76)
     [xslt]     at org.eclipse.pde.internal.ui.shared.target.TargetStatus.initializeTargetStatus(TargetStatus.java:191)
     [xslt]     at org.eclipse.pde.internal.ui.PDEPlugin.start(PDEPlugin.java:216)
     [xslt]     at org.eclipse.osgi.internal.framework.BundleContextImpl$2.run(BundleContextImpl.java:818)
     [xslt]     at org.eclipse.osgi.internal.framework.BundleContextImpl$2.run(BundleContextImpl.java:1)
     [xslt]     at java.base/java.security.AccessController.doPrivileged(AccessController.java:571)
     [xslt]     at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:810)
     [xslt]     ... 40 more

Upon investigation, we don't have DISPLAY set in the new build environment. The PlatformUI.isWorkbenchRunning() should be moved to the start of ColorManager.initializeDefaults(IPreferenceStore), to avoid creating an SWT Display object in headless mode.

trancexpress pushed a commit to trancexpress/eclipse.pde that referenced this issue Nov 19, 2024
…en headless

This change adjusts the check added for Eclipze bugzilla 546205 ticket.
The check for running workbench is now done at the start of ColorManager.initializeDefaults(),
to prevent the creation of an SWT Display object when in headless mode.

See: https://bugs.eclipse.org/bugs//show_bug.cgi?id=546205

Fixes: eclipse-pde#1486
@iloveeclipse iloveeclipse added the bug Something isn't working label Nov 19, 2024
trancexpress added a commit to trancexpress/eclipse.pde that referenced this issue Nov 19, 2024
…en headless

This change adjusts the check added for Eclipze bugzilla 546205 ticket.
The check for running workbench is now done at the start of ColorManager.initializeDefaults(),
to prevent the creation of an SWT Display object when in headless mode.

See: https://bugs.eclipse.org/bugs//show_bug.cgi?id=546205

Fixes: eclipse-pde#1486
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants