diff --git a/AlgebraicDataflowArchitectureModel/src/graphicalrefactor/actions/SaveAsAction.java b/AlgebraicDataflowArchitectureModel/src/graphicalrefactor/actions/SaveAsAction.java index 05a90ca..1d96d65 100644 --- a/AlgebraicDataflowArchitectureModel/src/graphicalrefactor/actions/SaveAsAction.java +++ b/AlgebraicDataflowArchitectureModel/src/graphicalrefactor/actions/SaveAsAction.java @@ -35,10 +35,9 @@ // Adds file filter for supported file format FileFilter defaultFilter = new FileFilter() { - public boolean accept(File file) { String lcase = file.getName().toLowerCase(); - return lcase.endsWith(".model"); + return lcase.endsWith(".model"); } @Override @@ -46,14 +45,22 @@ return null; } }; + fc.addChoosableFileFilter(defaultFilter); fc.addChoosableFileFilter(model); fc.addChoosableFileFilter(dtram); int rc = fc.showDialog(null, "Save Model File"); + + // choose file extentions from a dialog. if (rc == JFileChooser.APPROVE_OPTION) { + FileNameExtensionFilter selectedFilter = (FileNameExtensionFilter)fc.getFileFilter(); + + String extension = "." + selectedFilter.getExtensions()[0].toString(); lastDir = fc.getSelectedFile().getParent(); - editor.setCurFilePath(fc.getSelectedFile().getAbsolutePath()); + + editor.setCurFilePath(fc.getSelectedFile().getAbsolutePath() + extension); editor.save(); + frame.setTitle(frame.title + " - " + fc.getSelectedFile().getAbsolutePath()); } }