root / tmp / org.txm.backtomedia.rcp / src / vlcplayerrcp / Application.java @ 2423
Historique | Voir | Annoter | Télécharger (1,31 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 |
/*
|
17 |
* (non-Javadoc)
|
18 |
* @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext)
|
19 |
*/
|
20 |
public Object start(IApplicationContext context) throws Exception { |
21 |
Display display = PlatformUI.createDisplay(); |
22 |
try {
|
23 |
int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor()); |
24 |
if (returnCode == PlatformUI.RETURN_RESTART)
|
25 |
return IApplication.EXIT_RESTART;
|
26 |
else
|
27 |
return IApplication.EXIT_OK;
|
28 |
} |
29 |
finally {
|
30 |
display.dispose(); |
31 |
} |
32 |
} |
33 |
|
34 |
/*
|
35 |
* (non-Javadoc)
|
36 |
* @see org.eclipse.equinox.app.IApplication#stop()
|
37 |
*/
|
38 |
public void stop() { |
39 |
if (!PlatformUI.isWorkbenchRunning())
|
40 |
return;
|
41 |
final IWorkbench workbench = PlatformUI.getWorkbench();
|
42 |
final Display display = workbench.getDisplay();
|
43 |
display.syncExec(new Runnable() { |
44 |
|
45 |
public void run() { |
46 |
if (!display.isDisposed())
|
47 |
workbench.close(); |
48 |
} |
49 |
}); |
50 |
} |
51 |
} |