2727import java .util .stream .Collectors ;
2828
2929import javafx .beans .InvalidationListener ;
30+ import javafx .beans .property .SimpleMapProperty ;
31+ import javafx .collections .FXCollections ;
3032import javafx .collections .ListChangeListener ;
3133import javafx .collections .ObservableSet ;
3234import javafx .collections .SetChangeListener ;
@@ -790,14 +792,31 @@ public void setLanguageDependentDefaultValues() {
790792 // region PushToApplicationPreferences
791793
792794 private PushToApplicationPreferences getPushToApplicationPreferencesFromBackingStore (PushToApplicationPreferences defaults ) {
795+ Map <String , String > commandPaths = new HashMap <>(defaults .getCommandPaths ());
796+ Map <String , String > lookup = new HashMap <>();
797+ lookup .put (PushApplications .EMACS .getDisplayName (), PUSH_EMACS_PATH );
798+ lookup .put (PushApplications .LYX .getDisplayName (), PUSH_LYXPIPE );
799+ lookup .put (PushApplications .TEXMAKER .getDisplayName (), PUSH_TEXMAKER_PATH );
800+ lookup .put (PushApplications .TEXSTUDIO .getDisplayName (), PUSH_TEXSTUDIO_PATH );
801+ lookup .put (PushApplications .TEXWORKS .getDisplayName (), PUSH_TEXWORKS_PATH );
802+ lookup .put (PushApplications .VIM .getDisplayName (), PUSH_VIM );
803+ lookup .put (PushApplications .WIN_EDT .getDisplayName (), PUSH_WINEDT_PATH );
804+ lookup .put (PushApplications .SUBLIME_TEXT .getDisplayName (), PUSH_SUBLIME_TEXT_PATH );
805+ lookup .put (PushApplications .VSCODE .getDisplayName (), PUSH_VSCODE_PATH );
806+ for (Map .Entry <String , String > entry : commandPaths .entrySet ()) {
807+ String oldKey = lookup .get (entry .getKey ());
808+ String defaultValue = entry .getValue ();
809+ entry .setValue (getEmptyIsDefault (oldKey , defaultValue ));
810+ }
793811 return new PushToApplicationPreferences (
794812 get (PUSH_TO_APPLICATION , defaults .getActiveApplicationName ()),
795- defaults . getCommandPaths ( ),
813+ new SimpleMapProperty <>( FXCollections . observableMap ( commandPaths ) ),
796814 get (PUSH_EMACS_ADDITIONAL_PARAMETERS , defaults .getEmacsArguments ()),
797815 get (PUSH_VIM_SERVER , defaults .getVimServer ()),
798- defaults .getCiteCommand (),
799- defaults .getDefaultCiteCommand ()
816+ CitationCommandString . from ( get ( PUSH_CITE_COMMAND , defaults .getCiteCommand (). toString ()) ),
817+ CitationCommandString . from ( get ( PUSH_CITE_COMMAND , defaults .getDefaultCiteCommand (). toString ()) )
800818 );
819+
801820 }
802821
803822 public PushToApplicationPreferences getPushToApplicationPreferences () {
@@ -894,8 +913,7 @@ public String get(String key) {
894913 return PREFS_NODE .get (key , (String ) defaults .get (key ));
895914 }
896915
897- public String getEmptyIsDefault (String key ) {
898- String defaultValue = (String ) defaults .get (key );
916+ public String getEmptyIsDefault (String key , String defaultValue ) {
899917 String result = PREFS_NODE .get (key , defaultValue );
900918 if ("" .equals (result )) {
901919 return defaultValue ;
@@ -920,12 +938,6 @@ public boolean getBoolean(String key, boolean def) {
920938 }
921939
922940 private boolean getBooleanDefault (String key ) {
923-
924- if (defaults .get (key ) == null ) {
925- // Couldn't run the application without this condition.
926- LOGGER .info ("************************* THIS KEY IS NULL {}" , key );
927- return false ;
928- }
929941 return (Boolean ) defaults .get (key );
930942 }
931943
0 commit comments