Skip to content

Commit

Permalink
Refactored quitting process (JabRef#10783)
Browse files Browse the repository at this point in the history
* Moved openDatabases to JabRefFrame

* Removed long obsolete swing methods for mac

* Moved gui closing code to JabRefGUI

* Moved ThemeManager to JabRefGUI

* Rearranged code
  • Loading branch information
calixtus authored Jan 15, 2024
1 parent 899f503 commit 3e7e58a
Show file tree
Hide file tree
Showing 6 changed files with 214 additions and 248 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/cli/Launcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ private static void addLogToDisk() {
"writerFile.file", directory.resolve("log.txt").toString(),
"writerFile.charset", "UTF-8");

configuration.entrySet().forEach(config -> Configuration.set(config.getKey(), config.getValue()));
configuration.forEach(Configuration::set);
initializeLogger();
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jabref/gui/DefaultInjector.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class DefaultInjector implements PresenterFactory {
*/
private static Object createDependency(Class<?> clazz) {
if (clazz == DialogService.class) {
return JabRefGUI.getMainFrame().getDialogService();
return JabRefGUI.getDialogService();
} else if (clazz == TaskExecutor.class) {
return Globals.TASK_EXECUTOR;
} else if (clazz == PreferencesService.class) {
Expand All @@ -41,7 +41,7 @@ private static Object createDependency(Class<?> clazz) {
} else if (clazz == StateManager.class) {
return Globals.stateManager;
} else if (clazz == ThemeManager.class) {
return Globals.getThemeManager();
return JabRefGUI.getThemeManager();
} else if (clazz == FileUpdateMonitor.class) {
return Globals.getFileUpdateMonitor();
} else if (clazz == ProtectedTermsLoader.class) {
Expand Down
12 changes: 0 additions & 12 deletions src/main/java/org/jabref/gui/Globals.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import org.jabref.architecture.AllowedToUseAwt;
import org.jabref.gui.keyboard.KeyBindingRepository;
import org.jabref.gui.remote.CLIMessageHandler;
import org.jabref.gui.theme.ThemeManager;
import org.jabref.gui.undo.CountingUndoManager;
import org.jabref.gui.util.DefaultFileUpdateMonitor;
import org.jabref.gui.util.DefaultTaskExecutor;
Expand Down Expand Up @@ -66,7 +65,6 @@ public class Globals {

private static ClipBoardManager clipBoardManager = null;
private static KeyBindingRepository keyBindingRepository;
private static ThemeManager themeManager;

private static DefaultFileUpdateMonitor fileUpdateMonitor;

Expand All @@ -88,16 +86,6 @@ public static synchronized ClipBoardManager getClipboardManager() {
return clipBoardManager;
}

public static synchronized ThemeManager getThemeManager() {
if (themeManager == null) {
themeManager = new ThemeManager(
prefs.getWorkspacePreferences(),
getFileUpdateMonitor(),
Runnable::run);
}
return themeManager;
}

public static synchronized FileUpdateMonitor getFileUpdateMonitor() {
if (fileUpdateMonitor == null) {
fileUpdateMonitor = new DefaultFileUpdateMonitor();
Expand Down
Loading

0 comments on commit 3e7e58a

Please sign in to comment.