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, EStructuralFeature, ViewModelContext)
M: 0 C: 24
100%
M: 0 C: 8
100%
M: 0 C: 5
100%
M: 0 C: 7
100%
M: 0 C: 1
100%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2013 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: * Eugen Neufeld - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emf.ecp.edit.internal.swt.table;
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.ecore.EStructuralFeature;
21: import org.eclipse.emf.ecp.edit.spi.swt.table.ECPCellEditorTester;
22: import org.eclipse.emf.ecp.view.spi.context.ViewModelContext;
23:
24: /**
25: * Tester for xml date cell editor.
26: *
27: * @author Eugen Neufeld
28: *
29: */
30: public class XmlDateCellEditorTester implements ECPCellEditorTester {
31:
32:         /**
33:          * {@inheritDoc}
34:          *
35:          * @see ECPCellEditorTester#isApplicable(EObject, EStructuralFeature,
36:          * org.eclipse.emf.ecp.view.spi.context.ViewModelContext)
37:          */
38:         @Override
39:         public int isApplicable(EObject eObject, EStructuralFeature feature, ViewModelContext viewModelContext) {
40:•                if (EAttribute.class.isInstance(feature) && !feature.isMany()) {
41:                         final Class<?> instanceClass = ((EAttribute) feature).getEAttributeType().getInstanceClass();
42:•                        if (instanceClass == null) {
43:                                 return NOT_APPLICABLE;
44:                         }
45:•                        if (XMLGregorianCalendar.class.isAssignableFrom(instanceClass)) {
46:                                 return 1;
47:                         }
48:                 }
49:                 return NOT_APPLICABLE;
50:         }
51:
52: }