Skip to content

Commit cb12419

Browse files
committed
CSSTUDIO-3165 Move the method determineHelpLocation() from the class 'HelpBrowser' to the class 'OpenHelp'.
1 parent 656b506 commit cb12419

File tree

2 files changed

+33
-28
lines changed

2 files changed

+33
-28
lines changed

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

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -64,37 +64,11 @@ protected void fillInformation(final StringBuilder info)
6464

6565
private void loadHelp(final JobMonitor monitor)
6666
{
67-
final String location = determineHelpLocation();
67+
final String location = OpenHelp.determineHelpLocation();
6868
logger.log(Level.CONFIG, "Showing help from " + location);
6969
Platform.runLater(() -> browser.getEngine().load(location));
7070
}
7171

72-
public static String determineHelpLocation()
73-
{
74-
final File phoenix_install = Locations.install();
75-
76-
// The distribution includes a lib/ and a doc/ folder.
77-
// Check for the doc/index.html
78-
File loc = new File(phoenix_install, "doc/index.html");
79-
if (loc.exists())
80-
return loc.toURI().toString();
81-
82-
// During development,
83-
// product is started from IDE as ....../git/phoebus/phoebus-product.
84-
// Check for copy of docs in ....../git/phoebus/docs/build/html
85-
loc = new File(phoenix_install, "docs");
86-
if (loc.exists())
87-
{
88-
loc = new File(loc, "build/html/index.html");
89-
if (loc.exists())
90-
return loc.toURI().toString();
91-
logger.log(Level.WARNING, "Found phoebus-doc repository, but no build/html/index.html. Run 'make html'");
92-
}
93-
94-
// Fall back to online copy of the manual
95-
return "https://control-system-studio.readthedocs.io";
96-
}
97-
9872
@Override
9973
public AppDescriptor getAppDescriptor()
10074
{

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

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,20 @@
77
*******************************************************************************/
88
package org.phoebus.ui.help;
99

10+
import org.phoebus.framework.workbench.Locations;
1011
import org.phoebus.ui.application.Messages;
1112
import org.phoebus.ui.javafx.ImageCache;
1213
import org.phoebus.ui.spi.MenuEntry;
1314

1415
import javafx.scene.image.Image;
1516
import org.phoebus.ui.web.WebBrowserApplication;
1617

18+
import java.io.File;
1719
import java.net.URI;
1820
import java.net.URISyntaxException;
21+
import java.util.logging.Level;
22+
23+
import static org.phoebus.ui.application.PhoebusApplication.logger;
1924

2025
/** Menu entry to open help
2126
* @author Kay Kasemir
@@ -45,12 +50,38 @@ public Image getIcon()
4550
public Void call()
4651
{
4752
try {
48-
URI helpLocationURI = new URI(HelpBrowser.determineHelpLocation());
53+
URI helpLocationURI = new URI(determineHelpLocation());
4954
WebBrowserApplication webBrowserApplication = new WebBrowserApplication();
5055
webBrowserApplication.create(helpLocationURI);
5156
} catch (URISyntaxException uriSyntaxException) {
5257
throw new RuntimeException(uriSyntaxException);
5358
}
5459
return null;
5560
}
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+
}
5687
}

0 commit comments

Comments
 (0)