+++ /dev/null
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
- Klaus Hartlage - www.eclipseproject.de
-**********************************************************************/
-package net.sourceforge.phpeclipse.actions;
-
-import net.sourceforge.phpeclipse.phpeditor.PHPEditor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.text.TextSelection;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IEditorActionDelegate;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.actions.ActionDelegate;
-
-public class PHPEclipseShowContextHelp extends ActionDelegate implements IEditorActionDelegate {
-
- private IWorkbenchWindow window;
- private PHPEditor editor;
-
- public void dispose() {
- }
-
- public void init(IWorkbenchWindow window) {
- this.window = window;
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- if (!selection.isEmpty()) {
- if (selection instanceof TextSelection) {
- action.setEnabled(true);
- } else if (window.getActivePage() != null && window.getActivePage().getActivePart() != null) {
- //
- }
- }
- }
-
- public void run(IAction action) {
- if (editor == null) {
- IEditorPart targetEditor = window.getActivePage().getActiveEditor();
- if (targetEditor != null && (targetEditor instanceof PHPEditor)) {
- editor = (PHPEditor) targetEditor;
- }
- }
- if (editor != null) {
- editor.openContextHelp();
- }
- }
-
- public void setActiveEditor(IAction action, IEditorPart targetEditor) {
- if (targetEditor != null && (targetEditor instanceof PHPEditor)) {
- editor = (PHPEditor) targetEditor;
- }
- }
-
-}