showXML.java
Go to the documentation of this file.00001 package edu.rice.cs.hpc.viewer.actions;
00002
00003 import java.io.FileNotFoundException;
00004
00005 import org.eclipse.core.commands.AbstractHandler;
00006 import org.eclipse.core.commands.ExecutionEvent;
00007 import org.eclipse.core.commands.ExecutionException;
00008 import org.eclipse.jface.dialogs.MessageDialog;
00009 import org.eclipse.ui.IWorkbenchWindow;
00010 import org.eclipse.ui.handlers.HandlerUtil;
00011 import edu.rice.cs.hpc.data.experiment.Experiment;
00012 import edu.rice.cs.hpc.viewer.editor.EditorManager;
00013 import edu.rice.cs.hpc.viewer.util.Utilities;
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 public class showXML extends AbstractHandler {
00025
00026
00027
00028
00029
00030 public Object execute(ExecutionEvent event) throws ExecutionException
00031 {
00032 final IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
00033 final Experiment experiment = Utilities.getActiveExperiment(window);
00034
00035 if (experiment != null)
00036 showXMLEditor( window, experiment);
00037 else
00038 {
00039
00040 }
00041
00042 return null;
00043 }
00044
00045
00046
00047
00048
00049
00050
00051
00052 private void showXMLEditor( IWorkbenchWindow window, Experiment experiment )
00053 {
00054
00055 String filePath = experiment.getXMLExperimentFile().getPath();
00056
00057
00058 EditorManager editor = new EditorManager(window);
00059 try {
00060
00061 editor.openFileEditor(filePath, experiment);
00062 } catch (FileNotFoundException e) {
00063
00064 MessageDialog.openError( window.getShell(), "Error: File not found", e.getMessage() );
00065 }
00066 }
00067 }