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

JDT tooltips are blank when MS Edge browser is used in Eclipse using "-Dorg.eclipse.swt.browser.DefaultType=edge" #248

Closed
minduch opened this issue Sep 3, 2022 · 11 comments · Fixed by #306
Assignees
Labels
bug Something isn't working
Milestone

Comments

@minduch
Copy link

minduch commented Sep 3, 2022

If running Eclipse with -Dorg.eclipse.swt.browser.DefaultType=edge under e.g. Windows 11 or 10, the tooltips shown by JDT in for example Java editors are empty. This is probably due to SWT issues with the Browser component being MS Edge and not MS Internet Explorer (or MS Edge in MSIE compatibility mode on Windows 11).

Eclipse 2022-09 RC1 under Windows 11

Below, you will see the tooltip on a boolean variable:

Screenshot 2022-09-03-no-content-in-JDT-tooltip-in-EDGE

If -Dorg.eclipse.swt.browser.DefaultType=edge is not specified, it works, both in Windows 10 and 11:

Screenshot 2022-09-03 170708

@ktatavarthi
Copy link
Member

@niraj-modi Can you please provide your feedback here?

@minduch
Copy link
Author

minduch commented Sep 20, 2022

What kind of feedback would you like?
That the problem is still present in the Eclipse 2022-09 release version?

Same problem as issue #198.

@jjohnstn
Copy link
Contributor

jjohnstn commented Sep 20, 2022

Hi, this appears to be an SWT issue. I have opened: eclipse-platform/eclipse.platform.swt#398 and copied your info. Please track that issue and if requested, provide further details.

@jjohnstn
Copy link
Contributor

Closing as issue being addressed in SWT.

@mfvalenta
Copy link

This is not an SWT issue. The behavior of the Edge browser is different than IE in the sense that whenever setText is called on the browser, A location change is issued with a URL using the data: protocol that contains the Base64 encoded version of the text. The following exception is happening because the URL is not recognized in the JavaElementLinks location listener. Because the URL parsing fails, the listener tries to invoke a hyperlink handler and sets doit to false. Change the code on line 314 to something like the following fixes the issue:

			if (nomatch) {
				try {
					if (!loc.startsWith("data:") &&  handler.handleExternalLink(new URL(loc), event.display))
						return;
					event.doit= true;
				} catch (MalformedURLException e) {
					JavaPlugin.log(e);
				}
			}

Here is the exception.

java.net.MalformedURLException: unknown protocol: data
at java.base/java.net.URL.(URL.java:681)
at java.base/java.net.URL.(URL.java:569)
at java.base/java.net.URL.(URL.java:516)
at org.eclipse.jdt.internal.ui.viewsupport.JavaElementLinks$1.changing(JavaElementLinks.java:316)
at org.eclipse.swt.browser.Edge.handleNavigationStarting(Edge.java:575)
at org.eclipse.swt.browser.Edge.handleNavigationStarting(Edge.java:557)
at org.eclipse.swt.browser.Edge.lambda$5(Edge.java:197)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(Native Method)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3630)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1155)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
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:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
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)

@jjohnstn
Copy link
Contributor

Should the check for "data:" be instead added to the lines on 258 so if we recognize "data:" in addition to "about:blank" we call handler.handleTextSet()?

@jjohnstn jjohnstn reopened this Oct 21, 2022
@mfvalenta
Copy link

I suspect you are right. handler.handleTextSet() should probably be called in this case.

jjohnstn added a commit to jjohnstn/eclipse.jdt.ui-1 that referenced this issue Oct 22, 2022
- add check for URL starting with "data:" which occurs when setText
  is called on Edge browser and use handler.handleTextSet()
- fixes: eclipse-jdt#248
@jjohnstn
Copy link
Contributor

@mfvalenta I have posted a PR. Could you verify this works as I don't have access to a Windows machine to test this properly?

@mfvalenta
Copy link

@jjohnstn The patch works for me.

jjohnstn added a commit that referenced this issue Oct 24, 2022
- add check for URL starting with "data:" which occurs when setText
  is called on Edge browser and use handler.handleTextSet()
- fixes: #248
@jjohnstn
Copy link
Contributor

Thanks @mfvalenta I have merged the patch.

@jjohnstn jjohnstn self-assigned this Oct 25, 2022
@jjohnstn jjohnstn added this to the 4.26 M3 milestone Oct 25, 2022
@jjohnstn jjohnstn added the bug Something isn't working label Oct 25, 2022
ktatavarthi pushed a commit to ktatavarthi/eclipse.jdt.ui that referenced this issue Nov 4, 2022
…ipse-jdt#306)

- add check for URL starting with "data:" which occurs when setText
  is called on Edge browser and use handler.handleTextSet()
- fixes: eclipse-jdt#248
ktatavarthi added a commit that referenced this issue Nov 4, 2022
* Add check for Edge browser setText issuing a location change url (#306)

- add check for URL starting with "data:" which occurs when setText
  is called on Edge browser and use handler.handleTextSet()
- fixes: #248

* Increase plugin version

Signed-off-by: Kalyan Prasad Tatavarthi <[email protected]>

Signed-off-by: Kalyan Prasad Tatavarthi <[email protected]>
Co-authored-by: Jeff Johnston <[email protected]>
@ktatavarthi
Copy link
Member

The changes have been back-ported to the branch R4_23_maintenance

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
Development

Successfully merging a pull request may close this issue.

4 participants