1 /*******************************************************************************
2 * Copyright (c) 2000, 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
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpeclipse.webbrowser.views;
13 import net.sourceforge.phpeclipse.webbrowser.internal.BrowserManager;
14 import net.sourceforge.phpeclipse.webbrowser.internal.WebBrowser;
15 import net.sourceforge.phpeclipse.webbrowser.internal.WebBrowserUtil;
17 import org.eclipse.swt.browser.ProgressListener;
18 import org.eclipse.swt.browser.StatusTextListener;
19 import org.eclipse.swt.browser.TitleListener;
20 import org.eclipse.swt.widgets.Composite;
21 import org.eclipse.ui.part.ViewPart;
24 * <code>BrowserView</code> is a simple demonstration of the SWT Browser widget. It consists of a workbench view and tab folder
25 * where each tab in the folder allows the user to interact with a control.
29 public class BrowserView extends ViewPart {
30 public final static String ID_BROWSER = "net.sourceforge.phpeclipse.webbrowser.views";
32 WebBrowser instance = null;
37 * @see ViewPart#createPartControl
39 public void createPartControl(Composite frame) {
41 if (WebBrowserUtil.isInternalBrowserOperational()) {
42 instance = new WebBrowser(frame, true, true);
44 } catch (Exception e) {
50 * Called when we must grab focus.
52 * @see org.eclipse.ui.part.ViewPart#setFocus
54 public void setFocus() {
55 if (instance != null) {
61 * Called when the View is to be disposed
63 public void dispose() {
64 if (instance != null) {
71 public void setUrl(final String url) {
72 if (instance != null) {
75 // ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
76 // public void run(IProgressMonitor monitor) throws CoreException {
77 // instance.setURL(url);
80 // } catch (CoreException e) {
81 // // TODO Auto-generated catch block
82 // e.printStackTrace();
87 public void refresh() {
88 if (instance != null) {
91 // ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
92 // public void run(IProgressMonitor monitor) throws CoreException {
93 // instance.refresh();
96 // } catch (CoreException e) {
97 // // TODO Auto-generated catch block
98 // e.printStackTrace();
103 public void addProgressListener(ProgressListener listener) {
104 if (instance != null) {
105 instance.addProgressListener(listener);
109 public void addStatusTextListener(StatusTextListener listener) {
110 if (instance != null) {
111 instance.addStatusTextListener(listener);
115 public void addTitleListener(TitleListener listener) {
116 if (instance != null) {
117 instance.addTitleListener(listener);