Page 1 of 1

Don't lose mouse focus when Java initiates transform

Posted: Sat Dec 06, 2014 12:10 am
by tomjohnson1492
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.

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

Posted: Mon Dec 08, 2014 4:06 pm
by adrian
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

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

Posted: Mon Dec 08, 2014 10:08 pm
by tomjohnson1492
This tip works beautifully! This makes my life so much better. Thanks.

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

Posted: Tue Dec 09, 2014 10:54 am
by adrian
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

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

Posted: Wed Dec 10, 2014 12:41 am
by tomjohnson1492
so the first code works for both windows and mac, and the second code is mac specific? thanks!

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

Posted: Mon May 18, 2015 3:49 pm
by Radu
Hi,

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

Regards,
Radu