Skip to content

Package: DIContainerSWTRendererTester

DIContainerSWTRendererTester

nameinstructionbranchcomplexitylinemethod
DIContainerSWTRendererTester()
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(VElement, ViewModelContext)
M: 12 C: 8
40%
M: 2 C: 2
50%
M: 1 C: 2
67%
M: 4 C: 4
50%
M: 0 C: 1
100%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2014 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: * jfaltermeier - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emf.ecp.ui.view.swt.di.renderer;
15:
16: import java.util.NoSuchElementException;
17:
18: import org.eclipse.emf.ecp.view.model.common.ECPRendererTester;
19: import org.eclipse.emf.ecp.view.model.common.di.renderer.POJORendererFactory;
20: import org.eclipse.emf.ecp.view.spi.context.ViewModelContext;
21: import org.eclipse.emf.ecp.view.spi.model.VContainer;
22: import org.eclipse.emf.ecp.view.spi.model.VElement;
23:
24: /**
25: * @author jfaltermeier
26: *
27: */
28: @SuppressWarnings("restriction")
29: public class DIContainerSWTRendererTester implements ECPRendererTester {
30:
31:         /**
32:          * {@inheritDoc}
33:          *
34:          * @see org.eclipse.emf.ecp.view.model.common.ECPRendererTester#isApplicable(org.eclipse.emf.ecp.view.spi.model.VElement,
35:          * org.eclipse.emf.ecp.view.spi.context.ViewModelContext)
36:          */
37:         @Override
38:         public int isApplicable(VElement vElement, ViewModelContext viewModelContext) {
39:•                if (!(vElement instanceof VContainer)) {
40:                         return NOT_APPLICABLE;
41:                 }
42:                 Object renderer;
43:                 try {
44:                         renderer = POJORendererFactory.getInstance().getRenderer(vElement, viewModelContext);
45:                 } catch (final NoSuchElementException ex) {
46:                         return NOT_APPLICABLE;
47:                 }
48:•                if (renderer == null) {
49:                         return NOT_APPLICABLE;
50:                 }
51:                 return 5;
52:         }
53:
54: }