Initial version from the webtools project; sligthly modified for phpeclipse
[phpeclipse.git] / net.sourceforge.phpeclipse.webbrowser / src / org / eclipse / webbrowser / internal / SwitchDefaultBrowserAction.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 org.eclipse.webbrowser.internal;
12
13 import org.eclipse.jface.action.Action;
14 import org.eclipse.webbrowser.IInternalWebBrowser;
15 import org.eclipse.webbrowser.IWebBrowser;
16 /**
17  * Action to open the Web browser.
18  */
19 public class SwitchDefaultBrowserAction extends Action {
20         protected IWebBrowser webbrowser;
21
22         /**
23          * SwitchDefaultBrowserAction constructor comment.
24          */
25         public SwitchDefaultBrowserAction(IWebBrowser webbrowser, boolean current) {
26                 super();
27                 
28                 this.webbrowser = webbrowser;
29                 setText(webbrowser.getName());
30                 if (webbrowser instanceof IInternalWebBrowser)
31                         setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_INTERNAL_BROWSER));
32                 else
33                         setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_EXTERNAL_BROWSER));
34                 
35                 if (current)
36                         setChecked(true);
37         }
38
39         /**
40          * Implementation of method defined on <code>IAction</code>.
41          */
42         public void run() {
43                 BrowserManager.getInstance().setCurrentWebBrowser(webbrowser);
44         }
45 }