ResetPerspective.java

Go to the documentation of this file.
00001 
00004 package edu.rice.cs.hpc.viewer.actions;
00005 
00006 import org.eclipse.core.commands.AbstractHandler;
00007 import org.eclipse.core.commands.ExecutionEvent;
00008 import org.eclipse.core.commands.ExecutionException;
00009 import org.eclipse.ui.IViewPart;
00010 import org.eclipse.ui.IViewReference;
00011 import org.eclipse.ui.IWorkbenchPage;
00012 import org.eclipse.ui.handlers.HandlerUtil;
00013 
00014 import edu.rice.cs.hpc.viewer.scope.AbstractBaseScopeView;
00015 
00016 
00022 public class ResetPerspective extends AbstractHandler {
00023 
00024 
00025     public Object execute(ExecutionEvent event) throws ExecutionException {
00026 
00027         final IWorkbenchPage page = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
00028         
00029         // ask to reset the layout
00030         page.resetPerspective();
00031         
00032         //----------------------------------------
00033         // hide unused views
00034         //----------------------------------------
00035         IViewReference viewRefs[] = page.getViewReferences();
00036         for (IViewReference viewRef: viewRefs) {
00037             
00038             final IViewPart view = viewRef.getView(false);
00039             if (view instanceof AbstractBaseScopeView) {
00040                 final AbstractBaseScopeView scopeView = (AbstractBaseScopeView) view;
00041                 if (scopeView.getExperiment() == null)
00042                     page.hideView(view);
00043             } else {
00044                 page.hideView(view);
00045             }
00046         }
00047         
00048         return null;
00049     }
00050 
00051 }

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1