1 package org.eclipse.webbrowser.internal;
5 import org.eclipse.ui.IMemento;
6 import org.eclipse.webbrowser.IInternalWebBrowser;
7 import org.eclipse.webbrowser.IInternalWebBrowserWorkingCopy;
8 import org.eclipse.webbrowser.WebBrowserEditorInput;
12 public class InternalWebBrowser implements IInternalWebBrowser {
13 private static final String MEMENTO_NEW_PAGE = "new_page";
14 private static final String MEMENTO_CLEAR_HISTORY_ON_EXIT = "clear_history";
16 protected boolean useNewPage;
17 protected boolean clearHistory;
20 * @see org.eclipse.webbrowser.IWebBrowser#getName()
22 public String getName() {
23 return WebBrowserUIPlugin.getResource("%internalWebBrowserName");
26 public boolean getUseNewPage() {
30 public boolean getClearHistoryOnExit() {
34 public boolean isWorkingCopy() {
38 public IInternalWebBrowserWorkingCopy getWorkingCopy() {
39 return new InternalWebBrowserWorkingCopy(this);
42 protected void setInternal(IInternalWebBrowser browser) {
43 useNewPage = browser.getUseNewPage();
44 clearHistory = browser.getClearHistoryOnExit();
48 * @see org.eclipse.webbrowser.IWebBrowser#openURL(java.net.URL)
50 public void openURL(URL url) {
51 WebBrowserEditor.open(new WebBrowserEditorInput(url));
54 protected void save(IMemento memento) {
55 memento.putString(MEMENTO_NEW_PAGE, useNewPage ? "true" : "false");
56 memento.putString(MEMENTO_CLEAR_HISTORY_ON_EXIT, clearHistory ? "true" : "false");
59 protected void load(IMemento memento) {
60 String s = memento.getString(MEMENTO_NEW_PAGE);
66 s = memento.getString(MEMENTO_CLEAR_HISTORY_ON_EXIT);
73 public String toString() {
74 return "Internal Web browser";