I tried searching for the same on net, but not able to figure out a proper
way to do the same,
Here's what i have been able to think of,

<target name="first-target">
  <var name="build.flag" value="test" />
  <solicit-properties />
</target>

<macrodef name="solicit-properties>
<sequential>
  <antform title="Plugin Build">
    ... <!-- some boolean and text properties -->
  <controlbar>
    <button label="Build" type="ok" focus="true" target="build-proceed" />
    <button label="Reset" type="reset" />
    <button label="Cancel" type="cancel" target="build-cancel" />
  </controlbar>
</sequential>
</macrodef>

<target name="build-cancel">
  <clean-up />
  <fail message="Aborting Build Process. Reason: Recieved Cancel Request."
/>
</target>

<target name="build-proceed">
  <echo message="Proceed Build..." />
  <var name="build.flag" unset="true" />
  <var name="build.flag" value="OK" />
  <echo message="${build.flag}" />
</target>

<target name="build-proceed-check">
  <echo message="${build.flag}" />
  <if>
    <not><equals arg1="${build.flag}" arg2="OK" /></not>
    <then>
      <antcall target="build-cancel" />
    </then>
  </if>
</target>


Ant-Output
========
solicit-properties:
build-proceed:
     [echo] Proceed Build...
     [echo] OK
build-proceed-check:
     [echo] test
build-cancel:
     [echo] Cleaning Classes and Build Directory.....


What I am trying to do here: When the user closes antforms dialog window
('X' button on top right), I want to intercept that and perform code clean
up before aborting the build process.

If anyone can help me with this, i would love to hear from you,

Reply via email to