From 2a759e0be0a8e57cf133993455c1a0b1324378d1 Mon Sep 17 00:00:00 2001 From: shroffk Date: Mon, 6 Apr 2026 14:45:43 -0400 Subject: [PATCH 1/3] reverting_3740 --- core/launcher/src/main/java/org/phoebus/product/Launcher.java | 2 +- core/ui/src/main/java/org/phoebus/ui/help/OpenAbout.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/launcher/src/main/java/org/phoebus/product/Launcher.java b/core/launcher/src/main/java/org/phoebus/product/Launcher.java index ab8d739d34..396c5368c1 100644 --- a/core/launcher/src/main/java/org/phoebus/product/Launcher.java +++ b/core/launcher/src/main/java/org/phoebus/product/Launcher.java @@ -100,7 +100,7 @@ public static void main(final String[] original_args) throws Exception { if (siteSettings.canRead()) { logger.info("Loading bundled settings from " + siteSettings.getAbsolutePath()); - loadSettings(siteSettings.getAbsolutePath()); + loadSettings(siteSettings.getName()); } // Handle arguments, potentially not even starting the UI diff --git a/core/ui/src/main/java/org/phoebus/ui/help/OpenAbout.java b/core/ui/src/main/java/org/phoebus/ui/help/OpenAbout.java index 70b5834a88..cac0e55764 100644 --- a/core/ui/src/main/java/org/phoebus/ui/help/OpenAbout.java +++ b/core/ui/src/main/java/org/phoebus/ui/help/OpenAbout.java @@ -191,12 +191,12 @@ private Node createDetailSection() area.setEditable(false); final Tab props = new Tab(Messages.HelpAboutSysFea, area); - String settingsSnapshot = Preferences.userRoot().get(SETTINGS_SNAPSHOT, ""); + String settings_snapshot = Preferences.userRoot().get(SETTINGS_SNAPSHOT, ""); WebView webView = new WebView(); String content = ""; - content += settingsSnapshot; + content += settings_snapshot; content += ""; webView.getEngine().loadContent(content); From c2fbc854e066a26ad85dfa5d42e516b2a3be58da Mon Sep 17 00:00:00 2001 From: shroffk Date: Mon, 6 Apr 2026 14:50:26 -0400 Subject: [PATCH 2/3] revert loading settings 3740 --- .../java/org/phoebus/product/Launcher.java | 34 ++++++------------- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/core/launcher/src/main/java/org/phoebus/product/Launcher.java b/core/launcher/src/main/java/org/phoebus/product/Launcher.java index 396c5368c1..5f7b82fdbd 100644 --- a/core/launcher/src/main/java/org/phoebus/product/Launcher.java +++ b/core/launcher/src/main/java/org/phoebus/product/Launcher.java @@ -2,7 +2,6 @@ import javafx.application.Application; import org.phoebus.framework.preferences.PropertyPreferenceLoader; -import org.phoebus.framework.preferences.PropertyPreferenceWriter; import org.phoebus.framework.spi.AppDescriptor; import org.phoebus.framework.spi.AppResourceDescriptor; import org.phoebus.framework.workbench.ApplicationService; @@ -10,7 +9,10 @@ import org.phoebus.ui.application.ApplicationServer; import org.phoebus.ui.application.PhoebusApplication; -import java.io.*; +import java.io.File; +import java.io.InputStream; +import java.io.FileInputStream; +import java.io.FileOutputStream; import java.lang.reflect.Method; import java.nio.charset.Charset; import java.util.ArrayList; @@ -23,14 +25,11 @@ import java.util.prefs.Preferences; import java.util.stream.Collectors; -import static org.phoebus.ui.application.PhoebusApplication.logger; - @SuppressWarnings("nls") public class Launcher { private static final String LOGGING_OPTION = "-logging"; private static final String DEFAULT_LOGGING_FILE="/logging.properties"; private static final String LOGGING_PROP = "java.util.logging.config.file"; - private static final String SETTINGS_SNAPSHOT = "settings_snapshot"; public static void main(final String[] original_args) throws Exception { // First Handle arguments, potentially not even starting the UI @@ -96,11 +95,11 @@ public static void main(final String[] original_args) throws Exception { Locations.initialize(); // Check for site-specific settings.ini bundled into distribution // before potentially adding command-line settings. - final File siteSettings = new File(Locations.install(), "settings.ini"); - if (siteSettings.canRead()) + final File site_settings = new File(Locations.install(), "settings.ini"); + if (site_settings.canRead()) { - logger.info("Loading bundled settings from " + siteSettings.getAbsolutePath()); - loadSettings(siteSettings.getName()); + logger.info("Loading bundled settings from " + site_settings.getAbsolutePath()); + LoadSettings(site_settings.getName()); } // Handle arguments, potentially not even starting the UI @@ -137,7 +136,7 @@ public static void main(final String[] original_args) throws Exception { iter.remove(); logger.info("Loading settings from " + location); - loadSettings(location); + LoadSettings(location); } else if (cmd.equals("-export_settings")) { if (!iter.hasNext()) throw new Exception("Missing -export_settings file name"); @@ -213,24 +212,11 @@ public static void main(final String[] original_args) throws Exception { Application.launch(PhoebusApplication.class, args.toArray(new String[args.size()])); } - private static void loadSettings(String location) throws Exception { + private static void LoadSettings(String location) throws Exception { if (location.endsWith(".xml")) Preferences.importPreferences(new FileInputStream(location)); else PropertyPreferenceLoader.load(location); - - // Preference settings - final ByteArrayOutputStream prefsBuf = new ByteArrayOutputStream(); - try - { - PropertyPreferenceWriter.save(prefsBuf); - } - catch (Exception ex) - { - logger.log(Level.WARNING, "Cannot list preferences", ex); - } - - Preferences.userRoot().put(SETTINGS_SNAPSHOT, prefsBuf.toString()); } private static void help() { From f32023a66a01262976abe1585e1c5315b70083bf Mon Sep 17 00:00:00 2001 From: shroffk Date: Mon, 6 Apr 2026 15:06:12 -0400 Subject: [PATCH 3/3] complete revert ( removing even working bits for cleanliness ) --- .../java/org/phoebus/product/Launcher.java | 19 ++++++++------- .../java/org/phoebus/ui/help/OpenAbout.java | 24 +++++++++++++++---- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/core/launcher/src/main/java/org/phoebus/product/Launcher.java b/core/launcher/src/main/java/org/phoebus/product/Launcher.java index 5f7b82fdbd..05b9bd88e1 100644 --- a/core/launcher/src/main/java/org/phoebus/product/Launcher.java +++ b/core/launcher/src/main/java/org/phoebus/product/Launcher.java @@ -99,7 +99,11 @@ public static void main(final String[] original_args) throws Exception { if (site_settings.canRead()) { logger.info("Loading bundled settings from " + site_settings.getAbsolutePath()); - LoadSettings(site_settings.getName()); + final FileInputStream fileInputStream = new FileInputStream(site_settings); + if (site_settings.getName().endsWith(".xml")) + Preferences.importPreferences(fileInputStream); + else + PropertyPreferenceLoader.load(fileInputStream); } // Handle arguments, potentially not even starting the UI @@ -136,7 +140,11 @@ public static void main(final String[] original_args) throws Exception { iter.remove(); logger.info("Loading settings from " + location); - LoadSettings(location); + if (location.endsWith(".xml")) + Preferences.importPreferences(new FileInputStream(location)); + else + PropertyPreferenceLoader.load(location); + } else if (cmd.equals("-export_settings")) { if (!iter.hasNext()) throw new Exception("Missing -export_settings file name"); @@ -212,13 +220,6 @@ public static void main(final String[] original_args) throws Exception { Application.launch(PhoebusApplication.class, args.toArray(new String[args.size()])); } - private static void LoadSettings(String location) throws Exception { - if (location.endsWith(".xml")) - Preferences.importPreferences(new FileInputStream(location)); - else - PropertyPreferenceLoader.load(location); - } - private static void help() { System.out.println(" _______ _______ _______ ______ _______ "); System.out.println("( ____ )|\\ /|( ___ )( ____ \\( ___ \\ |\\ /|( ____ \\"); diff --git a/core/ui/src/main/java/org/phoebus/ui/help/OpenAbout.java b/core/ui/src/main/java/org/phoebus/ui/help/OpenAbout.java index cac0e55764..254d9d48d5 100644 --- a/core/ui/src/main/java/org/phoebus/ui/help/OpenAbout.java +++ b/core/ui/src/main/java/org/phoebus/ui/help/OpenAbout.java @@ -7,11 +7,15 @@ *******************************************************************************/ package org.phoebus.ui.help; +import static org.phoebus.ui.application.PhoebusApplication.logger; + +import java.io.ByteArrayOutputStream; import java.io.File; import java.util.Arrays; import java.util.List; -import java.util.prefs.Preferences; +import java.util.logging.Level; +import org.phoebus.framework.preferences.PropertyPreferenceWriter; import org.phoebus.framework.workbench.ApplicationService; import org.phoebus.framework.workbench.Locations; import org.phoebus.ui.application.Messages; @@ -46,7 +50,6 @@ @SuppressWarnings("nls") public class OpenAbout implements MenuEntry { - private static final String SETTINGS_SNAPSHOT = "settings_snapshot"; /** Non-null while the 'about' dialog is shown */ private Alert dialog; @@ -191,12 +194,22 @@ private Node createDetailSection() area.setEditable(false); final Tab props = new Tab(Messages.HelpAboutSysFea, area); - String settings_snapshot = Preferences.userRoot().get(SETTINGS_SNAPSHOT, ""); + // Preference settings + final ByteArrayOutputStream prefs_buf = new ByteArrayOutputStream(); + try + { + PropertyPreferenceWriter.save(prefs_buf); + } + catch (Exception ex) + { + logger.log(Level.WARNING, "Cannot list preferences", ex); + } + WebView webView = new WebView(); String content = ""; - content += settings_snapshot; + content += prefs_buf.toString(); content += ""; webView.getEngine().loadContent(content); @@ -204,6 +217,7 @@ private Node createDetailSection() final Tab prefs = new Tab(Messages.HelpAboutPrefs, webView); - return new TabPane(apps, envs, props, prefs); + final TabPane tabs = new TabPane(apps, envs, props, prefs); + return tabs; } }