samples/exceptions/src/org/apidesign/exceptions/trycatchredo/IOManager.java
author Jaroslav Tulach <jtulach@netbeans.org>
Sun, 01 Feb 2009 16:03:37 +0100
changeset 310 fba31e9504a1
parent 309 1687adb2b7f0
permissions -rw-r--r--
QueryException interactive example
     1 package org.apidesign.exceptions.trycatchredo;
     2 
     3 import java.net.URL;
     4 import javax.swing.Action;
     5 
     6 /**
     7  *
     8  * @author Jaroslav Tulach <jtulach@netbeans.org>
     9  */
    10 public final class IOManager {
    11     static boolean old;
    12 
    13     IOManager() {
    14     }
    15 
    16     /** Action that can store a text to given URL.
    17      *
    18      * @param where the url to upload the text to
    19      * @param what the text to upload
    20      * @return action that can be invoked anytime to save the content
    21      */
    22     public static Action createSaveAction(URL where, CharSequence what) {
    23         if (old) {
    24             return new SaveAction(where, what);
    25         } else {
    26             return new SaveActionWithQuery(where, what);
    27         }
    28     }
    29 }