Getting java pop-up in front of oXygen (ANT)
Oxygen general issues.
-
- Posts: 11
- Joined: Sat Feb 25, 2017 1:18 am
Getting java pop-up in front of oXygen (ANT)
I'm using oXygen build 2018022209 and I'm using embedded java scripts to receive user input. I can't use oXygen editor variables for this, because some of the information (like passwords) needs to be secure and, as far as I can tell, passing an editor variable through to ANT in oXygen echoes out something like this:
"/Applications/Oxygen XML Editor/tools/ant/lib/ant-launcher.jar" "-Dant.home=/Applications/Oxygen XML Editor/tools/ant" org.apache.tools.ant.launch.Launcher -f "path/to/my/build" "-Dpd="my/project/directory/editor/variable "-Dwebhelp.trial.license=no" "-Dpassword=mySecretPassword"[/code]
So, I'm using a Java popup instead like so in my ant build:
However, the pop-up box looks like this: https://github.com/joeytakeda/misc/blob ... _forum.png where the pop-up box comes in behind the oXygen window. Is there any way to get this pop-up box to go in front of the oXygen window?
Thanks!
Joey
Code: Select all
"/Applications/Oxygen XML Editor/.install4j/jre.bundle/Contents/Home/jre/bin/java" -Dapple.awt.UIElement=true -Xmx256m -classpath [code]
So, I'm using a Java popup instead like so in my ant build:
Code: Select all
<script language="javascript">
<![CDATA[
var pw = new javax.swing.JPasswordField();
var choice = javax.swing.JOptionPane.showConfirmDialog(null, pw, "Enter Password..", javax.swing.JOptionPane.OK_CANCEL_OPTION, javax.swing.JOptionPane.PLAIN_MESSAGE);
if (choice == javax.swing.JOptionPane.OK_OPTION) {
// create ant property
var pwd = pw.getText();
project.setProperty("pwd", pwd);
} else {
javax.swing.JOptionPane.showMessageDialog(null, "ERROR: User cancelled input. Aborting.");
throw "Password required!";
};
if (pwd.isEmpty()) {
javax.swing.JOptionPane.showMessageDialog(null, "ERROR: No password entered! Aborting.");
throw "Password required!!";
}
]]>
</script>
Thanks!
Joey
-
- Posts: 9436
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Getting java pop-up in front of oXygen (ANT)
Hi Joey,
The first parameter you send as null to the JOptionPane is the parent component. Unfortunately once the DITA OT publishing starts, it runs in another process so you cannot pass to it a reference to the main Oxygen frame which runs in its own process.
A couple of possibilities you could try:
1) In your javascript code from the ANT build file also create a Swing JFrame without content, show it, and on top of the frame show your JOptionPane, then after the JOptionPane is closed hide also the parent Swing JFrame. But this might not fix the problem in all cases.
2) Create an Oxygen plugin which contributes a custom action which the end user would use to set an user and a password for some repository. Your plugin would store them somewhere in the user home folder, maybe encrypted with some custom encryption you have. Then your ANT build file could read that file in order to retrieve the user and password. In this way the end users would not need to enter their credentials every time they publish.
If you are interested in this approach I could try to tell you more about our plugins API.
Regards,
Radu
The first parameter you send as null to the JOptionPane is the parent component. Unfortunately once the DITA OT publishing starts, it runs in another process so you cannot pass to it a reference to the main Oxygen frame which runs in its own process.
A couple of possibilities you could try:
1) In your javascript code from the ANT build file also create a Swing JFrame without content, show it, and on top of the frame show your JOptionPane, then after the JOptionPane is closed hide also the parent Swing JFrame. But this might not fix the problem in all cases.
2) Create an Oxygen plugin which contributes a custom action which the end user would use to set an user and a password for some repository. Your plugin would store them somewhere in the user home folder, maybe encrypted with some custom encryption you have. Then your ANT build file could read that file in order to retrieve the user and password. In this way the end users would not need to enter their credentials every time they publish.
If you are interested in this approach I could try to tell you more about our plugins API.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 11
- Joined: Sat Feb 25, 2017 1:18 am
Re: Getting java pop-up in front of oXygen (ANT)
Hi Radu,
Thanks for the suggestions! I'm slightly confused by this bit, however:
Thanks!
Joey
Thanks for the suggestions! I'm slightly confused by this bit, however:
I'm not running DITA OT publishing, so can I pass a reference to main Oxygen frame, or am I misunderstanding?The first parameter you send as null to the JOptionPane is the parent component. Unfortunately once the DITA OT publishing starts, it runs in another process so you cannot pass to it a reference to the main Oxygen frame which runs in its own process.
Thanks!
Joey
-
- Posts: 9436
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Getting java pop-up in front of oXygen (ANT)
Hi Joey,
Sorry about my phrasing, I meant to say "DITA OT or ANT publishing". So ANT publishing is also done in another Java process started from Oxygen and because it is another Java process it cannot receive a reference to the parent frame.
I will add an internal issue to potentially mask out in a future version in the command line we display parameters whose values have been computed using "$ask" editor variables of type password. But even if we do that the password parameter will still be passed as a plain string to the started ANT process.
Regards,
Radu
Sorry about my phrasing, I meant to say "DITA OT or ANT publishing". So ANT publishing is also done in another Java process started from Oxygen and because it is another Java process it cannot receive a reference to the parent frame.
I will add an internal issue to potentially mask out in a future version in the command line we display parameters whose values have been computed using "$ask" editor variables of type password. But even if we do that the password parameter will still be passed as a plain string to the started ANT process.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 11
- Joined: Sat Feb 25, 2017 1:18 am
Re: Getting java pop-up in front of oXygen (ANT)
Hi Radu,
Ah, that makes sense. Thanks for clarifying.
Thanks!
Joey
Ah, that makes sense. Thanks for clarifying.
That seemed to fix it!I added an empty JFrame and set it as the parent component. Posting code here for others:In your javascript code from the ANT build file also create a Swing JFrame without content, show it, and on top of the frame show your JOptionPane, then after the JOptionPane is closed hide also the parent Swing JFrame. But this might not fix the problem in all cases.
Code: Select all
<![CDATA[
var frame = new javax.swing.JFrame();
frame.setAlwaysOnTop( true );
frame.setLocationByPlatform( true );
frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
frame.setUndecorated(true);
frame.pack();
frame.setVisible(true);
var pw = new javax.swing.JPasswordField();
var choice = javax.swing.JOptionPane.showConfirmDialog(frame, pw, "Enter Password..", javax.swing.JOptionPane.OK_CANCEL_OPTION, javax.swing.JOptionPane.PLAIN_MESSAGE);
if (choice == javax.swing.JOptionPane.OK_OPTION) {
// create ant property
var pwd = pw.getText();
project.setProperty("pwd", pwd);
} else {
javax.swing.JOptionPane.showMessageDialog(frame, "ERROR: User cancelled input. Aborting.");
throw "Password required!";
};
if (pwd.isEmpty()) {
javax.swing.JOptionPane.showMessageDialog(frame, "ERROR: No password entered! Aborting.");
throw "Password required!!";
}
]]>
Joey
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service