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
9 IBM Corporation - Initial implementation
10 Klaus Hartlage - www.eclipseproject.de
11 **********************************************************************/
12 package net.sourceforge.phpeclipse.actions;
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;
23 public class PHPEclipseShowContextHelp extends ActionDelegate implements IEditorActionDelegate {
25 private TextEditor editor;
27 * @see ActionDelegate#run(IAction)
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());
37 * @see IEditorActionDelegate#setActiveEditor(IAction, IEditorPart)
39 public void setActiveEditor(IAction action, IEditorPart targetEditor) {
40 this.editor = (TextEditor) targetEditor;