HPCDepthView.java

Go to the documentation of this file.
00001 package edu.rice.cs.hpc.traceviewer.depth;
00002 
00003 import java.util.Map;
00004 
00005 import org.eclipse.swt.SWT;
00006 import org.eclipse.swt.layout.GridData;
00007 import org.eclipse.swt.layout.GridLayout;
00008 import org.eclipse.swt.widgets.Composite;
00009 import org.eclipse.ui.ISourceProvider;
00010 import org.eclipse.ui.ISourceProviderListener;
00011 import org.eclipse.ui.services.ISourceProviderService;
00012 
00013 import edu.rice.cs.hpc.traceviewer.services.DataService;
00014 import edu.rice.cs.hpc.traceviewer.spaceTimeData.SpaceTimeDataController;
00015 import edu.rice.cs.hpc.traceviewer.ui.AbstractTimeView;
00016 
00017 /*****************************************************
00018  * 
00019  * Depth view
00020  *
00021  *****************************************************/
00022 public class HPCDepthView extends AbstractTimeView
00023 {
00024     public static final String ID = "hpcdepthview.view";
00025     
00027     Composite master;
00028     
00030     int maxDepth;
00031     
00033     DepthTimeCanvas depthCanvas;
00034         
00035     public void createPartControl(Composite _master)
00036     {
00037         master = _master;
00038         
00039         setupEverything();
00040         setListener();
00041         super.addListener();
00042     }
00043     
00044     private void setupEverything()
00045     {
00046         /*************************************************************************
00047          * Master Composite
00048          */
00049         
00050         master.setLayout(new GridLayout());
00051         master.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
00052         
00053         /*************************************************************************
00054          * Depth View Canvas
00055          */
00056         
00057         depthCanvas = new DepthTimeCanvas(master);
00058         depthCanvas.setLayout(new GridLayout());
00059         depthCanvas.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
00060         depthCanvas.setVisible(false);      
00061     }
00062     
00063     private void setListener() {
00064         ISourceProviderService service = (ISourceProviderService)getSite().getService(ISourceProviderService.class);
00065         ISourceProvider serviceProvider = service.getSourceProvider(DataService.DATA_UPDATE);
00066         serviceProvider.addSourceProviderListener( new ISourceProviderListener(){
00067 
00068             public void sourceChanged(int sourcePriority, Map sourceValuesByName) { }
00069             public void sourceChanged(int sourcePriority, String sourceName,
00070                     Object sourceValue) {
00071                 // eclipse bug: even if we set a very specific source provider, eclipse still
00072                 //  gather event from other source. we then require to put a guard to avoid this.
00073                 if (sourceName.equals(DataService.DATA_UPDATE)) {
00074                     depthCanvas.refresh();
00075                 }
00076             }
00077         });     
00078     }
00079 
00080     public void updateView(SpaceTimeDataController _stData)
00081     {
00082         this.depthCanvas.updateView(_stData);
00083         depthCanvas.setVisible(true);
00084     }
00085 
00086     public void setFocus()
00087     {
00088         this.depthCanvas.setFocus();
00089     }
00090 
00091     @Override
00092     /*
00093      * (non-Javadoc)
00094      * @see edu.rice.cs.hpc.traceviewer.ui.IActiveNotification#active(boolean)
00095      */
00096     public void active(boolean isActive) 
00097     {
00098         depthCanvas.activate(isActive);
00099     }
00100 }

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1