Skip to content
Snippets Groups Projects
Commit 119179fd authored by Fabien Tessier's avatar Fabien Tessier
Browse files

Add FileChooser for model network load

parent fb530d95
No related branches found
No related tags found
2 merge requests!30Merge project manager into master,!29Resolve "Implement Project Management in TTool"
...@@ -97,6 +97,7 @@ public class JDialogLoadingNetworkModel extends javax.swing.JFrame implements Ac ...@@ -97,6 +97,7 @@ public class JDialogLoadingNetworkModel extends javax.swing.JFrame implements Ac
private String url; private String url;
private NetworkModelPanel panel; private NetworkModelPanel panel;
private String filePath; private String filePath;
private JFileChooser jfc;
/** Creates new form */ /** Creates new form */
...@@ -124,6 +125,13 @@ public class JDialogLoadingNetworkModel extends javax.swing.JFrame implements Ac ...@@ -124,6 +125,13 @@ public class JDialogLoadingNetworkModel extends javax.swing.JFrame implements Ac
protected void myInitComponents() { protected void myInitComponents() {
if (ConfigurationTTool.DownloadedFILEPath.length() > 0) {
jfc = new JFileChooser(ConfigurationTTool.DownloadedFILEPath);
} else {
jfc = new JFileChooser();
}
mode = NOT_LISTED; mode = NOT_LISTED;
setButtons(); setButtons();
} }
...@@ -356,14 +364,18 @@ public class JDialogLoadingNetworkModel extends javax.swing.JFrame implements Ac ...@@ -356,14 +364,18 @@ public class JDialogLoadingNetworkModel extends javax.swing.JFrame implements Ac
jta.append("Loading model: " + fileName); jta.append("Loading model: " + fileName);
String urlToLoad = URLManager.getBaseURL(url) + fileName; String urlToLoad = URLManager.getBaseURL(url) + fileName;
URLManager urlm = new URLManager(); URLManager urlm = new URLManager();
if ((ConfigurationTTool.DownloadedFILEPath == null) || (ConfigurationTTool.DownloadedFILEPath.length() == 0)) { jfc.setSelectedFile(new File(FileUtils.removeFileExtension(fileName)));
filePath = fileName; int returnVal = jfc.showSaveDialog(f);
} else { if(returnVal == JFileChooser.APPROVE_OPTION) {
filePath = ConfigurationTTool.DownloadedFILEPath + "/" + fileName; filePath = jfc.getSelectedFile().getAbsolutePath();
} filePath = FileUtils.addFileExtensionIfMissing(filePath, "xml");
boolean ok = urlm.downloadFile(filePath, urlToLoad,this); boolean ok = urlm.downloadFile(filePath, urlToLoad,this);
if (!ok) { if (!ok) {
loadFailed(); loadFailed();
}
}
else {
panel.reactivateSelection();
} }
} }
......
...@@ -68,20 +68,10 @@ ...@@ -68,20 +68,10 @@
<PLUGIN_JAVA_CODE_GENERATOR data="../plugins/CustomizerAvatarCodeGeneration.jar" /> <PLUGIN_JAVA_CODE_GENERATOR data="../plugins/CustomizerAvatarCodeGeneration.jar" />
<<<<<<< HEAD <LastOpenFile data="/home/satan/TTool/modeling/DIPLODOCUS/ZigBeeTutorial.ttool"/>
<<<<<<< Upstream, based on origin/project_manager
<LastOpenFile data="/home/satan/ZigBeeTutorial.ttool/ZigBeeTutorial.xml"/>
=======
<LastOpenFile data="/home/dblouin/Projets/TTool/git/TTool/modeling/DIPLODOCUS/ZigBeeTutorial.xml"/>
>>>>>>> 4749348 Issue #98: Fixed default C Code generation directory
=======
<LastOpenFile data="/home/dblouin/Projets/TTool/git/TTool/modeling/DIPLODOCUS/ZigBeeTutorial.xml"/>
>>>>>>> ac0a9cec52efa7fb18b9e7e8f72519b069f3c727
<LastWindowAttributes x="65" y="24" width="1301" height="744" max="true" /> <LastWindowAttributes x="65" y="24" width="1301" height="744" max="true" />
<ProVerifHash data="-695076237"/> <ProVerifHash data="1427594573"/>
</TURTLECONFIGURATION> </TURTLECONFIGURATION>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment