Statistics
| Revision:

root / branches / v2_0_0_prep / libraries / libTools / src / org / gvsig / tools / undo / UndoException.java @ 26224

History | View | Annotate | Download (2.53 KB)

1 24796 cordinyana
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Gobernment (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2008 {DiSiD Technologies}  {{Task}}
26
 */
27
package org.gvsig.tools.undo;
28
29
import java.util.Collections;
30
import java.util.Map;
31
32
import org.gvsig.tools.exception.BaseException;
33
34
/**
35
 * Exception thrown when there is an error while performing an undo.
36
 *
37
 * @author <a href="mailto:cordin@disid.com">C?sar Ordi?ana</a>
38
 */
39
public class UndoException extends BaseException {
40
41
    private static final long serialVersionUID = -2530153193164534637L;
42
43
    private final static String MESSAGE_FORMAT = "The element %(undoredo) could not be undone";
44
    private final static String MESSAGE_KEY = "_UndoException";
45
46
    private UndoRedoInfo undoRedoInfo;
47
48
    /**
49
     * Creates a new exception of an error while performing an undo operation.
50
     *
51
     * @param undoRedoInfo
52
     *            the information of the element that could not be undone
53
     */
54
    public UndoException(UndoRedoInfo undoRedoInfo) {
55
        super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
56
        this.undoRedoInfo = undoRedoInfo;
57
    }
58
59
    /**
60
     * Creates a new exception of an error while performing an undo operation.
61
     *
62
     * @param undoRedoInfo
63
     *            the information of the element that could not be undone
64
     * @param cause
65
     *            the original cause of the exception
66
     */
67
    public UndoException(UndoRedoInfo undoRedoInfo, Throwable cause) {
68
        super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
69
        this.undoRedoInfo = undoRedoInfo;
70
    }
71
72
    protected Map values() {
73
        return Collections
74
                .singletonMap("undoredo", undoRedoInfo
75
                .getDescription());
76
    }
77
}