FilterApply.java

Go to the documentation of this file.
00001 package edu.rice.cs.hpc.filter.action;
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.filter.service.FilterStateProvider;
00012 
00013 
00014 public class FilterApply extends AbstractHandler 
00015 {
00016     final static public String ID = "edu.rice.cs.hpc.filter.action.FilterApply";
00017     
00018     @Override
00019     /*
00020      * (non-Javadoc)
00021      * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
00022      */
00023     public Object execute(ExecutionEvent event) throws ExecutionException {
00024         
00025         Command command = event.getCommand();
00026         boolean active = !HandlerUtil.toggleCommandState(command);
00027 
00028         IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
00029         ISourceProviderService service = (ISourceProviderService) window.getService(ISourceProviderService.class);
00030         FilterStateProvider provider   = (FilterStateProvider) service.getSourceProvider(FilterStateProvider.FILTER_REFRESH_PROVIDER);
00031         provider.refresh(Boolean.valueOf(active));
00032 
00033         return null;
00034     }
00035 
00036 }

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1