HelpManual.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.core.resources.IFile;
00010 import org.eclipse.core.resources.IWorkspace;
00011 import org.eclipse.core.resources.IWorkspaceRoot;
00012 import org.eclipse.core.resources.ResourcesPlugin;
00013 import org.eclipse.core.runtime.Path;
00014 import org.eclipse.ui.IWorkbenchPage;
00015 import org.eclipse.ui.IWorkbenchWindow;
00016 import org.eclipse.ui.handlers.HandlerUtil;
00017 import org.eclipse.ui.part.FileEditorInput;
00018
00019 import edu.rice.cs.hpc.viewer.help.HTMLEditor;
00020
00025 public class HelpManual extends AbstractHandler {
00026 final static private String HELP_FILE_PATH = "/doc/hpcviewer-users-manual.html";
00027
00028
00029
00030
00031 public Object execute(ExecutionEvent event) throws ExecutionException {
00032 IWorkbenchWindow objWindow = HandlerUtil.getActiveWorkbenchWindow(event);
00033
00034 IWorkspace objWorkspace = ResourcesPlugin.getWorkspace();
00035 IWorkspaceRoot root = objWorkspace.getRoot();
00036
00037 IFile file = root.getFile(new Path(HELP_FILE_PATH));
00038
00039 IWorkbenchPage objPage = objWindow.getActivePage();
00040
00041 try {
00042 FileEditorInput objInput = new FileEditorInput(file);
00043 objPage.openEditor(objInput, HTMLEditor.ID);
00044 } catch (Exception e) {
00045 e.printStackTrace();
00046 }
00047 return null;
00048 }
00049
00050 }