Skip to content

Package: ValidationServiceConstants

ValidationServiceConstants

nameinstructionbranchcomplexitylinemethod
static {...}
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2019 Christian W. Damus and others.
3: *
4: * All rights reserved. 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: * Christian W. Damus - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emf.ecp.view.spi.validation;
15:
16: import java.util.Map;
17:
18: import org.eclipse.emf.ecore.EObject;
19: import org.eclipse.emf.ecp.view.spi.context.ViewModelContext;
20: import org.eclipse.emf.ecp.view.spi.context.ViewModelContextFactory;
21: import org.eclipse.emf.ecp.view.spi.context.ViewModelService;
22: import org.eclipse.emf.ecp.view.spi.model.VElement;
23:
24: /**
25: * Constants for use with the {@link ValidationService}.
26: *
27: * @since 1.21
28: */
29: public final class ValidationServiceConstants {
30:         /**
31:          * <p>
32:          * Key of a {@linkplain ViewModelContext#putContextValue(String, Object) context value}
33:          * specifying a limit for the number of problems propagated up the view model hierarchy
34:          * from any given control. Values are either a positive {@link Integer} for a propagation limit
35:          * or {@code "*"} for unlimited propagation. The default is unlimited propagation, so the
36:          * use cases for the {@code "*"} value should be few in number.
37:          * </p>
38:          * <p>
39:          * If this value is to be injected into the context by a client application, it is
40:          * recommended to do so via the factory APIs that accept an initial map of context values,
41:          * for example,
42:          * {@link ViewModelContextFactory#createViewModelContext(VElement, EObject, Map)}.
43:          * For applications that are not in control of the editor's context lifecycle, an alternative
44:          * approach is to set context values in the {@linkplain ViewModelService#instantiate(ViewModelContext)
45:          * initialization} of a global {@link ViewModelService} registered at a priority
46:          * less than the {@link ValidationService} priority (which by default is {@code 1.0}. This ensures that the service
47:          * setting the context value is initialized before the validation service, so that the context value can be put
48:          * before the validation service picks it up.
49:          * </p>
50:          *
51:          * @see ViewModelContext#putContextValue(String, Object)
52:          * @see ViewModelContextFactory#createViewModelContext(VElement, EObject, Map)
53:          * @see #PROPAGATION_UNLIMITED_VALUE
54:          */
55:         public static final String PROPAGATION_LIMIT_KEY = "org.eclipse.emf.ecp.view.validation.propagationLimit"; //$NON-NLS-1$
56:
57:         /**
58:          * Value of the {@linkplain #PROPAGATION_LIMIT_KEY propagation limit} in the context
59:          * indicating unlimited propagation (which is the default in the absence of any value).
60:          *
61:          * @see #PROPAGATION_LIMIT_KEY
62:          */
63:         public static final Object PROPAGATION_UNLIMITED_VALUE = "*"; //$NON-NLS-1$
64:
65:         /**
66:          * Not instantiable by clients.
67:          */
68:         private ValidationServiceConstants() {
69:                 super();
70:         }
71:
72: }