Skip to content

Package: SWTDynamicContainmentItemRenderer

SWTDynamicContainmentItemRenderer

nameinstructionbranchcomplexitylinemethod
SWTDynamicContainmentItemRenderer(DynamicContainmentItem, ViewModelContext, ReportService)
M: 0 C: 7
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
getChildren()
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getCustomVariant()
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%
static {...}
M: 0 C: 14
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 6
100%
M: 0 C: 1
100%

Coverage

1: /**
2: * Copyright (c) 2011-2013 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: * Edgar Mueller - initial API and implementation
13: */
14: package org.eclipse.emf.ecp.view.dynamictree.ui.swt;
15:
16: import java.util.Collection;
17: import java.util.Collections;
18:
19: import org.eclipse.emf.ecp.view.dynamictree.model.DynamicContainmentItem;
20: import org.eclipse.emf.ecp.view.spi.context.ViewModelContext;
21: import org.eclipse.emf.ecp.view.spi.core.swt.ContainerSWTRenderer;
22: import org.eclipse.emf.ecp.view.spi.model.VContainedElement;
23: import org.eclipse.emfforms.spi.common.report.ReportService;
24: import org.eclipse.emfforms.spi.swt.core.EMFFormsRendererFactory;
25: import org.osgi.framework.BundleContext;
26: import org.osgi.framework.FrameworkUtil;
27: import org.osgi.framework.ServiceReference;
28:
29: /**
30: * SWT renderer for {@link DynamicContainmentItem}s.
31: *
32: * @author emueller
33: */
34: public class SWTDynamicContainmentItemRenderer extends ContainerSWTRenderer<DynamicContainmentItem> {
35:
36:         private static final EMFFormsRendererFactory EMFFORMS_RENDERER_FACTORY;
37:
38:         static {
39:                 final BundleContext bundleContext = FrameworkUtil.getBundle(SWTDynamicContainmentTreeRenderer.class)
40:                         .getBundleContext();
41:
42:                 final ServiceReference<EMFFormsRendererFactory> emfFormsLabelProviderServiceReference = bundleContext
43:                         .getServiceReference(EMFFormsRendererFactory.class);
44:                 EMFFORMS_RENDERER_FACTORY = bundleContext.getService(emfFormsLabelProviderServiceReference);
45:         }
46:
47:         /**
48:          * @param vElement the view model element to be rendered
49:          * @param viewContext the view context
50:          * @param reportService the {@link ReportService}
51:          */
52:         public SWTDynamicContainmentItemRenderer(DynamicContainmentItem vElement, ViewModelContext viewContext,
53:                 ReportService reportService) {
54:                 super(vElement, viewContext, reportService, EMFFORMS_RENDERER_FACTORY);
55:         }
56:
57:         /**
58:          * {@inheritDoc}
59:          *
60:          * @see org.eclipse.emf.ecp.view.spi.core.swt.ContainerSWTRenderer#getCustomVariant()
61:          */
62:         @Override
63:         protected String getCustomVariant() {
64:                 // TODO Auto-generated method stub
65:                 return "test";
66:         }
67:
68:         /**
69:          * {@inheritDoc}
70:          *
71:          * @see org.eclipse.emf.ecp.view.spi.core.swt.ContainerSWTRenderer#getChildren()
72:          */
73:
74:         @Override
75:         protected Collection<VContainedElement> getChildren() {
76:                 return Collections.singleton(getVElement().getComposite());
77:         }
78:
79: }