Skip to content

Commit 7e3855d

Browse files
authored
fix(preferences): handle imported theme more clearly (#11)
1 parent a72af2c commit 7e3855d

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

bundles/com.github.eclipsethemes/src/com/github/eclipsethemes/eclipse/preferences/EclipseThemesPreferencePage.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -530,22 +530,23 @@ private void importTheme() {
530530
}
531531

532532
try {
533-
Optional<Theme> importedTheme = EclipseThemes.instance().getManager().importTheme(selectedFile);
534-
if (importedTheme.isEmpty()) {
533+
Optional<Theme> importedThemeOpt = EclipseThemes.instance().getManager().importTheme(selectedFile);
534+
if (importedThemeOpt.isEmpty()) {
535535
showErrorMessage("Import Failed",
536536
"Could not import theme - it may conflict with an existing theme or have invalid format.");
537537
return;
538538
}
539-
539+
Theme importedTheme = importedThemeOpt.get();
540+
540541
// Refresh and select the new theme
541542
loadThemes();
542543
filterThemes();
543-
544-
selectedTheme = importedTheme.get();
544+
545+
selectedTheme = importedTheme;
545546
themeViewer.setSelection(new StructuredSelection(selectedTheme));
546547

547548
showInfoMessage("Import Successful",
548-
"Theme '" + selectedTheme.getName() + "' has been imported successfully.");
549+
"Theme '" + importedTheme.getName() + "' has been imported successfully.");
549550

550551
} catch (Exception e) {
551552
EclipseThemes.instance().getLogger().error("Import Error", e);

0 commit comments

Comments
 (0)