eclipse.platform.swt icon indicating copy to clipboard operation
eclipse.platform.swt copied to clipboard

Not able to click/double click/right click on the links provided in Link widget in Control example

Open deepika-u opened this issue 1 month ago • 4 comments

Describe the bug In Control Example, link widget i have 2 links. Unable to click/double click/right click on both the links.

I tried the same on SWT Controls -> Link tab as well.

Where as Browser tab -> i see that click/double click/right click all work here. Some configuration with respect to event listener is broken here and Link widget by default is working - I think so.

To Reproduce Try Control Example -> Link tab and check the links available there. Nothing is happening. or SWT Controls -> Link tab and check the links available there. Nothing is happening.

Expected behavior Atleast I should be able to right click, copy link and be able to open the same link atleast in browser.

Screenshots NA

Environment:

  1. Select the platform(s) on which the behavior is seen:
    • [ ] All OS
    • [X] Windows
    • [ ] Linux
    • [ ] macOS
  1. Additional OS info (e.g. OS version, Linux Desktop, etc) Not aware of.

  2. JRE/JDK version Java runtime version: 25+36-LTS

Version since Tried on below oomph version of eclipse setup

Eclipse SDK
org.eclipse.sdk.ide
4.38.0.I20251117-0620

Workaround (or) Additional context In the same context i also tried below

  1. Snippet182 - Buttons available looks to be working generating a console message. But with "link" i see the same behavior(nothing happens on any click) even when i place a valid link like "https://eclipse.dev/eclipse/swt/" in the snippet.

  2. Snippet183 - works fine like i get console messages when clicked.

deepika-u avatar Nov 18 '25 07:11 deepika-u

@elsazac : Can you check on Mac and update your findings please?

deepika-u avatar Nov 18 '25 07:11 deepika-u

On further investigation i see the urls as working from below https://github.com/eclipse-platform/eclipse.platform.swt/blob/63d5582c60d15e6dc75c4d3eaaa2769d4f5280f8/examples/org.eclipse.swt.examples/src/examples_control.properties#L265

deepika-u avatar Nov 18 '25 07:11 deepika-u

I understand the request to have a right-click menu giving you the ability to, e.g., copy the link. That's what happens on MacOS. But what would be the expectation when you left-click or double-click the link? For me, it behaves as completely expected for left clicks: when I click the link, I get a selection event fired, as explained by the Link#setText() contract. So as an example, this code opens my system browser for the specified URL, when I click on the link:

Link link = new Link(shell, SWT.NONE);
link.setText("This a very simple <a href=\"https://www.eclipse.org\">link</a> widget.");
link.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> Program.launch(e.text)));

Since a "link" is not defined as a web link, you can put in the href whatever you want to process in your listener. So if the expectation was that for a link control a browser automatically opens when clicking it, I don't think that's the intention of that control.

HeikoKlare avatar Nov 18 '25 07:11 HeikoKlare

I understand the request to have a right-click menu giving you the ability to, e.g., copy the link. That's what happens on MacOS.

This is not happening on windows.

deepika-u avatar Nov 18 '25 12:11 deepika-u