* IBM Corporation - initial API and implementation
*******************************************************************************/
package net.sourceforge.phpeclipse.views.browser;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.part.ViewPart;
+import org.eclipse.webbrowser.internal.WebBrowser;
+import org.eclipse.webbrowser.internal.WebBrowserUIPlugin;
+import org.eclipse.webbrowser.internal.WebBrowserUtil;
/**
* <code>BrowserView</code> is a simple demonstration of the SWT Browser
* widget. It consists of a workbench view and tab folder where each tab in the
*/
public class BrowserView extends ViewPart {
public final static String ID_BROWSER = "net.sourceforge.phpeclipse.views.browser";
- PHPBrowser instance = null;
+ WebBrowser instance = null;
/**
* Create the example
*
* @see ViewPart#createPartControl
*/
public void createPartControl(Composite frame) {
- instance = new PHPBrowser(frame);
+ try {
+ if (WebBrowserUtil.canUseInternalWebBrowser() ) {
+ instance = new WebBrowser(frame, true, true);
+ }
+ } catch(Exception e) {
+ instance = null;
+ }
}
/**
* Called when we must grab focus.
* @see org.eclipse.ui.part.ViewPart#setFocus
*/
public void setFocus() {
- instance.setFocus();
+ if (instance!=null) {
+ instance.setFocus();
+ }
}
/**
* Called when the View is to be disposed
*/
public void dispose() {
- instance.dispose();
- instance = null;
+ if (instance!=null) {
+ instance.dispose();
+ instance = null;
+ }
super.dispose();
}
public void setUrl(String url) {
- instance.browser.setUrl(url);
+ if (instance!=null) {
+ instance.setURL(url);
+ }
+ }
+ public void refresh() {
+ if (instance!=null) {
+ instance.refresh();
+ }
}
}