* IBM Corporation - initial API and implementation
*******************************************************************************/
package net.sourceforge.phpeclipse.views.browser;
+import net.sourceforge.phpeclipse.webbrowser.internal.WebBrowser;
+import net.sourceforge.phpeclipse.webbrowser.internal.WebBrowserUIPlugin;
+import net.sourceforge.phpeclipse.webbrowser.internal.WebBrowserUtil;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.part.ViewPart;
/**
*/
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();
+ }
}
}