Skip to content

Package: SWTRenderingHelper

SWTRenderingHelper

nameinstructionbranchcomplexitylinemethod
SWTRenderingHelper()
M: 13 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
getLayoutHelper()
M: 11 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
getResultRowFactory()
M: 11 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
static {...}
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

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: * Eugen Neufeld - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emf.ecp.edit.internal.swt.util;
15:
16: import org.eclipse.emf.ecp.view.spi.renderer.LayoutHelper;
17: import org.eclipse.emf.ecp.view.spi.renderer.RenderingConfiguration;
18: import org.eclipse.emf.ecp.view.spi.renderer.RenderingResultRowFactory;
19: import org.eclipse.swt.widgets.Control;
20: import org.eclipse.swt.widgets.Layout;
21:
22: /**
23: * @author Eugen Neufeld
24: *
25: */
26: @Deprecated
27: public final class SWTRenderingHelper {
28:
29:         /**
30:          * Singleton instance.
31:          */
32:         public static final SWTRenderingHelper INSTANCE = new SWTRenderingHelper();
33:
34:         private final LayoutHelper<Layout> defaultLayoutHelper;
35:         private final RenderingResultRowFactory<Control> defaultRowFactory;
36:
37:         /**
38:          *
39:          */
40:         private SWTRenderingHelper() {
41:                 defaultLayoutHelper = new DefaultLayoutHelper();
42:                 defaultRowFactory = new DefaultRenderingResultFactory();
43:         }
44:
45:         /**
46:          *
47:          * @return A {@link LayoutHelper} based on the current {@link RenderingConfiguration}.
48:          */
49:         public LayoutHelper<Layout> getLayoutHelper() {
50:                 final LayoutHelper<Layout> layoutHelper = RenderingConfiguration.getCurrent().getLayoutHelper(Layout.class);
51:•                if (layoutHelper != null) {
52:                         return layoutHelper;
53:                 }
54:                 return defaultLayoutHelper;
55:         }
56:
57:         public RenderingResultRowFactory<Control> getResultRowFactory() {
58:                 final RenderingResultRowFactory<Control> rowFactory = RenderingConfiguration.getCurrent()
59:                         .getRenderingRowFactory(Control.class);
60:•                if (rowFactory != null) {
61:                         return rowFactory;
62:                 }
63:                 return defaultRowFactory;
64:         }
65:
66: }