ShowFilterView.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.ExecutionEvent;
00005 import org.eclipse.core.commands.ExecutionException;
00006 import org.eclipse.ui.IViewPart;
00007 import org.eclipse.ui.IWorkbenchPage;
00008 import org.eclipse.ui.PartInitException;
00009 import org.eclipse.ui.handlers.HandlerUtil;
00010
00011 import edu.rice.cs.hpc.filter.view.FilterView;
00012
00013 public class ShowFilterView extends AbstractHandler {
00014
00015 @Override
00016 public Object execute(ExecutionEvent event) throws ExecutionException
00017 {
00018 final IWorkbenchPage page = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
00019 if (page != null)
00020 {
00021 boolean oldVal = HandlerUtil.toggleCommandState(event.getCommand());
00022 boolean newVal = !oldVal;
00023
00024 try {
00025 if (newVal) {
00026 page.showView(FilterView.ID);
00027 } else {
00028 final IViewPart part = page.findView(FilterView.ID);
00029 page.hideView( part );
00030 }
00031 } catch (PartInitException e) {
00032
00033 e.printStackTrace();
00034 }
00035 }
00036 return null;
00037 }
00038 }