FilterRanks.java

Go to the documentation of this file.
00001 package edu.rice.cs.hpc.traceviewer.actions;
00002 
00003 import org.eclipse.core.commands.AbstractHandler;
00004 import org.eclipse.core.commands.ExecutionEvent;
00005 import org.eclipse.core.commands.ExecutionException;
00006 import org.eclipse.jface.dialogs.Dialog;
00007 import org.eclipse.swt.widgets.Shell;
00008 import org.eclipse.ui.IWorkbenchWindow;
00009 import org.eclipse.ui.handlers.HandlerUtil;
00010 import org.eclipse.ui.services.ISourceProviderService;
00011 
00012 import edu.rice.cs.hpc.data.experiment.extdata.IFilteredData;
00013 import edu.rice.cs.hpc.traceviewer.filter.FilterDialog;
00014 import edu.rice.cs.hpc.traceviewer.services.DataService;
00015 import edu.rice.cs.hpc.traceviewer.spaceTimeData.SpaceTimeDataController;
00016 
00017 /*****
00018  * 
00019  * Action class to filter ranks
00020  *
00021  */
00022 public class FilterRanks extends AbstractHandler {
00023     
00024 
00025 
00026     public Object execute(ExecutionEvent event) throws ExecutionException {
00027         
00028         final Shell shell = HandlerUtil.getActiveShell(event);
00029         IWorkbenchWindow winObj = HandlerUtil.getActiveWorkbenchWindow(event);
00030         ISourceProviderService sourceProviderService = (ISourceProviderService) winObj.getService(
00031                 ISourceProviderService.class);
00032         
00033         DataService dataService = (DataService) sourceProviderService.getSourceProvider(DataService.DATA_PROVIDER);
00034         SpaceTimeDataController absData = dataService.getData();
00035         
00036         /*
00037          * This isn't the prettiest, but when we are local, we don't want to set
00038          * it to filtered unless we have to (ie. unless the user actually
00039          * applies a filter). If the data is already filtered, we don't care and
00040          * we just return the filtered data we have been using (which makes the
00041          * call to set it redundant). If it's not, we wait to replace the
00042          * current filter with the new filter until we know we have to.
00043          */
00044         IFilteredData filteredBaseData = absData.getFilteredBaseData();
00045         if (filteredBaseData == null){
00046             filteredBaseData = absData.createFilteredBaseData();
00047         }
00048         
00049         FilterDialog dlgFilter = new FilterDialog(shell, filteredBaseData);
00050         
00051         if (dlgFilter.open() == Dialog.OK){
00052 
00053             absData.setBaseData(filteredBaseData);
00054 
00055             dataService.broadcastUpdate(true);
00056         }
00057         
00058         return null;
00059     }
00060 
00061 }

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1