Bug 573219 - Unable to run validation headless due to diagram plugin activation requires display
Summary: Unable to run validation headless due to diagram plugin activation requires d...
Status: NEW
Alias: None
Product: Papyrus
Classification: Modeling
Component: Diagram (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-28 10:37 EDT by Young-Soo Roh CLA
Modified: 2021-06-10 09:22 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Young-Soo Roh CLA 2021-04-28 10:37:29 EDT
When trying to validate a model using Eclipse headless mode over SSH then the following error occurs.

Caused by: org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed]
        at org.eclipse.swt.SWT.error(SWT.java:4725)
        at org.eclipse.swt.widgets.Display.createDisplay(Display.java:1062)
        at org.eclipse.swt.widgets.Display.create(Display.java:1042)
        at org.eclipse.swt.graphics.Device.<init>(Device.java:175)
        at org.eclipse.swt.widgets.Display.<init>(Display.java:608)
        at org.eclipse.swt.widgets.Display.<init>(Display.java:599)
        at org.eclipse.swt.widgets.Display.getDefault(Display.java:2448)
        at org.eclipse.papyrus.infra.gmfdiag.preferences.pages.PapyrusAllDiagramsPreferencePage.initDefaults(PapyrusAllDiagramsPreferencePage.java:107)
        at org.eclipse.papyrus.infra.gmfdiag.preferences.PapyrusPreferenceInitializer.initializeDefaultPreferences(PapyrusPreferenceInitializer.java:42)
        at org.eclipse.core.internal.preferences.PreferenceServiceRegistryHelper$1.run(PreferenceServiceRegistryHelper.java:301)
        at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
        at org.eclipse.core.internal.preferences.PreferenceServiceRegistryHelper.runInitializer(PreferenceServiceRegistryHelper.java:304)
        at org.eclipse.core.internal.preferences.PreferenceServiceRegistryHelper.applyRuntimeDefaults(PreferenceServiceRegistryHelper.java:134)
        at org.eclipse.core.internal.preferences.PreferencesService.applyRuntimeDefaults(PreferencesService.java:375)
        at org.eclipse.core.internal.preferences.DefaultPreferences.applyRuntimeDefaults(DefaultPreferences.java:225)
        at org.eclipse.core.internal.preferences.DefaultPreferences.load(DefaultPreferences.java:279)
        at org.eclipse.core.internal.preferences.EclipsePreferences.create(EclipsePreferences.java:370)
        at org.eclipse.core.internal.preferences.EclipsePreferences.internalNode(EclipsePreferences.java:623)
        at org.eclipse.core.internal.preferences.EclipsePreferences.node(EclipsePreferences.java:766)
        at org.eclipse.core.internal.preferences.AbstractScope.getNode(AbstractScope.java:41)
        at org.eclipse.core.runtime.preferences.DefaultScope.getNode(DefaultScope.java:77)
        at org.eclipse.papyrus.infra.ui.preferences.PapyrusScopedPreferenceStore.getDefaultPreferences(PapyrusScopedPreferenceStore.java:274)
        at org.eclipse.papyrus.infra.ui.preferences.PapyrusScopedPreferenceStore.setDefault(PapyrusScopedPreferenceStore.java:682)
        at org.eclipse.gmf.runtime.diagram.ui.preferences.DiagramsPreferencePage.initDefaults(DiagramsPreferencePage.java:124)
        at org.eclipse.papyrus.uml.diagram.activity.preferences.DiagramPreferenceInitializer.initializeDefaultPreferences(DiagramPreferenceInitializer.java:34)
        at org.eclipse.papyrus.uml.diagram.activity.part.UMLDiagramEditorPlugin.start(UMLDiagramEditorPlugin.java:107)
        at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:842)

Looks like plugin activation is trying to set default values but it assumes that the workbench exist. This prevents any headless application from running over SSH that doesn't have display X. Maybe it should check if workbench exist first.
Comment 1 Young-Soo Roh CLA 2021-04-28 21:37:33 EDT
The validation constraint bindings are done in the diagram plugin which requires UI access (Preference page). Maybe there should be a separate plugin for validation only to perform constraint bindings so headless application can perform validation.
Comment 2 Young-Soo Roh CLA 2021-04-29 11:36:58 EDT
I think there are more than one diagram plugins that do this(activity, sequence, and statemachine) so all of them need to check if workbench is running before trying to set the preference value.
Maybe this could do the trick?

if (PlatformUI.isWorkbenchRunning()) {
   then set preference value.
}
Comment 3 Vincent Lorenzo CLA 2021-06-10 09:22:38 EDT
I confirm this bug.