Skip to content

Package: SWTCategorizationElementRendererService

SWTCategorizationElementRendererService

nameinstructionbranchcomplexitylinemethod
SWTCategorizationElementRendererService()
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%
getRendererClass()
M: 0 C: 2
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
isApplicable(VElement, ViewModelContext)
M: 0 C: 14
100%
M: 0 C: 4
100%
M: 0 C: 3
100%
M: 0 C: 4
100%
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: * Eugen Neufeld - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emf.ecp.view.internal.categorization.swt;
15:
16: import org.eclipse.emf.ecp.view.spi.categorization.model.VCategorizationElement;
17: import org.eclipse.emf.ecp.view.spi.categorization.swt.SWTCategorizationElementRenderer;
18: import org.eclipse.emf.ecp.view.spi.context.ViewModelContext;
19: import org.eclipse.emf.ecp.view.spi.model.VElement;
20: import org.eclipse.emfforms.spi.swt.core.AbstractSWTRenderer;
21: import org.eclipse.emfforms.spi.swt.core.di.EMFFormsDIRendererService;
22:
23: /**
24: * SWTCategorizationElementRendererService which provides the SWTCategorizationElementRenderer.
25: *
26: * @author Eugen Neufeld
27: *
28: */
29: public class SWTCategorizationElementRendererService implements EMFFormsDIRendererService<VCategorizationElement> {
30:
31:         /**
32:          * {@inheritDoc}
33:          *
34:          * @see org.eclipse.emfforms.spi.swt.core.EMFFormsRendererService#isApplicable(VElement,ViewModelContext)
35:          */
36:         @Override
37:         public double isApplicable(VElement vElement, ViewModelContext viewModelContext) {
38:•                if (VCategorizationElement.class.isInstance(vElement)) {
39:•                        if (VCategorizationElement.class.cast(vElement).getMainCategoryDepth() == 0) {
40:                                 return 1;
41:                         }
42:                 }
43:                 return NOT_APPLICABLE;
44:         }
45:
46:         /**
47:          * {@inheritDoc}
48:          *
49:          * @see org.eclipse.emfforms.spi.swt.core.di.EMFFormsDIRendererService#getRendererClass()
50:          */
51:         @Override
52:         public Class<? extends AbstractSWTRenderer<VCategorizationElement>> getRendererClass() {
53:                 return SWTCategorizationElementRenderer.class;
54:         }
55:
56: }