ShowMetricProperties.java

Go to the documentation of this file.
00001 package edu.rice.cs.hpc.viewer.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.commands.ICommandService;
00010 import org.eclipse.ui.handlers.HandlerUtil;
00011 
00012 import edu.rice.cs.hpc.viewer.metric.MetricPropertyDialog;
00013 
00014 
00015 /*******************************************************************
00016  * 
00017  * Action class to show metric properties 
00018  *
00019  */
00020 public class ShowMetricProperties extends AbstractHandler {
00021 
00022     final public static String COMMAND_REFRESH_METRICS = "edu.rice.cs.hpc.viewer.actions.ShowMetricProperties";
00023     
00024     @Override
00025     public Object execute(ExecutionEvent event) throws ExecutionException {
00026 
00027         final IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
00028         final Shell shell = window.getShell();
00029         
00030         // show the metric properties window
00031         
00032         MetricPropertyDialog dialog = new MetricPropertyDialog(shell, 
00033                 HandlerUtil.getActiveWorkbenchWindow(event));
00034             
00035         if ( dialog.open() == Dialog.OK ) {
00036             
00037             // broadcast message to all views that a metric may have been changed
00038             final ICommandService commandService = (ICommandService) window.getService(ICommandService.class);
00039             commandService.refreshElements(COMMAND_REFRESH_METRICS, null);
00040         }
00041 
00042         return null;
00043     }
00044 
00045 }

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1