From 823b593b4ee3f71bd84f4ae64d63ecb67ded2df0 Mon Sep 17 00:00:00 2001 From: miettinen Date: Fri, 8 Feb 2013 10:23:27 +0000 Subject: [PATCH] Export model, module, and function library ask confirmation on overwriting an existing file (refs #4021). git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@26739 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../sysdyn/ui/handlers/exports/ExportFunctionLibrary.java | 2 ++ .../sysdyn/ui/handlers/exports/ExportModelHandler.java | 2 ++ .../sysdyn/ui/handlers/exports/ExportModuleHandler.java | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/exports/ExportFunctionLibrary.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/exports/ExportFunctionLibrary.java index 5fe78d59..7aafb7cf 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/exports/ExportFunctionLibrary.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/exports/ExportFunctionLibrary.java @@ -48,6 +48,7 @@ import org.simantics.utils.datastructures.Pair; * Exports a function library * * @author Teemu Lempinen + * @author Tuomas Miettinen * */ public class ExportFunctionLibrary extends AbstractHandler { @@ -91,6 +92,7 @@ public class ExportFunctionLibrary extends AbstractHandler { fd.setFilterPath(path); String[] filterExt = {"*.tg"}; fd.setFilterExtensions(filterExt); + fd.setOverwrite(true); final String selected = fd.open(); if(selected == null) return null; diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/exports/ExportModelHandler.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/exports/ExportModelHandler.java index e0040a69..c8c106b1 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/exports/ExportModelHandler.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/exports/ExportModelHandler.java @@ -43,6 +43,7 @@ import org.simantics.ui.utils.ResourceAdaptionUtils; * Exports a selected model * * @author Teemu Lempinen + * @author Tuomas Miettinen * */ public class ExportModelHandler extends AbstractHandler { @@ -87,6 +88,7 @@ public class ExportModelHandler extends AbstractHandler { fd.setFilterPath(path); String[] filterExt = {"*.tg"}; fd.setFilterExtensions(filterExt); + fd.setOverwrite(true); final String selected = fd.open(); if(selected == null) return null; diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/exports/ExportModuleHandler.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/exports/ExportModuleHandler.java index 84449b76..cecb5d8b 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/exports/ExportModuleHandler.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/exports/ExportModuleHandler.java @@ -56,6 +56,7 @@ import org.simantics.utils.datastructures.Pair; /** * Exports a selected module * @author Teemu Lempinen + * @author Tuomas Miettinen * */ public class ExportModuleHandler extends AbstractHandler { @@ -70,7 +71,7 @@ public class ExportModuleHandler extends AbstractHandler { class ContainsDependenciesException extends DatabaseException { private static final long serialVersionUID = -1533706136673146020L; - private Collection dependencies; + private final Collection dependencies; ContainsDependenciesException(Collection dependencies) { this.dependencies = dependencies; @@ -157,6 +158,7 @@ public class ExportModuleHandler extends AbstractHandler { fd.setFilterPath(path); String[] filterExt = {"*.tg"}; fd.setFilterExtensions(filterExt); + fd.setOverwrite(true); final String selected = fd.open(); if(selected == null) return null; -- 2.47.1