Integrated PHP help files; Fixed some bugs
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / actions / PHPEclipseShowContextHelp.java
1 /**********************************************************************
2 Copyright (c) 2000, 2002 IBM Corp. and others.
3 All rights reserved. This program and the accompanying materials
4 are made available under the terms of the Common Public License v1.0
5 which accompanies this distribution, and is available at
6 http://www.eclipse.org/legal/cpl-v10.html
7
8 Contributors:
9     IBM Corporation - Initial implementation
10     Klaus Hartlage - www.eclipseproject.de
11 **********************************************************************/
12 package net.sourceforge.phpeclipse.actions;
13
14 import org.eclipse.jface.action.IAction;
15 import org.eclipse.jface.dialogs.MessageDialog;
16 import org.eclipse.ui.IEditorActionDelegate;
17 import org.eclipse.ui.IEditorPart;
18 import org.eclipse.ui.actions.ActionDelegate;
19 import org.eclipse.ui.editors.text.TextEditor;
20 import org.eclipse.ui.internal.EditorPluginAction;
21 import org.eclipse.ui.part.FileEditorInput;
22
23 public class PHPEclipseShowContextHelp extends ActionDelegate implements IEditorActionDelegate {
24
25   private TextEditor editor;
26   /**
27    * @see ActionDelegate#run(IAction)
28    */
29   public void run(IAction action) {
30     EditorPluginAction editorPluginAction = (EditorPluginAction) action;
31     FileEditorInput input = (FileEditorInput) editor.getEditorInput();
32     // Add your code here to perform the action
33     MessageDialog.openInformation(editor.getSite().getShell(), "Context Help: ", input.toString());
34   }
35
36   /**
37    * @see IEditorActionDelegate#setActiveEditor(IAction, IEditorPart)
38    */
39   public void setActiveEditor(IAction action, IEditorPart targetEditor) {
40     this.editor = (TextEditor) targetEditor;
41   }
42
43 }