ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rebhan, Gilbert" <Gilbert.Reb...@huk-coburg.de>
Subject RE: possible to open an alert window?
Date Mon, 29 Oct 2007 09:29:49 GMT

Hi, Peter

-----Original Message-----
From: Peter Reilly [mailto:peter.kitt.reilly@gmail.com] 
Sent: Friday, October 26, 2007 11:32 AM
To: Ant Users List
Subject: Re: possible to open an alert window?

/*

easy:
<project name="$1" default="build">
  <target name="run">
    <script language="beanshell">
      import javax.swing.*;
      new Thread() {
        public void run() {
          JOptionPane.showMessageDialog(
              null, "A long and boring message",
              "Danger Danger", JOptionPane.ERROR_MESSAGE);
        }
      }.start();
    </script>

    <..... the rest of the build ...>

  </target>
</project>

*/

that doesn't work for me with
Ant 1.6.5, beanshell 2.0b4, bsf 2.3.0_rc1

The build runs through but no JOptionPane gets
opened.

The snippet with the class Waiter { } open a JOptionPane
but is just blocking the build, as it does without the whole thread
handling.

Sorry i don't get the point, maybe it doesn't work here
because of my (old) version of Ant and/or Bsf ?!?

You' ve tried it with Ant 1.6.5  also ?


To prevent from blocking the build i would use the antcontrib
<limit> task or do it with a timeout like that =

<property name="waitfor" value="20"/>
...

<script language="ruby">
<![CDATA[
 require 'timeout'
 include Java
        
 begin
   Timeout.timeout($waitfor.to_i) {
     javax.swing.JOptionPane.showMessageDialog(
     nil, "A long and boring message",
     "Danger Danger", javax.swing.JOptionPane::ERROR_MESSAGE)
    }
 rescue Timeout::Error
   puts "JOptionPane closed due to inactivity after waiting #{$waitfor}
seconds !!"
 end
]]>
</script>


Regards, Gilbert



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message