Skip to content

Package: XmlDateCellEditorTester

XmlDateCellEditorTester

nameinstructionbranchcomplexitylinemethod
XmlDateCellEditorTester()
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%
isApplicable(EObject, EAttribute, ViewModelContext)
M: 2 C: 14
88%
M: 1 C: 3
75%
M: 1 C: 2
67%
M: 1 C: 5
83%
M: 0 C: 1
100%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2015 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: * Johannes Faltermeier - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emfforms.internal.view.control.multiattribute.celleditor;
15:
16: import javax.xml.datatype.XMLGregorianCalendar;
17:
18: import org.eclipse.emf.ecore.EAttribute;
19: import org.eclipse.emf.ecore.EObject;
20: import org.eclipse.emf.ecp.view.spi.context.ViewModelContext;
21: import org.eclipse.emfforms.spi.view.control.multiattribute.celleditor.MultiAttributeSWTRendererCellEditorTester;
22:
23: /**
24: * {@link MultiAttributeSWTRendererCellEditorTester Tester} for XmlDateCellEditor.
25: *
26: * @author Johannes Faltermeier
27: *
28: */
29: public class XmlDateCellEditorTester implements MultiAttributeSWTRendererCellEditorTester {
30:
31:         @Override
32:         public double isApplicable(EObject eObject, EAttribute multiAttribute,
33:                 ViewModelContext viewModelContext) {
34:                 final Class<?> instanceClass = multiAttribute.getEAttributeType().getInstanceClass();
35:•                if (instanceClass == null) {
36:                         return NOT_APPLICABLE;
37:                 }
38:•                if (!XMLGregorianCalendar.class.isAssignableFrom(instanceClass)) {
39:                         return NOT_APPLICABLE;
40:                 }
41:                 return 1d;
42:         }
43:
44: }