source: default/v2/trunk/de.ugoe.cs.swe.bnftools.ebnf.standalone/src/de/ugoe/cs/swe/bnftools/ebnf/standalone/Application.java @ 74

Last change on this file since 74 was 74, checked in by phdmakk, 10 years ago

+ initial RCP example
+ EBNFEditedResourceProvider
+ Initial imports and declarations in View
+ corresponding dependencies

  • Property svn:mime-type set to text/plain
File size: 1.2 KB
Line 
1package de.ugoe.cs.swe.bnftools.ebnf.standalone;
2
3import org.eclipse.equinox.app.IApplication;
4import org.eclipse.equinox.app.IApplicationContext;
5import org.eclipse.swt.widgets.Display;
6import org.eclipse.ui.IWorkbench;
7import org.eclipse.ui.PlatformUI;
8
9/**
10 * This class controls all aspects of the application's execution
11 */
12public class Application implements IApplication {
13
14        /* (non-Javadoc)
15         * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext)
16         */
17        public Object start(IApplicationContext context) {
18                Display display = PlatformUI.createDisplay();
19                try {
20                        int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());
21                        if (returnCode == PlatformUI.RETURN_RESTART) {
22                                return IApplication.EXIT_RESTART;
23                        }
24                        return IApplication.EXIT_OK;
25                } finally {
26                        display.dispose();
27                }
28        }
29
30        /* (non-Javadoc)
31         * @see org.eclipse.equinox.app.IApplication#stop()
32         */
33        public void stop() {
34                if (!PlatformUI.isWorkbenchRunning())
35                        return;
36                final IWorkbench workbench = PlatformUI.getWorkbench();
37                final Display display = workbench.getDisplay();
38                display.syncExec(new Runnable() {
39                        public void run() {
40                                if (!display.isDisposed())
41                                        workbench.close();
42                        }
43                });
44        }
45}
Note: See TracBrowser for help on using the repository browser.