# HG changeset patch # User Jaroslav Tulach # Date 1233126401 -3600 # Node ID 52f941f090cdb73ea893adc6d2a057a821269bda # Parent 5cae522aa3ca1bf827332e722e68e0292170d4ef Initial attempt to provide sample for trycatchredo diff -r 5cae522aa3ca -r 52f941f090cd samples/exceptions/build.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/exceptions/build.xml Wed Jan 28 08:06:41 2009 +0100 @@ -0,0 +1,69 @@ + + + + + + Builds, tests, and runs the project exceptions. + + + diff -r 5cae522aa3ca -r 52f941f090cd samples/exceptions/nbproject/build-impl.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/exceptions/nbproject/build-impl.xml Wed Jan 28 08:06:41 2009 +0100 @@ -0,0 +1,627 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + + + + + + java -cp "${run.classpath.with.dist.jar}" ${main.class} + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + diff -r 5cae522aa3ca -r 52f941f090cd samples/exceptions/nbproject/genfiles.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/exceptions/nbproject/genfiles.properties Wed Jan 28 08:06:41 2009 +0100 @@ -0,0 +1,8 @@ +build.xml.data.CRC32=fee87459 +build.xml.script.CRC32=02c97e29 +build.xml.stylesheet.CRC32=be360661 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=fee87459 +nbproject/build-impl.xml.script.CRC32=ce1d9b31 +nbproject/build-impl.xml.stylesheet.CRC32=f1d9da08 diff -r 5cae522aa3ca -r 52f941f090cd samples/exceptions/nbproject/project.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/exceptions/nbproject/project.properties Wed Jan 28 08:06:41 2009 +0100 @@ -0,0 +1,57 @@ +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/exceptions.jar +dist.javadoc.dir=${dist.dir}/javadoc +excludes= +includes=** +jar.compress=false +javac.classpath= +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.source=1.5 +javac.target=1.5 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir}:\ + ${libs.junit.classpath}:\ + ${libs.junit_4.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +meta.inf.dir=${src.dir}/META-INF +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value +# or test-sys-prop.name=value to set system properties for unit tests): +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=UTF-8 +src.dir=src +test.src.dir=test diff -r 5cae522aa3ca -r 52f941f090cd samples/exceptions/nbproject/project.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/exceptions/nbproject/project.xml Wed Jan 28 08:06:41 2009 +0100 @@ -0,0 +1,16 @@ + + + org.netbeans.modules.java.j2seproject + + + exceptions + 1.6.5 + + + + + + + + + diff -r 5cae522aa3ca -r 52f941f090cd samples/exceptions/src/org/apidesign/exceptions/trycatchredo/SaveAction.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/exceptions/src/org/apidesign/exceptions/trycatchredo/SaveAction.java Wed Jan 28 08:06:41 2009 +0100 @@ -0,0 +1,35 @@ +package org.apidesign.exceptions.trycatchredo; + +import java.awt.EventQueue; +import java.awt.event.ActionEvent; +import java.io.IOException; +import java.io.OutputStream; +import java.net.URL; +import javax.swing.AbstractAction; +import javax.swing.JOptionPane; + +/** + * + * @author Jaroslav Tulach + */ +final class SaveAction extends AbstractAction { + private final URL where; + private final CharSequence what; + + SaveAction(URL where, CharSequence what) { + this.where = where; + this.what = what; + } + + + public void actionPerformed(ActionEvent ev) { + assert EventQueue.isDispatchThread(); + try { + OutputStream os = where.openConnection().getOutputStream(); + os.write(what.toString().getBytes()); + os.close(); + } catch (IOException ex) { + JOptionPane.showMessageDialog(null, ex); + } + } +} diff -r 5cae522aa3ca -r 52f941f090cd samples/exceptions/src/org/apidesign/exceptions/trycatchredo/UserQuestionException.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/exceptions/src/org/apidesign/exceptions/trycatchredo/UserQuestionException.java Wed Jan 28 08:06:41 2009 +0100 @@ -0,0 +1,13 @@ +package org.apidesign.exceptions.trycatchredo; + +import java.io.IOException; +import javax.swing.JComponent; + +/** + * + * @author Jaroslav Tulach + */ +public abstract class UserQuestionException extends IOException { + public abstract JComponent getQuestionPane(); + public abstract void confirm(); +}