Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.help.base/preferences.ini12
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/browser/BrowserManager.java40
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpUIResources.properties6
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/browser/BrowsersPreferencePage.java38
4 files changed, 88 insertions, 8 deletions
diff --git a/org.eclipse.help.base/preferences.ini b/org.eclipse.help.base/preferences.ini
index d0e61eb42..d39fb91c0 100644
--- a/org.eclipse.help.base/preferences.ini
+++ b/org.eclipse.help.base/preferences.ini
@@ -92,4 +92,14 @@ basic.viewBackground=#FFFFFF
# space requirements as navigations and indexes will be created for each distinct preferred locale
# among browsers accessing the infocenter.
# Example: locales=en ja zh_CN zh_TW
-locales= \ No newline at end of file
+locales=
+
+######################
+# Browsers
+######################
+# Use embedded when possible, or always external
+#always_external_browser=
+# Default external browser
+#default_browser=
+# Executable path for custom browser
+#custom_browser_path= \ No newline at end of file
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/browser/BrowserManager.java b/org.eclipse.help.base/src/org/eclipse/help/internal/browser/BrowserManager.java
index 5d0f2d58c..05d972064 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/browser/BrowserManager.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/browser/BrowserManager.java
@@ -19,6 +19,7 @@ import org.eclipse.help.internal.base.*;
* Creates browser by delegating to appropriate browser adapter
*/
public class BrowserManager {
+ public static final String ALWAYS_EXTERNAL_BROWSER_KEY = "always_external_browser";
public static final String DEFAULT_BROWSER_ID_KEY = "default_browser";
private static BrowserManager instance;
private boolean initialized = false;
@@ -27,6 +28,7 @@ public class BrowserManager {
private BrowserDescriptor[] browsersDescriptors;
private BrowserDescriptor internalBrowserDesc;
private Collection browsers = new ArrayList();
+ private boolean alwaysUseExternal = false;
/**
* Private Constructor
*/
@@ -141,6 +143,10 @@ public class BrowserManager {
if (currentBrowserDesc == null) {
setCurrentBrowserID(getDefaultBrowserID());
}
+ setAlwaysUseExternal(HelpBasePlugin
+ .getDefault()
+ .getPluginPreferences()
+ .getBoolean(ALWAYS_EXTERNAL_BROWSER_KEY));
}
/**
@@ -274,11 +280,10 @@ public class BrowserManager {
if (!initialized) {
init();
}
- if (forceExternal)
- return createBrowserAdapter(forceExternal);
- else
- return new CurrentBrowser(createBrowserAdapter(forceExternal),
- getCurrentBrowserID());
+ forceExternal = forceExternal || alwaysUseExternal;
+ return createBrowserAdapter(forceExternal);
+ // TODO fix and use CurrentBrowser
+ // return new CurrentBrowser(createBrowserAdapter(forceExternal), getCurrentBrowserID());
}
/**
* Creates web browser
@@ -291,6 +296,9 @@ public class BrowserManager {
* Creates web browser
*/
private IBrowser createBrowserAdapter(boolean forceExternal) {
+ if (!initialized) {
+ init();
+ }
IBrowser browser = null;
if(! forceExternal && internalBrowserDesc != null){
browser = internalBrowserDesc.getFactory().createBrowser();
@@ -313,4 +321,26 @@ public class BrowserManager {
browser.close();
}
}
+ public boolean isEmbeddedBrowserPresent(){
+ if (!initialized) {
+ init();
+ }
+ return internalBrowserDesc != null;
+ }
+ public void setAlwaysUseExternal(boolean alwaysExternal){
+ if (!initialized) {
+ init();
+ }
+
+ alwaysUseExternal = alwaysExternal || !isEmbeddedBrowserPresent();
+ }
+ public boolean isAlwaysUseExternal(){
+ if (!initialized) {
+ init();
+ }
+ if(!isEmbeddedBrowserPresent()){
+ return true;
+ }
+ return alwaysUseExternal;
+ }
}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpUIResources.properties b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpUIResources.properties
index 2fe393054..6db2a368b 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpUIResources.properties
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpUIResources.properties
@@ -20,10 +20,14 @@ browserTitle = Help - {0}
# BrowserManager
no_browsers = There is no browser adapter configured to display {0}. Ensure that you have a required browser and adapter installed, and that the browser program is available on the system path.
# BrowsersPreferencePage
+embedded_browser = Embedded browser
+use_embedded_browser = Use embedded browser
+use_only_external_browser = Use only external browsers
+
select_browser = The selected web browser adapter determines the web browser used to display\n\
help documents. If only one browser adapter has been configured, the selection\n\
cannot be changed.
-current_browser = Current &web browser adapter:
+current_browser = Current external &web browser adapter:
# SystemBrowserAdapter
SystemBrowser.noProgramForURL = Your system has no program registered for file {0}. Change the file association or choose a different help web browser in the preferences.
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/browser/BrowsersPreferencePage.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/browser/BrowsersPreferencePage.java
index bc31bfeae..0183bf583 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/browser/BrowsersPreferencePage.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/browser/BrowsersPreferencePage.java
@@ -29,6 +29,8 @@ import org.eclipse.ui.help.*;
public class BrowsersPreferencePage
extends PreferencePage
implements IWorkbenchPreferencePage {
+ protected Button useBoth;
+ protected Button useExternal;
protected Table browsersTable;
private Label customBrowserPathLabel;
protected Text customBrowserPath;
@@ -59,7 +61,30 @@ public class BrowsersPreferencePage
description.setFont(font);
description.setText(HelpUIResources.getString("select_browser"));
createSpacer(mainComposite);
-
+
+ if (BrowserManager.getInstance().isEmbeddedBrowserPresent()) {
+ Group group = new Group(mainComposite, SWT.NONE);
+ group.setFont(font);
+ group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ group.setFont(font);
+ group.setText(HelpUIResources.getString("embedded_browser")
+ + " (work in progress, requires restart)");
+ layout = new GridLayout();
+ group.setLayout(layout);
+ useBoth = new Button(group, SWT.RADIO);
+ useBoth.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL));
+ useBoth.setText(HelpUIResources.getString("use_embedded_browser"));
+ useBoth.setSelection(!HelpBasePlugin
+ .getDefault()
+ .getPluginPreferences()
+ .getBoolean(BrowserManager.ALWAYS_EXTERNAL_BROWSER_KEY));
+ useExternal = new Button(group, SWT.RADIO);
+ useExternal.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL));
+ useExternal.setText(HelpUIResources
+ .getString("use_only_external_browser"));
+ useExternal.setSelection(!useBoth.getSelection());
+ createSpacer(mainComposite);
+ }
Label tableDescription = new Label(mainComposite, SWT.NULL);
tableDescription.setFont(font);
tableDescription.setText(
@@ -198,6 +223,14 @@ public class BrowsersPreferencePage
HelpBasePlugin.getDefault().getPluginPreferences().getDefaultString(
CustomBrowser.CUSTOM_BROWSER_PATH_KEY));
setEnabledCustomBrowserPath();
+ if(useBoth!=null){
+ useBoth.setSelection(!HelpBasePlugin
+ .getDefault()
+ .getPluginPreferences()
+ .getDefaultBoolean(BrowserManager.ALWAYS_EXTERNAL_BROWSER_KEY));
+ useExternal.setSelection(!useBoth.getSelection());
+
+ }
super.performDefaults();
}
/**
@@ -223,6 +256,9 @@ public class BrowsersPreferencePage
pref.setValue(
CustomBrowser.CUSTOM_BROWSER_PATH_KEY,
customBrowserPath.getText());
+ if(useExternal!=null){
+ pref.setValue(BrowserManager.ALWAYS_EXTERNAL_BROWSER_KEY, useExternal.getSelection());
+ }
HelpBasePlugin.getDefault().savePluginPreferences();
return true;
}

Back to the top