Skip to content

Package: Application

Application

nameinstructionbranchcomplexitylinemethod
Application()
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%
start(IApplicationContext)
M: 21 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%
stop()
M: 17 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 6 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: * EclipseSource Munich - initial API and implementation
13: */
14: package org.eclipse.emf.ecp.makeithappen.application.sample.rap;
15:
16: import org.eclipse.equinox.app.IApplication;
17: import org.eclipse.equinox.app.IApplicationContext;
18: import org.eclipse.swt.widgets.Display;
19: import org.eclipse.ui.IWorkbench;
20: import org.eclipse.ui.PlatformUI;
21:
22: /**
23: * This class controls all aspects of the application's execution.
24: */
25: public class Application implements IApplication {
26:
27:         /*
28:          * (non-Javadoc)
29:          * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext)
30:          */
31:         @Override
32:         public Object start(IApplicationContext context) {
33:                 final Display display = PlatformUI.createDisplay();
34:                 try {
35:                         final int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());
36:•                        if (returnCode == PlatformUI.RETURN_RESTART) {
37:                                 return IApplication.EXIT_RESTART;
38:                         }
39:                         return IApplication.EXIT_OK;
40:                 } finally {
41:                         display.dispose();
42:                 }
43:         }
44:
45:         /*
46:          * (non-Javadoc)
47:          * @see org.eclipse.equinox.app.IApplication#stop()
48:          */
49:         @Override
50:         public void stop() {
51:•                if (!PlatformUI.isWorkbenchRunning()) {
52:                         return;
53:                 }
54:                 final IWorkbench workbench = PlatformUI.getWorkbench();
55:                 final Display display = workbench.getDisplay();
56:                 display.syncExec(new Runnable() {
57:                         @Override
58:                         public void run() {
59:                                 if (!display.isDisposed()) {
60:                                         workbench.close();
61:                                 }
62:                         }
63:                 });
64:         }
65: }