OptionMidpoint.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.Command;
00005 import org.eclipse.core.commands.ExecutionEvent;
00006 import org.eclipse.core.commands.ExecutionException;
00007 import org.eclipse.ui.IWorkbenchWindow;
00008 import org.eclipse.ui.handlers.HandlerUtil;
00009 import org.eclipse.ui.services.ISourceProviderService;
00010 
00011 import edu.rice.cs.hpc.common.ui.Util;
00012 import edu.rice.cs.hpc.traceviewer.services.DataService;
00013 import edu.rice.cs.hpc.traceviewer.spaceTimeData.SpaceTimeDataController;
00014 
00015 public class OptionMidpoint extends AbstractHandler {
00016 
00017     final static public String commandId = "edu.rice.cs.hpc.traceviewer.actions.OptionMidpoint";
00018 
00019     @Override
00020     public Object execute(ExecutionEvent event) throws ExecutionException 
00021     {
00022         final IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
00023         
00024         Command command = event.getCommand();
00025         if (command != null) 
00026         {
00027             ISourceProviderService sourceProviderService = (ISourceProviderService) window.getService(
00028                     ISourceProviderService.class);
00029             DataService dataService = (DataService) sourceProviderService.getSourceProvider(DataService.DATA_PROVIDER);
00030             final SpaceTimeDataController data = dataService.getData();
00031 
00032             boolean enable = !Util.isOptionEnabled(command);
00033             data.setEnableMidpoint(enable);
00034         }
00035 
00036         HandlerUtil.toggleCommandState(command);
00037         // use the old value and perform the operation 
00038         return null;
00039     }
00040 
00041 }

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1