Skip to main content
summaryrefslogtreecommitdiffstats
blob: 23fd795bfb105a51142f3aae574d5647817d3929 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/***********************************************************************
 * Copyright (c) 2008 by SAP AG, Walldorf. 
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     SAP AG - initial API and implementation
 *     Dimiter Dimitrov, d.dimitrov@sap.com - initial API and implementation     
 ***********************************************************************/
package org.eclipse.jpt.ui.internal.wizards.entity;

import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import org.eclipse.osgi.util.NLS;

public class EntityWizardMsg extends NLS {	
	
    private static final String BUNDLE_NAME = "jpt_ui_entity_wizard";//$NON-NLS-1$
    private static ResourceBundle resourceBundle;

    public static String ENTITY_WIZARD_TITLE;
    public static String ADD_ENTITY_WIZARD_PAGE_TITLE;    
    public static String ADD_ENTITY_WIZARD_PAGE_DESCRIPTION;
    public static String DEFAULT_PACKAGE_WARNING;
    public static String ENTITY_PROPERTIES_TITLE;
    public static String ENTITY_PROPERTIES_DESCRIPTION;
    public static String ENTITY;
    public static String MAPPED_AS_SUPERCLASS;
    public static String INHERITANCE_GROUP;
    public static String INHERITANCE_CHECK_BOX;
    public static String XML_STORAGE_GROUP;
    public static String XML_SUPPORT;    
    public static String CHOOSE_XML;
    public static String MAPPING_XML_TITLE;
    public static String XML_NAME_TITLE;
    public static String INCORRECT_XML_NAME;
    public static String CHOOSE_MAPPING_XML_MESSAGE;
    public static String TYPE_DIALOG_TITLE;
    public static String TYPE_DIALOG_DESCRIPTION;
    public static String ENTITY_NAME;
    public static String TABLE_NAME;
    public static String TABLE_NAME_GROUP;
    public static String USE_DEFAULT;
    public static String ENTITY_FIELDS_DIALOG_TITLE;
    public static String ENTITY_FIELDS_GROUP;
    public static String KEY;
    public static String NAME_COLUMN;
    public static String TYPE_COLUMN;
	public static String NAME_TEXT_FIELD;
    public static String TYPE_TEXT_FIELD;
    public static String BROWSE_BUTTON_LABEL;
    public static String ADD_BUTTON_LABEL;
    public static String EDIT_BUTTON_LABEL;
    public static String REMOVE_BUTTON_LABEL;
    public static String DUPLICATED_ENTITY_NAMES_MESSAGE;
    public static String ACCESS_TYPE;
    public static String FIELD_BASED;
    public static String PROPERTY_BASED;
    public static String NO_JPA_PROJECTS;      
    public static String APPLY_CHANGES_TO_PERSISTENCE_XML;
    public static String ADD_MAPPED_SUPERCLASS_TO_XML;
    public static String ADD_ENTITY_TO_XML;
    private EntityWizardMsg() {
        // prevent instantiation of class
    }    
    
	static {
		NLS.initializeMessages(BUNDLE_NAME, EntityWizardMsg.class);
	}

    /**
     * Returns the resource bundle used by all classes in this Project
     */
    public static ResourceBundle getResourceBundle() {
        try {
            return ResourceBundle.getBundle(BUNDLE_NAME);//$NON-NLS-1$
        } catch (MissingResourceException e) {
            // does nothing - this method will return null and getString(String) will return 
        	// the key it was called with
        }
        return null;
    }

    /**
     * Returns the externalized string, mapped to this key
     * @param key 
     * @return the text mapped to the key parameter
     */
    public static String getString(String key) {
        if (resourceBundle == null) {
            resourceBundle = getResourceBundle();
        }

        if (resourceBundle != null) {
            try {
                return resourceBundle.getString(key);
            } catch (MissingResourceException e) {
            	//exception during string obtaining
                return "-" + key + "-";//$NON-NLS-2$//$NON-NLS-1$
            }
        }
        //return key, because the relevant string missing in the bundle
        return "+" + key + "+";//$NON-NLS-2$//$NON-NLS-1$
    }

    /**
     * Returns the formated string, mapped to this key
     * @param key
     * @param arguments
     * @return the formated text, mapped to this key, with substituted arguments 
     */
    public static String getString(String key, Object[] arguments) {
        try {
            return MessageFormat.format(getString(key), arguments);
        } catch (IllegalArgumentException e) {
            return getString(key);
        }
    } 
	
}

Back to the top