ApplicationWorkbenchWindowAdvisor.java

Go to the documentation of this file.
00001 package edu.rice.cs.hpc.traceviewer.framework;
00002 
00003 import org.eclipse.jface.action.IStatusLineManager;
00004 import org.eclipse.ui.IWorkbenchWindow;
00005 import org.eclipse.ui.application.ActionBarAdvisor;
00006 import org.eclipse.ui.application.IActionBarConfigurer;
00007 import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
00008 import org.eclipse.ui.application.WorkbenchWindowAdvisor;
00009 
00010 import edu.rice.cs.hpc.common.ui.Util;
00011 import edu.rice.cs.hpc.traceviewer.db.TraceDatabase;
00012 
00013 public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
00014 
00015     final private String args[];
00016     
00017     public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer, String []_args) {
00018         super(configurer);
00019         args = _args;
00020     }
00021 
00022     /*
00023      * (non-Javadoc)
00024      * @see org.eclipse.ui.application.WorkbenchWindowAdvisor#createActionBarAdvisor(org.eclipse.ui.application.IActionBarConfigurer)
00025      */
00026     public ActionBarAdvisor createActionBarAdvisor(
00027             IActionBarConfigurer configurer) {
00028         return new ApplicationActionBarAdvisor(configurer);
00029     }
00030 
00031     /*
00032      * (non-Javadoc)
00033      * @see org.eclipse.ui.application.WorkbenchWindowAdvisor#preWindowOpen()
00034      */
00035     public void preWindowOpen() {
00036         IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
00037 
00038         configurer.setShowCoolBar(false);
00039         configurer.setShowStatusLine(true);
00040         configurer.setShowProgressIndicator(true);
00041         
00042         final IWorkbenchWindow window = configurer.getWindow();
00043         if (!Util.checkJavaVendor(window.getShell()))
00044             window.close();
00045     }
00046     
00047     
00048     /*
00049      * (non-Javadoc)
00050      * @see org.eclipse.ui.application.WorkbenchWindowAdvisor#postWindowOpen()
00051      */ 
00052     public void postWindowOpen() {
00053         
00054         //---------------------------------------------------------------------
00055         // once the widgets have been created, we ask user a database to open
00056         // ---------------------------------------------------------------------
00057         
00058         final IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
00059         final IStatusLineManager status = configurer.getActionBarConfigurer().getStatusLineManager();
00060         
00061         //process command line argument - currently only works for local but can be easily modified to work with remote
00062         if (args != null && args.length > 0) {
00063             for (String arg : args) {
00064                 if (arg != null && arg.charAt(0) != '-') {
00065                     // this must be the name of the database to open
00066                     TraceDatabase.openDatabase(configurer.getWindow(), arg, status);
00067                     return;
00068                 } 
00069             }
00070         }
00071         // Eclipse indigo MAC export will add -showlocation flag in front of the executable
00072         // It is also possible the next version of Eclipse will add other flags
00073         // Hence, we need calling open dialog box here to make sure it displays on all Eclipse versions
00074         TraceDatabase.openDatabase(configurer.getWindow(), status);
00075     }
00076 
00077     /*
00078      * (non-Javadoc)
00079      * @see org.eclipse.ui.application.WorkbenchWindowAdvisor#postWindowClose()
00080      */
00081     public void postWindowClose() {
00082 
00083         // remove all the allocated resources of this window
00084         TraceDatabase.removeInstance(this.getWindowConfigurer().getWindow());
00085     }
00086 }

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1