9a638e2cb79e263f84244dd5b476a28d2ae6c2a3
[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.IEditorInput;
18 import org.eclipse.ui.IEditorPart;
19 import org.eclipse.ui.actions.ActionDelegate;
20 import org.eclipse.ui.internal.EditorPluginAction;
21
22 public class PHPEclipseShowContextHelp
23   extends ActionDelegate
24   implements IEditorActionDelegate {
25     
26 private IEditorPart editor;
27   /**
28    * @see ActionDelegate#run(IAction)
29    */
30   public void run(IAction action) {
31     EditorPluginAction editorPluginAction = (EditorPluginAction) action;
32     IEditorInput input = editor.getEditorInput();
33     // Add your code here to perform the action
34     MessageDialog.openInformation(
35       editor.getSite().getShell(),
36       "Context Help: ", 
37       input.toString());
38   }
39
40   /**
41    * @see IEditorActionDelegate#setActiveEditor(IAction, IEditorPart)
42    */
43   public void setActiveEditor(IAction action, IEditorPart targetEditor) {
44       this.editor = targetEditor;
45   }
46
47 }