Skip to content

Package: MakeItHappenEntryPoint

MakeItHappenEntryPoint

nameinstructionbranchcomplexitylinemethod
MakeItHappenEntryPoint()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
createContents(Composite)
M: 41 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 12 C: 0
0%
M: 1 C: 0
0%
getDummyEObject()
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /**
2: * Copyright (c) 2011-2016 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: * EclipseSource Munich - initial API and implementation
13: */
14: package org.eclipse.emf.ecp.makeithappen.application.sample.rap.j2ee;
15:
16: import org.eclipse.emf.ecore.EClass;
17: import org.eclipse.emf.ecore.EObject;
18: import org.eclipse.emf.ecore.util.EcoreUtil;
19: import org.eclipse.emf.ecp.makeithappen.model.task.TaskPackage;
20: import org.eclipse.emf.ecp.ui.view.ECPRendererException;
21: import org.eclipse.emf.ecp.ui.view.swt.ECPSWTViewRenderer;
22: import org.eclipse.jface.layout.GridDataFactory;
23: import org.eclipse.jface.layout.GridLayoutFactory;
24: import org.eclipse.rap.rwt.application.AbstractEntryPoint;
25: import org.eclipse.swt.SWT;
26: import org.eclipse.swt.widgets.Composite;
27:
28: /**
29: * Entry Point for a standalone RAP Application.
30: */
31: public class MakeItHappenEntryPoint extends AbstractEntryPoint {
32:
33:         private static final long serialVersionUID = 1L;
34:
35:         private EObject getDummyEObject() {
36:                 // Replace this with your own model EClass to test the application with a custom model
37:                 final EClass eClass = TaskPackage.eINSTANCE.getUser();
38:                 return EcoreUtil.create(eClass);
39:         }
40:
41:         /**
42:          * {@inheritDoc}
43:          *
44:          * @see org.eclipse.rap.rwt.application.AbstractEntryPoint#createContents(org.eclipse.swt.widgets.Composite)
45:          */
46:         @Override
47:         protected void createContents(Composite parent) {
48:                 // Special call needed only on RAP J2EE
49:                 RealmSetter.initialize();
50:
51:                 final EObject dummyObject = getDummyEObject();
52:
53:                 try {
54:                         final Composite content = new Composite(parent, SWT.NONE);
55:                         content.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
56:                         content.setLayout(GridLayoutFactory.fillDefaults().margins(10, 10).create());
57:                         content.setLayoutData(GridDataFactory.fillDefaults().create());
58:
59:                         ECPSWTViewRenderer.INSTANCE.render(content, dummyObject);
60:
61:                         content.layout();
62:
63:                 } catch (final ECPRendererException e) {
64:                         e.printStackTrace();
65:                 }
66:
67:                 parent.pack();
68:         }
69:
70: }