1 /**
2  * Copyright (c) 2008, 2015 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *      IBM Corporation - initial API and implementation
13  */
14 package org.eclipse.e4.ui.model.application.ui.menu;
15 
16 import java.util.Arrays;
17 import java.util.Collections;
18 import java.util.List;
19 
20 /**
21  * <!-- begin-user-doc -->
22  * A representation of the literals of the enumeration '<em><b>Item Type</b></em>',
23  * and utility methods for working with them.
24  * <!-- end-user-doc -->
25  * <!-- begin-model-doc -->
26  * <p>
27  * This enum defines the style of a menu or toolbar item.
28  * </p>
29  * @since 1.0
30  * <!-- end-model-doc -->
31  * @see org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl#getItemType()
32  * @model
33  * @generated
34  */
35 public enum ItemType implements InternalItemType {
36 	/**
37 	 * The '<em><b>Push</b></em>' literal object.
38 	 * <!-- begin-user-doc -->
39 	 * <!-- end-user-doc -->
40 	 * @see #PUSH_VALUE
41 	 * @generated
42 	 * @ordered
43 	 */
44 	PUSH(0, "Push", "Push"), //$NON-NLS-1$ //$NON-NLS-2$
45 
46 	/**
47 	 * The '<em><b>Check</b></em>' literal object.
48 	 * <!-- begin-user-doc -->
49 	 * <!-- end-user-doc -->
50 	 * @see #CHECK_VALUE
51 	 * @generated
52 	 * @ordered
53 	 */
54 	CHECK(1, "Check", "Check"), //$NON-NLS-1$ //$NON-NLS-2$
55 
56 	/**
57 	 * The '<em><b>Radio</b></em>' literal object.
58 	 * <!-- begin-user-doc -->
59 	 * <!-- end-user-doc -->
60 	 * @see #RADIO_VALUE
61 	 * @generated
62 	 * @ordered
63 	 */
64 	RADIO(2, "Radio", "Radio"); //$NON-NLS-1$ //$NON-NLS-2$
65 
66 	/**
67 	 * The '<em><b>Push</b></em>' literal value.
68 	 * <!-- begin-user-doc -->
69 	 * <!-- end-user-doc -->
70 	 * @see #PUSH
71 	 * @model name="Push"
72 	 * @generated
73 	 * @ordered
74 	 */
75 	public static final int PUSH_VALUE = 0;
76 
77 	/**
78 	 * The '<em><b>Check</b></em>' literal value.
79 	 * <!-- begin-user-doc -->
80 	 * <!-- end-user-doc -->
81 	 * @see #CHECK
82 	 * @model name="Check"
83 	 * @generated
84 	 * @ordered
85 	 */
86 	public static final int CHECK_VALUE = 1;
87 
88 	/**
89 	 * The '<em><b>Radio</b></em>' literal value.
90 	 * <!-- begin-user-doc -->
91 	 * <!-- end-user-doc -->
92 	 * @see #RADIO
93 	 * @model name="Radio"
94 	 * @generated
95 	 * @ordered
96 	 */
97 	public static final int RADIO_VALUE = 2;
98 
99 	/**
100 	 * An array of all the '<em><b>Item Type</b></em>' enumerators.
101 	 * <!-- begin-user-doc -->
102 	 * <!-- end-user-doc -->
103 	 * @generated
104 	 */
105 	private static final ItemType[] VALUES_ARRAY = new ItemType[] { PUSH, CHECK, RADIO, };
106 
107 	/**
108 	 * A public read-only list of all the '<em><b>Item Type</b></em>' enumerators.
109 	 * <!-- begin-user-doc -->
110 	 * <!-- end-user-doc -->
111 	 * @generated
112 	 */
113 	public static final List<ItemType> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
114 
115 	/**
116 	 * Returns the '<em><b>Item Type</b></em>' literal with the specified literal value.
117 	 * <!-- begin-user-doc -->
118 	 * <!-- end-user-doc -->
119 	 * @param literal the literal.
120 	 * @return the matching enumerator or <code>null</code>.
121 	 * @generated
122 	 */
get(String literal)123 	public static ItemType get(String literal) {
124 		for (int i = 0; i < VALUES_ARRAY.length; ++i) {
125 			ItemType result = VALUES_ARRAY[i];
126 			if (result.toString().equals(literal)) {
127 				return result;
128 			}
129 		}
130 		return null;
131 	}
132 
133 	/**
134 	 * Returns the '<em><b>Item Type</b></em>' literal with the specified name.
135 	 * <!-- begin-user-doc -->
136 	 * <!-- end-user-doc -->
137 	 * @param name the name.
138 	 * @return the matching enumerator or <code>null</code>.
139 	 * @generated
140 	 */
getByName(String name)141 	public static ItemType getByName(String name) {
142 		for (int i = 0; i < VALUES_ARRAY.length; ++i) {
143 			ItemType result = VALUES_ARRAY[i];
144 			if (result.getName().equals(name)) {
145 				return result;
146 			}
147 		}
148 		return null;
149 	}
150 
151 	/**
152 	 * Returns the '<em><b>Item Type</b></em>' literal with the specified integer value.
153 	 * <!-- begin-user-doc -->
154 	 * <!-- end-user-doc -->
155 	 * @param value the integer value.
156 	 * @return the matching enumerator or <code>null</code>.
157 	 * @generated
158 	 */
get(int value)159 	public static ItemType get(int value) {
160 		switch (value) {
161 		case PUSH_VALUE:
162 			return PUSH;
163 		case CHECK_VALUE:
164 			return CHECK;
165 		case RADIO_VALUE:
166 			return RADIO;
167 		default:
168 			return null;
169 		}
170 	}
171 
172 	/**
173 	 * <!-- begin-user-doc -->
174 	 * <!-- end-user-doc -->
175 	 * @generated
176 	 */
177 	private final int value;
178 
179 	/**
180 	 * <!-- begin-user-doc -->
181 	 * <!-- end-user-doc -->
182 	 * @generated
183 	 */
184 	private final String name;
185 
186 	/**
187 	 * <!-- begin-user-doc -->
188 	 * <!-- end-user-doc -->
189 	 * @generated
190 	 */
191 	private final String literal;
192 
193 	/**
194 	 * Only this class can construct instances.
195 	 * <!-- begin-user-doc -->
196 	 * <!-- end-user-doc -->
197 	 * @generated
198 	 */
ItemType(int value, String name, String literal)199 	private ItemType(int value, String name, String literal) {
200 		this.value = value;
201 		this.name = name;
202 		this.literal = literal;
203 	}
204 
205 	/**
206 	 * <!-- begin-user-doc -->
207 	 * <!-- end-user-doc -->
208 	 * @generated
209 	 */
210 	@Override
getValue()211 	public int getValue() {
212 		return value;
213 	}
214 
215 	/**
216 	 * <!-- begin-user-doc -->
217 	 * <!-- end-user-doc -->
218 	 * @generated
219 	 */
220 	@Override
getName()221 	public String getName() {
222 		return name;
223 	}
224 
225 	/**
226 	 * <!-- begin-user-doc -->
227 	 * <!-- end-user-doc -->
228 	 * @generated
229 	 */
230 	@Override
getLiteral()231 	public String getLiteral() {
232 		return literal;
233 	}
234 
235 	/**
236 	 * Returns the literal value of the enumerator, which is its string representation.
237 	 * <!-- begin-user-doc -->
238 	 * <!-- end-user-doc -->
239 	 * @generated
240 	 */
241 	@Override
toString()242 	public String toString() {
243 		return literal;
244 	}
245 
246 } //ItemType
247 
248 /**
249  * A private implementation interface used to hide the inheritance from Enumerator.
250  * <!-- begin-user-doc -->
251  * <!-- end-user-doc -->
252  * @generated
253  */
254 interface InternalItemType extends org.eclipse.emf.common.util.Enumerator {
255 	// Empty
256 }
257