-
Notifications
You must be signed in to change notification settings - Fork 7
/
ValidationLiveProblemsDestination.java
88 lines (74 loc) · 2.24 KB
/
ValidationLiveProblemsDestination.java
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
/******************************************************************************
* Copyright (c) 2004, 2007 IBM Corporation and others.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
****************************************************************************/
package org.eclipse.emf.validation.ui.internal.preferences;
import java.util.Arrays;
import java.util.List;
import org.eclipse.emf.common.util.Enumerator;
import org.eclipse.emf.validation.ui.internal.ValidationUIPlugin;
/**
* An enumeration of destinations for display of live validation problems.
*
* @author Christian W. Damus (cdamus)
*/
public enum ValidationLiveProblemsDestination implements Enumerator {
DIALOG("Dialog"), //$NON-NLS-1$
CONSOLE("Console"); //$NON-NLS-1$
private String name;
/**
* The list of values for this enumerated type.
*/
private static final ValidationLiveProblemsDestination[] VALUES = { DIALOG, CONSOLE };
/**
* Gets the preference setting for live validation problems destination.
*
* @return the preference setting
*/
public static ValidationLiveProblemsDestination getPreferenceSetting() {
String name = ValidationUIPlugin.getPlugin().getPluginPreferences()
.getString(IPreferenceConstants.VALIDATION_LIVE_PROBLEMS_DISPLAY);
if (name.equals(DIALOG.getName())) {
return DIALOG;
}
return CONSOLE;
}
/**
* Constructor for ValidationLiveProblemsDestination.
*
* @param name The name for the ValidationLiveProblemsDestination type
*/
private ValidationLiveProblemsDestination(String name) {
this.name = name;
}
/**
* Retrieves the list of constants for this enumerated type.
*
* @return The list of constants for this enumerated type.
*/
protected List<ValidationLiveProblemsDestination> getValues() {
return Arrays.asList(VALUES);
}
public int getOrdinal() {
return getValue();
}
@Override
public String getName() {
return name;
}
@Override
public int getValue() {
return ordinal();
}
@Override
public String getLiteral() {
return getName();
}
}