~ubuntu-branches/debian/squeeze/latexdraw/squeeze

« back to all changes in this revision

Viewing changes to latexDraw/util/LaTeXDrawException.java

  • Committer: Bazaar Package Importer
  • Author(s): Stuart Prescott
  • Date: 2009-05-03 23:49:35 UTC
  • Revision ID: james.westby@ubuntu.com-20090503234935-cls7n48x018g0vk2
Tags: upstream-2.0.2+1
ImportĀ upstreamĀ versionĀ 2.0.2+1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package latexDraw.util;
 
2
 
 
3
import latexDraw.lang.LaTeXDrawLang;
 
4
 
 
5
/** 
 
6
 * This class allows the management of exceptions.
 
7
 * This file is part of LaTeXDraw<br>
 
8
 * Copyright (c) 2005-2008 Arnaud BLOUIN<br>
 
9
 *<br>
 
10
 *  LaTeXDraw is free software; you can redistribute it and/or modify
 
11
 *  it under the terms of the GNU General Public License as published by
 
12
 *  the Free Software Foundation; either version 2 of the License, or
 
13
 *  (at your option) any later version.<br>
 
14
 *<br>
 
15
 *  LaTeXDraw is distributed without any warranty; without even the 
 
16
 *  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
 
17
 *  PURPOSE.  See the GNU General Public License for more details.<br>
 
18
 *<br>
 
19
 * 01/20/06<br>
 
20
 * @author Arnaud BLOUIN<br>
 
21
 * @version 2.0.0<br>
 
22
 */
 
23
public class LaTeXDrawException extends Exception
 
24
{
 
25
        private static final long serialVersionUID = 1L;
 
26
 
 
27
        /** The code of the exception generated */
 
28
        private int errorCode;
 
29
        
 
30
        public static final short INCORRECT_VALUE      = 0;
 
31
        public static final short NOT_TEXDRAW_FILE     = 1;
 
32
        public static final short INVALID_TEXDRAW_VERSION = 2;
 
33
        public static final short INVALID_PICTURE               = 3;
 
34
        
 
35
        
 
36
        /**
 
37
         * The constructor using the identifier of the error
 
38
         * @param errorCode The identifier of the error
 
39
         */
 
40
        public LaTeXDrawException(int errorCode)
 
41
        { 
 
42
                this.errorCode = errorCode; 
 
43
        }
 
44
        
 
45
        
 
46
        
 
47
        /**
 
48
         * Allows to get the code of the error
 
49
         * @return The code of the error
 
50
         */
 
51
        public int getErrorCode() 
 
52
        { 
 
53
                return errorCode; 
 
54
        }
 
55
        
 
56
        
 
57
        
 
58
        @Override
 
59
        public String toString()
 
60
        {
 
61
                switch(errorCode)
 
62
                {                       
 
63
                        case INCORRECT_VALUE                    : return LaTeXDrawLang.getOthersString("LaTeXDrawException.valueInc"); //$NON-NLS-1$
 
64
                        case NOT_TEXDRAW_FILE                   : return LaTeXDrawLang.getOthersString("LaTeXDrawException.invFile"); //$NON-NLS-1$
 
65
                        case INVALID_TEXDRAW_VERSION    : return LaTeXDrawLang.getOthersString("LaTeXDrawException.invLaTeXDrawVer"); //$NON-NLS-1$
 
66
                        case INVALID_PICTURE                    : return LaTeXDrawLang.getString1_7("LaTeXDrawException.0"); //$NON-NLS-1$
 
67
                        
 
68
                        default  : return LaTeXDrawLang.getOthersString("LaTeXDrawException.invException"); //$NON-NLS-1$
 
69
                }
 
70
        }
 
71
}