Skip to content

Package: SWTContextUtil

SWTContextUtil

nameinstructionbranchcomplexitylinemethod
setAbstractSWTRendererObjects(IEclipseContext, VElement, ViewModelContext, Composite)
M: 9 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%

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.util;
15:
16: import org.eclipse.e4.core.contexts.IEclipseContext;
17: import org.eclipse.emf.ecp.view.model.common.di.util.ContextUtil;
18: import org.eclipse.emf.ecp.view.spi.context.ViewModelContext;
19: import org.eclipse.emf.ecp.view.spi.model.VElement;
20: import org.eclipse.swt.widgets.Composite;
21:
22: /**
23: * SWT util class for injection all needed objects in an {@link IEclipseContext}.
24: *
25: * @author jfaltermeier
26: *
27: */
28: @SuppressWarnings("restriction")
29: public final class SWTContextUtil {
30:
31:         private SWTContextUtil() {
32:
33:         }
34:
35:         /**
36:          * Sets the given elements in the {@link IEclipseContext}. This method will call
37:          * {@link ContextUtil#setAbstractRendererObjects(IEclipseContext, VElement, ViewModelContext)}.
38:          *
39:          * @param eclipseContext the eclipse context to add the element to
40:          * @param element the {@link VElement}
41:          * @param viewModelContext the {@link ViewModelContext}
42:          * @param parent the {@link Composite} to draw onto
43:          */
44:         public static void setAbstractSWTRendererObjects(IEclipseContext eclipseContext, VElement element,
45:                 ViewModelContext viewModelContext, Composite parent) {
46:                 ContextUtil.setAbstractRendererObjects(eclipseContext, element, viewModelContext);
47:                 eclipseContext.set(Composite.class, parent);
48:         }
49:
50: }