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
jtulach@308
     1
package org.apidesign.exceptions.trycatchredo;
jtulach@308
     2
jtulach@308
     3
import java.net.URL;
jtulach@308
     4
import javax.swing.Action;
jtulach@308
     5
jtulach@308
     6
/**
jtulach@308
     7
 *
jtulach@308
     8
 * @author Jaroslav Tulach <jtulach@netbeans.org>
jtulach@308
     9
 */
jtulach@308
    10
public final class IOManager {
jtulach@310
    11
    static boolean old;
jtulach@310
    12
jtulach@308
    13
    IOManager() {
jtulach@308
    14
    }
jtulach@308
    15
jtulach@310
    16
    /** Action that can store a text to given URL.
jtulach@310
    17
     *
jtulach@310
    18
     * @param where the url to upload the text to
jtulach@310
    19
     * @param what the text to upload
jtulach@310
    20
     * @return action that can be invoked anytime to save the content
jtulach@310
    21
     */
jtulach@308
    22
    public static Action createSaveAction(URL where, CharSequence what) {
jtulach@310
    23
        if (old) {
jtulach@310
    24
            return new SaveAction(where, what);
jtulach@310
    25
        } else {
jtulach@310
    26
            return new SaveActionWithQuery(where, what);
jtulach@310
    27
        }
jtulach@308
    28
    }
jtulach@308
    29
}