public class BrowserView extends ViewPart {
public final static String ID_BROWSER = "net.sourceforge.phpeclipse.webbrowser.views";
- WebBrowser instance = null;
+ WebBrowser fInstance = null;
+ String fUrl = null;
/**
* Create the example
*/
public void createPartControl(Composite frame) {
try {
- if (WebBrowserUtil.canUseInternalWebBrowser()) {
- instance = new WebBrowser(frame, true, true);
+ if (WebBrowserUtil.isInternalBrowserOperational()) {
+ fInstance = new WebBrowser(frame, true, true);
}
} catch (Exception e) {
- instance = null;
+ fInstance = null;
}
}
* @see org.eclipse.ui.part.ViewPart#setFocus
*/
public void setFocus() {
- if (instance != null) {
- instance.setFocus();
+ if (fInstance != null) {
+ fInstance.setFocus();
}
}
* Called when the View is to be disposed
*/
public void dispose() {
- if (instance != null) {
- instance.dispose();
- instance = null;
+ if (fInstance != null) {
+ fInstance.dispose();
+ fInstance = null;
}
super.dispose();
}
public void setUrl(final String url) {
- if (instance != null) {
- instance.setURL(url);
+ if (fInstance != null) {
+ fUrl = url;
+ fInstance.setURL(url);
// try {
// ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
// public void run(IProgressMonitor monitor) throws CoreException {
}
public void refresh() {
- if (instance != null) {
- instance.refresh();
+ if (fInstance != null) {
+ fInstance.refresh();
// try {
// ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
// public void run(IProgressMonitor monitor) throws CoreException {
}
}
+ public void refresh(String url) {
+ if (fInstance != null) {
+ if (fUrl==null || !fUrl.equals(url) ) {
+ setUrl(url);
+ } else {
+ refresh();
+ }
+ }
+ }
+
public void addProgressListener(ProgressListener listener) {
- if (instance != null) {
- instance.addProgressListener(listener);
+ if (fInstance != null) {
+ fInstance.addProgressListener(listener);
}
}
public void addStatusTextListener(StatusTextListener listener) {
- if (instance != null) {
- instance.addStatusTextListener(listener);
+ if (fInstance != null) {
+ fInstance.addStatusTextListener(listener);
}
}
public void addTitleListener(TitleListener listener) {
- if (instance != null) {
- instance.addTitleListener(listener);
+ if (fInstance != null) {
+ fInstance.addTitleListener(listener);
}
}
}
\ No newline at end of file