Skip to content

Commit c8348e9

Browse files
authored
Merge pull request #3395 from ControlSystemStudio/CSSTUDIO-3165-branch2
CSSTUDIO-3165 Open Phoebus Help in the default web browser instead of in the JavaFX WebView
2 parents 09d6001 + c1110c5 commit c8348e9

File tree

4 files changed

+43
-162
lines changed

4 files changed

+43
-162
lines changed

core/ui/src/main/java/org/phoebus/ui/help/HelpApplication.java

Lines changed: 0 additions & 44 deletions
This file was deleted.

core/ui/src/main/java/org/phoebus/ui/help/HelpBrowser.java

Lines changed: 0 additions & 114 deletions
This file was deleted.

core/ui/src/main/java/org/phoebus/ui/help/OpenHelp.java

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,20 @@
77
*******************************************************************************/
88
package org.phoebus.ui.help;
99

10-
import org.phoebus.framework.workbench.ApplicationService;
10+
import org.phoebus.framework.workbench.Locations;
1111
import org.phoebus.ui.application.Messages;
1212
import org.phoebus.ui.javafx.ImageCache;
1313
import org.phoebus.ui.spi.MenuEntry;
1414

1515
import javafx.scene.image.Image;
16+
import org.phoebus.ui.web.WebBrowserApplication;
17+
18+
import java.io.File;
19+
import java.net.URI;
20+
import java.net.URISyntaxException;
21+
import java.util.logging.Level;
22+
23+
import static org.phoebus.ui.application.PhoebusApplication.logger;
1624

1725
/** Menu entry to open help
1826
* @author Kay Kasemir
@@ -23,7 +31,7 @@ public class OpenHelp implements MenuEntry
2331
@Override
2432
public String getName()
2533
{
26-
return HelpApplication.DISPLAY_NAME;
34+
return Messages.Help;
2735
}
2836

2937
@Override
@@ -41,7 +49,39 @@ public Image getIcon()
4149
@Override
4250
public Void call()
4351
{
44-
ApplicationService.createInstance(HelpApplication.NAME);
52+
try {
53+
URI helpLocationURI = new URI(determineHelpLocation());
54+
WebBrowserApplication webBrowserApplication = new WebBrowserApplication();
55+
webBrowserApplication.create(helpLocationURI);
56+
} catch (URISyntaxException uriSyntaxException) {
57+
throw new RuntimeException(uriSyntaxException);
58+
}
4559
return null;
4660
}
61+
62+
public static String determineHelpLocation()
63+
{
64+
final File phoenix_install = Locations.install();
65+
66+
// The distribution includes a lib/ and a doc/ folder.
67+
// Check for the doc/index.html
68+
File loc = new File(phoenix_install, "doc/index.html");
69+
if (loc.exists())
70+
return loc.toURI().toString();
71+
72+
// During development,
73+
// product is started from IDE as ....../git/phoebus/phoebus-product.
74+
// Check for copy of docs in ....../git/phoebus/docs/build/html
75+
loc = new File(phoenix_install, "docs");
76+
if (loc.exists())
77+
{
78+
loc = new File(loc, "build/html/index.html");
79+
if (loc.exists())
80+
return loc.toURI().toString();
81+
logger.log(Level.WARNING, "Found phoebus-doc repository, but no build/html/index.html. Run 'make html'");
82+
}
83+
84+
// Fall back to online copy of the manual
85+
return "https://control-system-studio.readthedocs.io";
86+
}
4787
}
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
org.phoebus.ui.welcome.Welcome
22
org.phoebus.ui.pv.PVListApplication
33
org.phoebus.ui.jobs.JobViewerApplication
4-
org.phoebus.ui.help.HelpApplication
54
org.phoebus.ui.web.WebBrowserApplication

0 commit comments

Comments
 (0)