Skip to content

Package: EnumCellEditorTester

EnumCellEditorTester

nameinstructionbranchcomplexitylinemethod
EnumCellEditorTester()
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: 0 C: 10
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 4
100%
M: 0 C: 1
100%

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.emfforms.internal.view.control.multiattribute.celleditor;
15:
16: import org.eclipse.emf.ecore.EAttribute;
17: import org.eclipse.emf.ecore.EDataType;
18: import org.eclipse.emf.ecore.EEnum;
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: * Cell editor tester that votes for a cell editor for attributes of {@link EEnum} type.
25: */
26: public class EnumCellEditorTester implements MultiAttributeSWTRendererCellEditorTester {
27:
28:         @Override
29:         public double isApplicable(EObject eObject, EAttribute multiAttribute,
30:                 ViewModelContext viewModelContext) {
31:
32:                 final EDataType dataType = multiAttribute.getEAttributeType();
33:
34:•                if (dataType instanceof EEnum) {
35:                         return 2.0;
36:                 }
37:
38:                 return NOT_APPLICABLE;
39:         }
40:
41: }