6041214451188e10c6946f1af94976b711eb661a
[phpeclipse.git] / net.sourceforge.phpeclipse.webbrowser / src / net / sourceforge / phpeclipse / webbrowser / OpenBrowserWorkbenchAction.java
1 /**
2  * Copyright (c) 2003 IBM Corporation 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 - Initial API and implementation
10  */
11 package net.sourceforge.phpeclipse.webbrowser;
12
13 import net.sourceforge.phpeclipse.webbrowser.WebBrowser;
14 import net.sourceforge.phpeclipse.webbrowser.WebBrowserEditorInput;
15
16 import org.eclipse.jface.viewers.ISelection;
17 import org.eclipse.jface.action.IAction;
18 import org.eclipse.ui.*;
19 /**
20  * Action to open the Web broswer.
21  */
22 public class OpenBrowserWorkbenchAction implements IWorkbenchWindowActionDelegate {
23         /**
24          * OpenBrowserWorkbenchAction constructor comment.
25          */
26         public OpenBrowserWorkbenchAction() {
27                 super();
28         }
29
30         /**
31          * Disposes this action delegate.  The implementor should unhook any references
32          * to itself so that garbage collection can occur.
33          */
34         public void dispose() { }
35
36         /**
37          * Initializes this action delegate with the workbench window it will work in.
38          *
39          * @param window the window that provides the context for this delegate
40          */
41         public void init(IWorkbenchWindow window) { }
42
43         /**
44          * Performs this action.
45          * <p>
46          * This method is called when the delegating action has been triggered.
47          * Implement this method to do the actual work.
48          * </p>
49          *
50          * @param action the action proxy that handles the presentation portion of the
51          *   action
52          */
53         public void run(IAction action) {
54                 WebBrowser.openURL(new WebBrowserEditorInput(null, WebBrowserEditorInput.SHOW_ALL | WebBrowserEditorInput.FORCE_NEW_PAGE));
55         }
56
57         /**
58          * Notifies this action delegate that the selection in the workbench has changed.
59          * <p>
60          * Implementers can use this opportunity to change the availability of the
61          * action or to modify other presentation properties.
62          * </p>
63          *
64          * @param action the action proxy that handles presentation portion of the action
65          * @param selection the current selection in the workbench
66          */
67         public void selectionChanged(IAction action, ISelection selection) { }
68 }