|
From: <ste...@us...> - 2010-09-08 21:42:59
|
Revision: 1417
http://rails.svn.sourceforge.net/rails/?rev=1417&view=rev
Author: stefanfrey
Date: 2010-09-08 21:42:53 +0000 (Wed, 08 Sep 2010)
Log Message:
-----------
Fixed problem with import functionality in configuration UI
Modified Paths:
--------------
trunk/18xx/rails/ui/swing/ConfigWindow.java
trunk/18xx/rails/util/Config.java
Modified: trunk/18xx/rails/ui/swing/ConfigWindow.java
===================================================================
--- trunk/18xx/rails/ui/swing/ConfigWindow.java 2010-09-08 21:41:33 UTC (rev 1416)
+++ trunk/18xx/rails/ui/swing/ConfigWindow.java 2010-09-08 21:42:53 UTC (rev 1417)
@@ -535,7 +535,7 @@
{
File file = fc.getSelectedFile();
if (Config.importProfileFromFile(file)) {
- changeProfile(Config.getActiveProfileName());
+ repaintLater();
} else {
JOptionPane.showMessageDialog(ConfigWindow.this, LocalText.getText("CONFIG_LOAD_ERROR_MESSAGE", Config.getActiveProfileName()),
LocalText.getText("CONFIG_LOAD_TITLE"), JOptionPane.ERROR_MESSAGE);
@@ -545,6 +545,10 @@
private void changeProfile(String profileName) {
Config.changeActiveProfile(profileName);
+ repaintLater();
+ }
+
+ private void repaintLater() {
EventQueue.invokeLater(new Runnable() {
public void run() {
init();
Modified: trunk/18xx/rails/util/Config.java
===================================================================
--- trunk/18xx/rails/util/Config.java 2010-09-08 21:41:33 UTC (rev 1416)
+++ trunk/18xx/rails/util/Config.java 2010-09-08 21:42:53 UTC (rev 1417)
@@ -441,7 +441,7 @@
* loads an external user profile
* defined by the filepath
*/
- public static boolean importProfileFromFile(File file) {
+ public static boolean loadProfileFromFile(File file) {
String filepath = file.getPath();
if (loadPropertyFile(userProperties, filepath, false)) {
String profile = userProperties.getProperty(PROFILENAME_PROPERTY);
@@ -449,7 +449,7 @@
profile = STANDARD_PROFILE_SELECTION;
}
selectedProfile = profile;
-// setActiveFilepath(filepath); // do not set filepath on import
+ setActiveFilepath(filepath); // do not set filepath on import
loadDefaultProfile();
setSaveDirDefaults();
return true;
@@ -457,6 +457,22 @@
return false;
}
}
+
+ /**
+ * imports an external user profile into an existing profile
+ * defined by the filepath
+ */
+ public static boolean importProfileFromFile(File file) {
+ String filepath = file.getPath();
+ Properties importProperties = new Properties();
+ if (loadPropertyFile(importProperties, filepath, false)) {
+ userProperties.putAll(importProperties);
+ setSaveDirDefaults();
+ return true;
+ } else {
+ return false;
+ }
+ }
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|