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
private String url;
private NetworkModelPanel panel;
private String filePath;
private JFileChooser jfc;
/** Creates new form */
......@@ -124,6 +125,13 @@ public class JDialogLoadingNetworkModel extends javax.swing.JFrame implements Ac
protected void myInitComponents() {
if (ConfigurationTTool.DownloadedFILEPath.length() > 0) {
jfc = new JFileChooser(ConfigurationTTool.DownloadedFILEPath);
} else {
jfc = new JFileChooser();
}
mode = NOT_LISTED;
setButtons();
}
......@@ -356,14 +364,18 @@ public class JDialogLoadingNetworkModel extends javax.swing.JFrame implements Ac
jta.append("Loading model: " + fileName);
String urlToLoad = URLManager.getBaseURL(url) + fileName;
URLManager urlm = new URLManager();
if ((ConfigurationTTool.DownloadedFILEPath == null) || (ConfigurationTTool.DownloadedFILEPath.length() == 0)) {
filePath = fileName;
} else {
filePath = ConfigurationTTool.DownloadedFILEPath + "/" + fileName;
}
boolean ok = urlm.downloadFile(filePath, urlToLoad,this);
if (!ok) {
loadFailed();
jfc.setSelectedFile(new File(FileUtils.removeFileExtension(fileName)));
int returnVal = jfc.showSaveDialog(f);
if(returnVal == JFileChooser.APPROVE_OPTION) {
filePath = jfc.getSelectedFile().getAbsolutePath();
filePath = FileUtils.addFileExtensionIfMissing(filePath, "xml");
boolean ok = urlm.downloadFile(filePath, urlToLoad,this);
if (!ok) {
loadFailed();
}
}
else {
panel.reactivateSelection();
}
}
......
......@@ -68,20 +68,10 @@
<PLUGIN_JAVA_CODE_GENERATOR data="../plugins/CustomizerAvatarCodeGeneration.jar" />
<<<<<<< HEAD
<<<<<<< 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
<LastOpenFile data="/home/satan/TTool/modeling/DIPLODOCUS/ZigBeeTutorial.ttool"/>
<LastWindowAttributes x="65" y="24" width="1301" height="744" max="true" />
<ProVerifHash data="-695076237"/>
<ProVerifHash data="1427594573"/>
</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