Don't lose mouse focus when Java initiates transform

Are you missing a feature? Request it's implementation here.
tomjohnson1492
Posts: 132

Don't lose mouse focus when Java initiates transform

Sat Dec 06, 2014 12:10 am

When I kick off about 8 transforms, it can be really annoying to constantly lose focus each time the JRE or JDK (whatever Java process it is) processes the content. I want that Java process to not take away my focus, requiring me to click again somewhere on the screen. I don't know if it's a Mac thing, but it's annoying.
adrian
Posts: 2453

Re: Don't lose mouse focus when Java initiates transform

Mon Dec 08, 2014 4:06 pm

Hi,

By default, Java processes (even background ones) on the Mac appear in the dock bar. So, when you run a transformation that executes a background Java process, it appears in the dock bar and gains the focus. This can be avoided by setting a system property for that Java process at runtime which forces headless mode.

What type of transformations are these? Are they DITA-OT/ANT transformations?
For DITA-OT/ANT you can edit the transformation scenario in Oxygen, Document > Transformation > "Configure Transformation Scenario(s)", Edit, go to the Advanced tab and in the JVM Arguments field add another parameter (leave at least a space between parameters), -Djava.awt.headless=true
Note that in certain conditions some the transformations (Java processes) may not run correctly in headless mode. They could try to initialize some Java objects unavailable in this mode or may even try to interact with the user (e.g. prompt for user and password). If that's the case, you will see a java.awt.HeadlessException in the output log of the transformation. If you see that, you will have to remove the headless parameter and run it as before.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
tomjohnson1492
Posts: 132

Re: Don't lose mouse focus when Java initiates transform

Mon Dec 08, 2014 10:08 pm

This tip works beautifully! This makes my life so much better. Thanks.
adrian
Posts: 2453

Re: Don't lose mouse focus when Java initiates transform

Tue Dec 09, 2014 10:54 am

Hi,

My colleague, Radu Coravu, tells me that there's another Java system property specific to the Mac Java runtime that forces the process to the background without forcing it to be headless,
-Dapple.awt.UIElement=true
I've tested this and it works as expected.

So instead of -Djava.awt.headless=true, you can safely use -Dapple.awt.UIElement=true which also correctly handles the transformations that cannot run in headless mode.

I've already submitted an issue on our issue tracking tool to include this property in the default configuration for such transformations.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
tomjohnson1492
Posts: 132

Re: Don't lose mouse focus when Java initiates transform

Wed Dec 10, 2014 12:41 am

so the first code works for both windows and mac, and the second code is mac specific? thanks!
Radu
Posts: 5757

Re: Don't lose mouse focus when Java initiates transform

Mon May 18, 2015 3:49 pm

Hi,

Just to update this thread, in Oxygen 17 the started DITA OT process no longer appears in the Mac Dock Bar.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Return to “Feature Request”

Who is online

Users browsing this forum: No registered users and 0 guests