Skip to content

Package: SectionLeafSWTRendererService

SectionLeafSWTRendererService

nameinstructionbranchcomplexitylinemethod
SectionLeafSWTRendererService()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getRendererClass()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
isApplicable(VElement, ViewModelContext)
M: 17 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2016 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: * Lucas Koehler - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emf.ecp.view.internal.section.swt;
15:
16: import org.eclipse.emf.ecp.view.spi.context.ViewModelContext;
17: import org.eclipse.emf.ecp.view.spi.model.VElement;
18: import org.eclipse.emf.ecp.view.spi.section.model.VSection;
19: import org.eclipse.emf.ecp.view.spi.section.swt.SectionLeafSWTRenderer;
20: import org.eclipse.emfforms.spi.swt.core.AbstractSWTRenderer;
21: import org.eclipse.emfforms.spi.swt.core.di.EMFFormsDIRendererService;
22: import org.osgi.service.component.annotations.Component;
23:
24: /**
25: * {@link EMFFormsDIRendererService DI renderer service} for {@link SectionLeafSWTRenderer}.
26: *
27: * @author Lucas Koehler
28: *
29: */
30: @Component(name = "SectionLeafSWTRendererService")
31: public class SectionLeafSWTRendererService implements EMFFormsDIRendererService<VSection> {
32:
33:         /**
34:          * {@inheritDoc}
35:          *
36:          * @see org.eclipse.emfforms.spi.swt.core.di.EMFFormsDIRendererService#isApplicable(org.eclipse.emf.ecp.view.spi.model.VElement,
37:          * org.eclipse.emf.ecp.view.spi.context.ViewModelContext)
38:          */
39:         @Override
40:         public double isApplicable(VElement vElement, ViewModelContext viewModelContext) {
41:•                if (!VSection.class.isInstance(vElement)) {
42:                         return NOT_APPLICABLE;
43:                 }
44:•                if (VSection.class.cast(vElement).getChildItems().size() == 0) {
45:                         return 6d;
46:                 }
47:                 return NOT_APPLICABLE;
48:         }
49:
50:         /**
51:          * {@inheritDoc}
52:          *
53:          * @see org.eclipse.emfforms.spi.swt.core.di.EMFFormsDIRendererService#getRendererClass()
54:          */
55:         @Override
56:         public Class<? extends AbstractSWTRenderer<VSection>> getRendererClass() {
57:                 return SectionLeafSWTRenderer.class;
58:         }
59:
60: }