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

[Rich Text] Exception when opening a second rich text editor #434

Closed
azoitl opened this issue Dec 28, 2021 · 10 comments
Closed

[Rich Text] Exception when opening a second rich text editor #434

azoitl opened this issue Dec 28, 2021 · 10 comments

Comments

@azoitl
Copy link

azoitl commented Dec 28, 2021

I'm currently expermenting with Nebula's rich text editor integrated in one tab of a multi page editor. This works in general very nice.

However this only works for the first editor. As soon as a try to open further multipage editors (for other files) I get for each the exception as attached below and no rich text editor is shown in my editor tab. Am I doing something wrong? Is there some special configuration needed. Sofar there is not much code around the rich text editor. My code can be found here: https://git.eclipse.org/r/c/4diac/org.eclipse.4diac.ide/+/189068

/myworkspace/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.nebula.widgets.richtext_1.4.0.202106201019/org/eclipse/nebula/widgets/richtext/resources/template.html:214:50: ReferenceError: Can't find variable: getAllOptions
Script that was evaluated:
function SWTWebkit2TempFunc37(){initEditor();}; SWTWebkit2TempFunc37()
at org.eclipse.swt.browser.WebKit$Webkit2AsyncToSync.runjavascript(WebKit.java:1211)
at org.eclipse.swt.browser.WebKit$Webkit2AsyncToSync.evaluate(WebKit.java:1154)
at org.eclipse.swt.browser.WebKit.evaluate(WebKit.java:1475)
at org.eclipse.swt.browser.WebBrowser.evaluate(WebBrowser.java:406)
at org.eclipse.swt.browser.Browser.evaluate(Browser.java:666)
at org.eclipse.swt.browser.Browser.evaluate(Browser.java:615)
at org.eclipse.nebula.widgets.richtext.RichTextEditor$3.completed(RichTextEditor.java:284)
at org.eclipse.swt.browser.WebKit.lambda$7(WebKit.java:1945)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:5101)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4584)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1154)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1045)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:156)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
at org.eclipse.equinox.launcher.Main.main(Main.java:1440)

@lcaron
Copy link
Contributor

lcaron commented Dec 30, 2021

Hi

I've checked the code and I did not see something special. Can you please specify your JDK and your OS please ?

@azoitl
Copy link
Author

azoitl commented Dec 31, 2021

Hi,
thx for checking.

I'm running OpenJDK:
openjdk version "11.0.13" 2021-10-19
OpenJDK Runtime Environment (build 11.0.13+8-post-Debian-1)
OpenJDK 64-Bit Server VM (build 11.0.13+8-post-Debian-1, mixed mode, sharing)

on Debian Bullseye.

The whole thing I integrated the rich text editor into is an Eclipse RCP with the org.eclipse.ide.ui.workbench application.

My target platform consists of:
`

<locations>
	<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
		<repository location="https://download.eclipse.org/elk/updates/releases/0.7.1"/>
		<unit id="org.eclipse.elk.algorithms.feature.feature.group" version="0.7.1"/>
		<unit id="org.eclipse.elk.feature.feature.group" version="0.7.1"/>
	</location>
	<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
		<repository location="https://download.eclipse.org/eclipse/updates/4.22"/>
		<unit id="org.eclipse.jdt.feature.group" version="3.18.1000.v20211124-1800"/>
		<unit id="org.eclipse.pde.feature.group" version="3.14.1000.v20211124-1800"/>
		<unit id="org.eclipse.platform.sdk" version="4.22.0.I20211124-1800"/>
	</location>
	<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
		<repository location="https://download.eclipse.org/releases/2021-12"/>
		<unit id="org.eclipse.egit.feature.group" version="6.0.0.202111291000-r"/>
		<unit id="org.eclipse.emf.sdk.feature.group" version="2.28.0.v20211110-0654"/>
		<unit id="org.eclipse.gef.sdk.feature.group" version="3.11.0.201606061308"/>
		<unit id="org.eclipse.ocl.all.sdk.feature.group" version="5.17.0.v20211130-1448"/>
		<unit id="org.eclipse.xtext.sdk.feature.group" version="2.25.0.v20210301-1429"/>
	</location>
	<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
		<repository location="https://download.eclipse.org/nebula/releases/2.5.0/"/>
		<unit id="org.eclipse.nebula.feature.feature.group" version="2.5.0.202106201019>
	</location>
</locations>
`

@fipro78
Copy link
Contributor

fipro78 commented Jan 4, 2022

We have an E4 application example here:
https://github.com/eclipse/nebula/tree/master/widgets/richtext/org.eclipse.nebula.widgets.richtext.example.e4

In that example we have 3 tabs, one with only the editor, one with editor and viewer, and one with a JFace table that integrates the editor as cell editor. So we have a similar setup with multiple tabs that each contains a RichTextEditor. On Windows I do not see that exception.

getAllOptions is a BrowserFunction that is created and added to the internal Browser instance in the RichTextEditor constructor. It is called by the Javascript once the loading of the page is completed. And the responsible ProgressListener is added after the BrowserFunction is created and added. So that should all be instance local and from looking in the RichTextEditor code I would not see any concurrency issue as even initialization and and creation is in the correct order (the ProgressListener can not be called before the BrowserFuntion is added).

To get closer to the issue, could you please try if you can run the E4 example in your environment and if that reproduces the issue? For me it looks like a concurrency issue that the init function is somehow triggered although the BrowserFunction is not ready. Maybe it is an SWT Browser issue on Linux? We need to check that so we are not searching in the wrong direction.

@azoitl
Copy link
Author

azoitl commented Jan 4, 2022

I've cloned the nebula repo and run the E4 example. When I switch from the first tab to the second one I get the same exception (see below). Anything I can do to help finding the root cause of the issue?

/myworkspace/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.nebula.widgets.richtext_1.4.0.202106201019/org/eclipse/nebula/widgets/richtext/resources/template.html:214:50: ReferenceError: Can't find variable: getAllOptions
Script that was evaluated:
function SWTWebkit2TempFunc14(){initEditor();}; SWTWebkit2TempFunc14()
at org.eclipse.swt.browser.WebKit$Webkit2AsyncToSync.runjavascript(WebKit.java:1211)
at org.eclipse.swt.browser.WebKit$Webkit2AsyncToSync.evaluate(WebKit.java:1154)
at org.eclipse.swt.browser.WebKit.evaluate(WebKit.java:1475)
at org.eclipse.swt.browser.WebBrowser.evaluate(WebBrowser.java:406)
at org.eclipse.swt.browser.Browser.evaluate(Browser.java:666)
at org.eclipse.swt.browser.Browser.evaluate(Browser.java:615)
at org.eclipse.nebula.widgets.richtext.RichTextEditor$3.completed(RichTextEditor.java:284)
at org.eclipse.swt.browser.WebKit.lambda$7(WebKit.java:1945)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:5101)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4584)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1154)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1045)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:168)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
at org.eclipse.equinox.launcher.Main.main(Main.java:1440)

@fipro78
Copy link
Contributor

fipro78 commented Jan 4, 2022

Seems to be an issue in SWT with the latest webkit

https://bugs.eclipse.org/bugs/show_bug.cgi?id=573616
https://bugs.eclipse.org/bugs/show_bug.cgi?id=575472

Not sure if there is anything we or you can do. Despite you are an expert with webkit and the SWT integration, then the SWT team would surely appreciate any help.

@azoitl
Copy link
Author

azoitl commented Jan 5, 2022

Although I'm trying to learn more about SWT internals I may not be the right person then. Thanks for finding this.

@lcaron
Copy link
Contributor

lcaron commented Jun 24, 2022

Postponed to 2.8.0

@lcaron lcaron modified the milestones: 2.7.0, 2.8.0 Jun 24, 2022
@cpfeiffer
Copy link

FWIW, https://bugs.eclipse.org/bugs/show_bug.cgi?id=573616 is fixed for eclipse 4.24 (2022-06) and it works for me, now (I tested with eclipse 4.25). So from my POV, this can be closed, no changes in Nebula needed.

@lcaron
Copy link
Contributor

lcaron commented Sep 29, 2022

Great news !
Thank you for this information, I can close this bug. I really appreciate when developers give us additionnal information.

@lcaron lcaron closed this as completed Sep 29, 2022
@cpfeiffer
Copy link

The least, I can do. Thank you so much for maintaining Nebula! ❤️

@lcaron lcaron removed this from the 3.0.0 milestone Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants