Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 517853

Summary: [aird editor] handle cases where the browser component can not be created
Product: [Modeling] Sirius Reporter: Pierre-Charles David <pierre-charles.david>
Component: CoreAssignee: Project inbox <sirius.core-inbox>
Status: CLOSED FIXED QA Contact: Florian Barbin <florian.barbin>
Severity: enhancement    
Priority: P3 CC: florian.barbin, pierre.guilet
Version: 5.0.0Keywords: triaged
Target Milestone: 5.1.1   
Hardware: All   
OS: Linux   
See Also: https://git.eclipse.org/r/111781
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=4d2760a6531f8ddf7e103eff9aaa5ef2a14e464e
Whiteboard: aird_editor ux
Attachments:
Description Flags
The error message now shown when the browser can not be instanciated
none
How the aird editor looks in degraded mode none

Description Pierre-Charles David CLA 2017-06-06 07:49:33 EDT
Under some circumstances (at least under Linux), the instanciation of the SWT Browser component may fail. Currently, ViewpointsSelectionGraphicalHandler.createBrowser(Composite) avoids crashing in these cases, but it results in less than optimal UI with an empty space where the browser should be, with no feedback to the user.

Some options:
* Completely remove that part of the UI and adapt the layout.
* Replace it with a fallback, maybe just a label with some hard-coded information.

In all cases maybe a warning in the error log would be better than a completly silent handling.
Comment 1 Eclipse Genie CLA 2017-11-17 05:33:49 EST
New Gerrit change created: https://git.eclipse.org/r/111781
Comment 2 Pierre Guilet CLA 2017-11-20 08:41:17 EST
Scenario to see the problem:

- Use a bundle where Browser component cannot be instantiated.
- Create a new Ecore modeling project
- Open aird editor
- the rightmost part showing viewpoint descriptions is very thin. Selecting a viewpoint does not show any description in this part. And the error log shows nothing.

Solution is to:
1- log an error in error log.
2- Set an error message in this header block telling the browser could not be initialized and that HTML will not be interpreted.
2- replace the browser component by a standard text widget showing description without HTML tags to have at least some input.
Comment 4 Pierre-Charles David CLA 2017-12-26 08:46:37 EST
Fixed by 4d2760a6531f8ddf7e103eff9aaa5ef2a14e464e.
Comment 5 Pierre-Charles David CLA 2017-12-26 08:49:39 EST
Note that the root issue (browser component that can not be instanciated) only occurs under Linux, at least to our knowledge, and then only in some configurations of GTK version (2 vs 3), system browser components available (xulrunner, webkitgtk...) and system property.

On my plain Debian 9.2 "stretch", I can reproduce it by forcing -Dorg.eclipse.swt.browser.DefaultType=mozilla without the corresponding system packages installed.
Comment 6 Pierre-Charles David CLA 2017-12-26 08:50:53 EST
Created attachment 272037 [details]
The error message now shown when the browser can not be instanciated

With the patch, in contexts where the browser component can not be instanciated, we now display this popup, in addition to logging the error.
Comment 7 Pierre-Charles David CLA 2017-12-26 08:53:28 EST
Created attachment 272038 [details]
How the aird editor looks in degraded mode

This shows how the right-most component of the aird editor looks in degraded mode with the patch: instead of a browser component we use a plain text area, showing some error message and the extracted text from the HTML source. It's not perfect, but it doesn't have to be, this will only be visible in rare settings, and the important point is that we don't crash and still provide a usable editor.
Comment 8 Florian Barbin CLA 2018-01-09 10:55:10 EST
Verified.
At modeling project creation time, the aird editor may not be opened the first time the exception occurs. The user may need to manually open the aird editor.
Comment 9 Pierre-Charles David CLA 2018-02-01 03:25:25 EST
Available in Sirius 5.1.1. See https://wiki.eclipse.org/Sirius/5.1.1 for details.