LocalDBOpener.java

Go to the documentation of this file.
00001 package edu.rice.cs.hpc.traceviewer.db.local;
00002 
00003 import org.eclipse.jface.action.IStatusLineManager;
00004 import org.eclipse.swt.widgets.Shell;
00005 import org.eclipse.ui.IWorkbenchWindow;
00006 
00007 import edu.rice.cs.hpc.data.experiment.InvalExperimentException;
00008 import edu.rice.cs.hpc.traceviewer.db.AbstractDBOpener;
00009 import edu.rice.cs.hpc.traceviewer.spaceTimeData.SpaceTimeDataController;
00010 
00011 /*******************************************************************
00012  * 
00013  * Class to open a local database
00014  * 
00015  * @author Philip Taffet
00016  * 
00017  *******************************************************************/
00018 public class LocalDBOpener extends AbstractDBOpener {
00019 
00020     final private String directory;
00021     
00022     /*******
00023      * prepare opening a database 
00024      * 
00025      * @param directory : the directory of the database
00026      */
00027     public LocalDBOpener(String directory)
00028     {
00029         this.directory = directory;
00030     }
00031     
00032     
00033     @Override
00034     /*
00035      * (non-Javadoc)
00036      * @see edu.rice.cs.hpc.traceviewer.db.AbstractDBOpener#openDBAndCreateSTDC
00037      * (org.eclipse.ui.IWorkbenchWindow, org.eclipse.jface.action.IStatusLineManager)
00038      */
00039     public SpaceTimeDataController openDBAndCreateSTDC(IWorkbenchWindow window,
00040             final IStatusLineManager statusMgr) throws InvalExperimentException, Exception {
00041         
00042         final Shell shell = window.getShell();
00043         
00044         // Laks 2014.03.10: needs to comment the call to removeInstance
00045         // this call causes the data to be deleted but the GC+Color instances still exist
00046         // the allocated GC+Color can be disposed later in SpaceTimeDataController class
00047         
00048         //  TraceDatabase.removeInstance(window);
00049 
00050         // ---------------------------------------------------------------------
00051         // Try to open the database and refresh the data
00052         // ---------------------------------------------------------------------
00053         
00054         
00055         statusMgr.setMessage("Opening trace data...");
00056         shell.update();
00057 
00058         // ---------------------------------------------------------------------
00059         // dispose resources if the data has been allocated
00060         // unfortunately, some colors are allocated from window handle,
00061         // some are allocated dynamically. At the moment we can't dispose
00062         // all colors
00063         // ---------------------------------------------------------------------
00064         // if (database.dataTraces != null)
00065         // database.dataTraces.dispose();
00066 
00067         // database.dataTraces = new SpaceTimeData(window, location.fileXML,
00068         // location.fileTrace, statusMgr);
00069         
00070         SpaceTimeDataControllerLocal stdc = new SpaceTimeDataControllerLocal(
00071                 window, directory);
00072         
00073         if (stdc.setupTrace(window, statusMgr)) {
00074             return stdc;
00075         }
00076         return null;
00077     }
00078 
00079 
00080     @Override
00081     public void end() {
00082         // TODO Auto-generated method stub
00083         
00084     }   
00085 }
00086 
00087 

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1