HPCDataView.java

Go to the documentation of this file.
00001 package edu.rice.cs.hpc.traceviewer.ui;
00002 
00003 import org.eclipse.swt.SWT;
00004 import org.eclipse.swt.layout.GridData;
00005 import org.eclipse.swt.layout.GridLayout;
00006 import org.eclipse.swt.widgets.Composite;
00007 import org.eclipse.ui.ISizeProvider;
00008 import org.eclipse.ui.PartInitException;
00009 import org.eclipse.ui.PlatformUI;
00010 import org.eclipse.ui.part.ViewPart;
00011 
00012 import edu.rice.cs.hpc.traceviewer.main.HPCTraceView;
00013 import edu.rice.cs.hpc.traceviewer.spaceTimeData.Position;
00014 import edu.rice.cs.hpc.traceviewer.spaceTimeData.SpaceTimeDataController;
00015 
00017 public class HPCDataView extends ViewPart implements ISizeProvider//, ITraceData, ITracePosition
00018 {
00019     public static final String ID = "hpcdataview.view";
00020     
00021     Composite master;
00022 
00023     SpaceTimeDataController stData;
00024     
00025     DataViewer dataViewer;
00026         
00027     public HPCTraceView traceview;
00028     
00029     public void createPartControl(Composite _master) 
00030     {
00031         master = _master;
00032         try 
00033         {
00034             traceview = (HPCTraceView)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(HPCTraceView.ID);
00035         }
00036         catch (PartInitException e) 
00037         {
00038             traceview = null;
00039             e.printStackTrace();
00040             System.exit(0);
00041         }
00042                 
00043         setupEverything();
00044     }
00045     
00046     private void setupEverything()
00047     {
00048         /*************************************************************************
00049          * Master Composite
00050          ************************************************************************/
00051         master.setLayout(new GridLayout());
00052         master.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, true));
00053                 
00054         /*************************************************************************
00055          * DataViewer
00056          ************************************************************************/
00057         dataViewer = new DataViewer(master, this);      
00058     }
00059     
00060     
00061     public void updateView(SpaceTimeDataController _stData) 
00062     {
00063         this.stData = _stData;  
00064         this.dataViewer.updateView(_stData);
00065         
00066 //      stData.addDataListener(this);
00067 //      stData.addPositionListener(this);
00068     }
00069 
00070     public void setFocus()
00071     {
00072     }
00073 
00074     public int computePreferredSize(boolean width, int availableParallel, int availablePerpendicular, int preferredSize) 
00075     {
00076         return preferredSize;
00077     }
00078 
00079     public int getSizeFlags(boolean width) 
00080     {
00081         return width ? SWT.MAX : 0;
00082     }
00083 
00084     /*
00085      * (non-Javadoc)
00086      * @see edu.rice.cs.hpc.traceviewer.events.ITraceData#setData(int)
00087      */
00088     public void setData(int dataIdx) {
00089         this.dataViewer.setData(dataIdx);
00090     }
00091 
00092     /*
00093      * (non-Javadoc)
00094      * @see edu.rice.cs.hpc.traceviewer.events.ITracePosition#setPosition(edu.rice.cs.hpc.traceviewer.painter.Position)
00095      */
00096     public void setPosition(Position position) {
00097         this.dataViewer.setSample(position, stData.getMaxDepth(), stData.getDataIndex());
00098     }
00099 }

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1