RCP App + java.awt.Desktop#setOpenUriHandler on MacOS [message #1842794] |
Thu, 01 July 2021 09:13  |
Eclipse User |
|
|
|
Hi, I'm currently developing and testing a small RCP App example, which can handle custom URI scheme calls on MacOS.
I use https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/Desktop.html#setOpenURIHandler(java.awt.desktop.OpenURIHandler) method to register custom URI handler in the code.
But I'm facing a problem which is that the handler does not being called.
The symptoms are as follows:
- with debugger, I made sure that the handler registration code is being executed (can't tell if it is being executed properly, because it calls native method under the hood, but no exceptions are thrown during the call of Desktop#setOpenUriHandler)
- I am convinced that the URI call is executed properly on the side of the OS (when I enter custom URL in browser, OS suggests to open my application and brings its window to front)
- However, the code inside the handler is not being executed
I tried to call the handler registering method from different places in my code (in bundle Activator, in ViewPart#createControl method, and also tried to create declarative service and call it there) but still no effect.
I am also attaching archive with my whole project.
One can reproduce the issue following these steps:
- build project by calling: mvn clean install
- launch eclipse-repository/target/products/example.product.id/macosx/cocoa/x86_64/Eclipse.app
- try to call custom URI by entering example://test in your browser address bar
- by this point the application window should display entered URL which however is not happening
Tested it on MacOS Big Sur with openjdk 11.0.11
Maybe someone faced such problem before? Any tips are welcome, thanks.
|
|
|
|
Re: RCP App + java.awt.Desktop#setOpenUriHandler on MacOS [message #1842890 is a reply to message #1842797] |
Mon, 05 July 2021 07:32  |
Eclipse User |
|
|
|
Adding to Rolf's answer, did you see that "note" in the documentation:
Please note that for macOS, notifications are only sent if the Java app is a bundled application, with a CFBundleDocumentTypes array present in its Info.plist. Check the Apple Developer Documentation for more information about Info.plist.
I can't tell from your provided code if you bundled it correctly or not.
|
|
|
Powered by
FUDForum. Page generated in 0.32088 seconds