Don't lose mouse focus when Java initiates transform

Are you missing a feature? Request its implementation here.
tomjohnson1492
Posts: 132
Joined: Thu Apr 17, 2014 1:55 am

Don't lose mouse focus when Java initiates transform

Post 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.
adrian
Posts: 2857
Joined: Tue May 17, 2005 4:01 pm

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

Post 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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
tomjohnson1492
Posts: 132
Joined: Thu Apr 17, 2014 1:55 am

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

Post by tomjohnson1492 »

This tip works beautifully! This makes my life so much better. Thanks.
adrian
Posts: 2857
Joined: Tue May 17, 2005 4:01 pm

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

Post 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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
tomjohnson1492
Posts: 132
Joined: Thu Apr 17, 2014 1:55 am

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

Post by tomjohnson1492 »

so the first code works for both windows and mac, and the second code is mac specific? thanks!
Radu
Posts: 9164
Joined: Fri Jul 09, 2004 5:18 pm

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

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply