Skip to content

Package: ViewModelServiceNotAvailableReport

ViewModelServiceNotAvailableReport

nameinstructionbranchcomplexitylinemethod
ViewModelServiceNotAvailableReport(Class)
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
getMessage()
M: 0 C: 11
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
getServiceType()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getSeverity()
M: 0 C: 2
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2014 EclipseSource Muenchen GmbH 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: * Edgar Mueller - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emf.ecp.view.spi.context;
15:
16: import org.eclipse.core.runtime.IStatus;
17: import org.eclipse.emfforms.spi.common.report.AbstractReport;
18:
19: /**
20: * Indicates that {@link org.eclipse.emf.ecp.view.spi.context.ViewModelService ViewModelService} is not available.
21: *
22: * @author emueller
23: * @since 1.5
24: *
25: */
26: public class ViewModelServiceNotAvailableReport extends AbstractReport {
27:
28:         private static final String NO_VIEW_SERVICE_OF_TYPE_FOUND = "No view service of type '%1$s' found."; //$NON-NLS-1$
29:         private final Class<?> serviceType;
30:
31:         /**
32:          * Constructor.
33:          *
34:          * @param serviceType
35:          * the type of the unavailable service
36:          */
37:         public ViewModelServiceNotAvailableReport(Class<?> serviceType) {
38:                 this.serviceType = serviceType;
39:         }
40:
41:         /**
42:          * Returns the type of the unavailable service.
43:          *
44:          * @return the type of the unavailable service
45:          */
46:         public Class<?> getServiceType() {
47:                 return serviceType;
48:         }
49:
50:         /**
51:          *
52:          * {@inheritDoc}
53:          *
54:          * @see org.eclipse.emfforms.spi.common.report.AbstractReport#getMessage()
55:          */
56:         @Override
57:         public String getMessage() {
58:                 return String.format(
59:                         NO_VIEW_SERVICE_OF_TYPE_FOUND, getServiceType().getCanonicalName());
60:         }
61:
62:         /**
63:          *
64:          * {@inheritDoc}
65:          *
66:          * @see org.eclipse.emfforms.spi.common.report.AbstractReport#getSeverity()
67:          */
68:         @Override
69:         public int getSeverity() {
70:                 return IStatus.ERROR;
71:         }
72:
73: }