Skip to content

Package: SingleReferenceCellEditorTester

SingleReferenceCellEditorTester

nameinstructionbranchcomplexitylinemethod
SingleReferenceCellEditorTester()
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: 2 C: 17
89%
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-2019 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: * EclipseSource Munich - initial API and implementation
13: */
14: package org.eclipse.emf.ecp.view.internal.table.swt.cell;
15:
16: import org.eclipse.emf.ecore.EObject;
17: import org.eclipse.emf.ecore.EReference;
18: import org.eclipse.emf.ecore.EStructuralFeature;
19: import org.eclipse.emf.ecp.edit.spi.swt.table.ECPCellEditorTester;
20: import org.eclipse.emf.ecp.view.spi.context.ViewModelContext;
21:
22: /**
23: * Single reference cell editor tester.
24: *
25: * @author Mat Hansen <mhansen@eclipsesource.com>
26: * @author Eugen Neufeld <eneufeld@eclipsesource.com>
27: * @since 1.22
28: *
29: */
30: public class SingleReferenceCellEditorTester implements ECPCellEditorTester {
31:
32:         @Override
33:         public int isApplicable(EObject eObject, EStructuralFeature eStructuralFeature, ViewModelContext viewModelContext) {
34:•                if (!EReference.class.isInstance(eStructuralFeature)) {
35:                         return NOT_APPLICABLE;
36:                 }
37:
38:                 final EReference eReference = EReference.class.cast(eStructuralFeature);
39:•                if (eReference.getUpperBound() == 1) {
40:                         return 10;
41:                 }
42:
43:                 return NOT_APPLICABLE;
44:         }
45:
46: }