Improved functionality of "Load Layout" dock button.

This commit is contained in:
7Durandal7
2012-05-11 21:03:14 +00:00
parent 407fd5787c
commit e850a3f872
2 changed files with 18 additions and 6 deletions

View File

@@ -93,10 +93,16 @@ public enum CDock implements ICDoc {
@Override
public Void doInBackground() {
SaveOpenDialog dlgOpen = new SaveOpenDialog();
File LoadFile = new File(SIOUtil.FILE_PREFERRED);
LoadFile = dlgOpen.OpenDialog(LoadFile, null);
File DefFile = new File(SIOUtil.FILE_PREFERRED);
File LoadFile = dlgOpen.OpenDialog(DefFile, Filetypes.LAYOUT);
SIOUtil.loadLayout(LoadFile);
if (LoadFile!=null) {
SIOUtil.loadLayout(LoadFile);
}
else {
SIOUtil.loadLayout(DefFile);
}
SIOUtil.saveLayout();
SOverlayUtils.hideOverlay();
return null;
}

View File

@@ -53,13 +53,18 @@ public class SaveOpenDialog extends JPanel {
}
}
/**
*
* constructor for a save or open dialog
*/
public SaveOpenDialog() {
fc = new JFileChooser();
}
/**
* Shows the open dialog for files. If no file selected, returns default. Pass null
* to Type and Extension to allow all files to be viewed/opened.
* Shows the open dialog for files. If no file selected, returns null. Pass null
* to Type to allow all files to be viewed/opened.
* @param defFileName pass the default file to use, also determines directory
* @param type label to tell what type of file to filter
*
@@ -79,8 +84,9 @@ public class SaveOpenDialog extends JPanel {
int RetValue = fc.showOpenDialog(getParent());
if (RetValue == JFileChooser.APPROVE_OPTION) {
RetFile = fc.getSelectedFile();
return RetFile;
}
return RetFile;
return null;
}
/**