Statistiques
| Révision :

root / tmp / org.txm.backtomedia.rcp / src / vlcplayerrcp / Application.java @ 937

Historique | Voir | Annoter | Télécharger (1,3 ko)

1
package vlcplayerrcp;
2

    
3
import org.eclipse.equinox.app.IApplication;
4
import org.eclipse.equinox.app.IApplicationContext;
5
import org.eclipse.swt.widgets.Display;
6
import org.eclipse.ui.IWorkbench;
7
import org.eclipse.ui.PlatformUI;
8

    
9
/**
10
 * This class controls all aspects of the application's execution
11
 */
12
public class Application implements IApplication {
13
        
14
        public static String PLUGIN_ID = "org.txm.backtomedia"; //$NON-NLS-1$
15

    
16
        /* (non-Javadoc)
17
         * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext)
18
         */
19
        public Object start(IApplicationContext context) throws Exception {
20
                Display display = PlatformUI.createDisplay();
21
                try {
22
                        int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());
23
                        if (returnCode == PlatformUI.RETURN_RESTART)
24
                                return IApplication.EXIT_RESTART;
25
                        else
26
                                return IApplication.EXIT_OK;
27
                } finally {
28
                        display.dispose();
29
                }
30
        }
31

    
32
        /* (non-Javadoc)
33
         * @see org.eclipse.equinox.app.IApplication#stop()
34
         */
35
        public void stop() {
36
                if (!PlatformUI.isWorkbenchRunning())
37
                        return;
38
                final IWorkbench workbench = PlatformUI.getWorkbench();
39
                final Display display = workbench.getDisplay();
40
                display.syncExec(new Runnable() {
41
                        public void run() {
42
                                if (!display.isDisposed())
43
                                        workbench.close();
44
                        }
45
                });
46
        }
47
}