Application.java

Go to the documentation of this file.
00001 package edu.rice.cs.hpc.traceviewer.framework;
00002 
00003 import org.eclipse.equinox.app.IApplication;
00004 import org.eclipse.equinox.app.IApplicationContext;
00005 import org.eclipse.swt.widgets.Display;
00006 import org.eclipse.ui.IWorkbench;
00007 import org.eclipse.ui.PlatformUI;
00008 
00012 public class Application implements IApplication {
00013 
00014     /* (non-Javadoc)
00015      * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext)
00016      */
00017     public Object start(IApplicationContext context) {
00018         Display display = PlatformUI.createDisplay();
00019         try {
00020             String[] args = (String[])context.getArguments().get("application.args");
00021             int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor(args));
00022             if (returnCode == PlatformUI.RETURN_RESTART) {
00023                 return IApplication.EXIT_RESTART;
00024             }
00025             return IApplication.EXIT_OK;
00026         } finally {
00027             display.dispose();
00028         }
00029     }
00030 
00031     /* (non-Javadoc)
00032      * @see org.eclipse.equinox.app.IApplication#stop()
00033      */
00034     public void stop() {
00035         final IWorkbench workbench = PlatformUI.getWorkbench();
00036         if (workbench == null)
00037             return;
00038         final Display display = workbench.getDisplay();
00039         display.syncExec(new Runnable() {
00040             public void run() {
00041                 if (!display.isDisposed())
00042                     workbench.close();
00043             }
00044         });
00045     }
00046 }

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1