Skip to content

Commit 4e026e5

Browse files
fix: Fix NoSuchMethodError in Hop Web when changing GUI options (#6546)
Display.isSystemDarkTheme() method is not available in Eclipse RAP (Web environment). Calling this method causes java.lang.NoSuchMethodError exception when users try to change locale or other GUI options in Hop Web. Changes: - Add EnvironmentUtils.getInstance().isWeb() check in ConfigGuiOptionsTab.java - In reloadValues(): use stored dark mode preference in Web environment - In saveValues(): use checkbox selection value in Web environment This fix allows Hop Web users to change locale and GUI settings without errors.
1 parent 6bb4217 commit 4e026e5

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

ui/src/main/java/org/apache/hop/ui/hopgui/perspective/configuration/tabs/ConfigGuiOptionsTab.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import org.apache.hop.ui.core.gui.GuiResource;
3333
import org.apache.hop.ui.hopgui.HopGui;
3434
import org.apache.hop.ui.hopgui.perspective.configuration.ConfigurationPerspective;
35+
import org.apache.hop.ui.util.EnvironmentUtils;
3536
import org.eclipse.swt.SWT;
3637
import org.eclipse.swt.custom.CTabFolder;
3738
import org.eclipse.swt.custom.CTabItem;
@@ -165,9 +166,12 @@ public void reloadValues() {
165166
wHideMenuBar.setSelection(props.isHidingMenuBar());
166167
wShowTableViewToolbar.setSelection(props.isShowTableViewToolbar());
167168
// On macOS (and other non-Windows), dark mode follows system; sync from system so UI and
168-
// props match
169-
boolean darkMode = Const.isWindows() ? props.isDarkMode() : Display.isSystemDarkTheme();
170-
if (!Const.isWindows()) {
169+
// props match. In Web environment, isSystemDarkTheme() is not available.
170+
boolean darkMode;
171+
if (EnvironmentUtils.getInstance().isWeb() || Const.isWindows()) {
172+
darkMode = props.isDarkMode();
173+
} else {
174+
darkMode = Display.isSystemDarkTheme();
171175
props.setDarkMode(darkMode);
172176
}
173177
wDarkMode.setSelection(darkMode);
@@ -941,8 +945,13 @@ private void saveValues() {
941945
props.setInfiniteCanvasMoveEnabled(wEnableInfiniteMove.getSelection());
942946
props.setZoomScrollingDisabled(wDisableZoomScrolling.getSelection());
943947
// On macOS (and other non-Windows), dark mode follows system; persist system theme, not
944-
// checkbox
945-
boolean darkMode = Const.isWindows() ? wDarkMode.getSelection() : Display.isSystemDarkTheme();
948+
// checkbox. In Web environment, isSystemDarkTheme() is not available.
949+
boolean darkMode;
950+
if (EnvironmentUtils.getInstance().isWeb() || Const.isWindows()) {
951+
darkMode = wDarkMode.getSelection();
952+
} else {
953+
darkMode = Display.isSystemDarkTheme();
954+
}
946955
props.setDarkMode(darkMode);
947956
props.setHidingMenuBar(wHideMenuBar.getSelection());
948957
props.setShowTableViewToolbar(wShowTableViewToolbar.getSelection());

0 commit comments

Comments
 (0)