HPCSummaryView.java

Go to the documentation of this file.
00001 package edu.rice.cs.hpc.traceviewer.summary;
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  * View part of the summary window 
00020  *
00021  *************************************************************************/
00022 public class HPCSummaryView extends AbstractTimeView
00023 {
00024 
00025     public static final String ID = "hpcsummaryview.view";
00026     
00028     SummaryTimeCanvas summaryCanvas;
00029     
00030     public void createPartControl(Composite master)
00031     {
00032         /*************************************************************************
00033          * Master Composite
00034          */
00035         
00036         master.setLayout(new GridLayout());
00037         master.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
00038         
00039         /*************************************************************************
00040          * Summary View Canvas
00041          */
00042         
00043         summaryCanvas = new SummaryTimeCanvas(master);
00044         summaryCanvas.setLayout(new GridLayout());
00045         summaryCanvas.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
00046         summaryCanvas.setVisible(false);
00047         
00048         setListener();
00049         super.addListener();
00050     }
00051     
00052     private void setListener() {
00053         ISourceProviderService service = (ISourceProviderService)getSite().getService(ISourceProviderService.class);
00054         ISourceProvider serviceProvider = service.getSourceProvider(DataService.DATA_UPDATE);
00055         serviceProvider.addSourceProviderListener( new ISourceProviderListener(){
00056 
00057             public void sourceChanged(int sourcePriority, Map sourceValuesByName) { }
00058             public void sourceChanged(int sourcePriority, String sourceName,
00059                     Object sourceValue) {
00060                 // eclipse bug: even if we set a very specific source provider, eclipse still
00061                 //  gather event from other source. we then require to put a guard to avoid this.
00062                 if (sourceName.equals(DataService.DATA_UPDATE)) {
00063                     summaryCanvas.redraw();
00064                 }
00065             }
00066         });
00067     }
00068 
00069     public void updateView(SpaceTimeDataController dataTraces)
00070     {
00071         summaryCanvas.updateData(dataTraces);
00072     }
00073     
00074     /*
00075      * (non-Javadoc)
00076      * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
00077      */
00078     public void setFocus() 
00079     {
00080         summaryCanvas.setFocus();
00081     }
00082 
00083     @Override
00084     public void active(boolean isActive) 
00085     {
00086         summaryCanvas.activate(isActive);
00087     }
00088 
00089 }

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1