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