diff options
author | nhauge | 2010-04-07 22:02:03 +0000 |
---|---|---|
committer | nhauge | 2010-04-07 22:02:03 +0000 |
commit | 50e3806989449cc1a8b0996ec73ee9008620e081 (patch) | |
tree | 5b7dcfdecd5d32f0ed62e342ce453549f1ef9c5d /jpa/plugins | |
parent | e13fdb518ce596ab7a447a68d32296fdb7ebb432 (diff) | |
download | webtools.dali-50e3806989449cc1a8b0996ec73ee9008620e081.tar.gz webtools.dali-50e3806989449cc1a8b0996ec73ee9008620e081.tar.xz webtools.dali-50e3806989449cc1a8b0996ec73ee9008620e081.zip |
304295 - Externalized a few seemingly public facing error messages.
Diffstat (limited to 'jpa/plugins')
3 files changed, 15 insertions, 8 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.gen/property_files/jpt_gen.properties b/jpa/plugins/org.eclipse.jpt.gen/property_files/jpt_gen.properties index 6d3dd30af3..db907a2472 100644 --- a/jpa/plugins/org.eclipse.jpt.gen/property_files/jpt_gen.properties +++ b/jpa/plugins/org.eclipse.jpt.gen/property_files/jpt_gen.properties @@ -13,4 +13,8 @@ GenScope_taskName=Build Database Model EntityGenerator_taskName=Generate Entity: {0} Error_Generating_Entities = Error Generating Entities +Delete_Folder_Error = "The directory {0} could not be deleted." +Delete_File_Error = "The file {0} could not be deleted." +File_Read_Only_Error= "The file {0} could not be modified because write access is denied.\nPlease make sure that the file is not marked as readonly in the file system." + Templates_notFound = Unable to find JPA entities generation templates in plugin
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/JptGenMessages.java b/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/JptGenMessages.java index 382ce61512..d505f8d6c1 100644 --- a/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/JptGenMessages.java +++ b/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/JptGenMessages.java @@ -14,13 +14,16 @@ import org.eclipse.osgi.util.NLS; /** * Localized messages used by Dali entity generation. */ -class JptGenMessages { +public class JptGenMessages { public static String PackageGenerator_taskName; public static String GenScope_taskName; public static String EntityGenerator_taskName; public static String Templates_notFound; public static String Error_Generating_Entities; + public static String Delete_Folder_Error; + public static String Delete_File_Error; + public static String File_Read_Only_Error; private static final String BUNDLE_NAME = "jpt_gen"; //$NON-NLS-1$ private static final Class<?> BUNDLE_CLASS = JptGenMessages.class; diff --git a/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/util/FileUtil.java b/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/util/FileUtil.java index 117ca85d7b..890b846166 100644 --- a/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/util/FileUtil.java +++ b/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/util/FileUtil.java @@ -26,7 +26,11 @@ import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Platform; + +import org.eclipse.jpt.gen.internal.JptGenMessages; + import org.eclipse.osgi.service.datalocation.Location; +import org.eclipse.osgi.util.NLS; import org.osgi.framework.Bundle; /** @@ -36,10 +40,6 @@ import org.osgi.framework.Bundle; public class FileUtil { - private static String DELETE_FOLDER_ERR = "The directory %s could not be deleted."; - private static String DELETE_FILE_ERR = "The file %s could not be deleted."; - private static String FILE_READONLY_ERR = "The file %s could not be modified because write access is denied.\nPlease make sure that the file is not marked as readonly in the file system."; - public static void deleteFolder(File folder) throws IOException { @@ -61,8 +61,8 @@ public class FileUtil throws IOException { if (!f.delete()) { - String msgId = f.isDirectory() ? DELETE_FOLDER_ERR : DELETE_FILE_ERR; - throw new IOException( String.format(msgId,f.getPath())); + String msgId = f.isDirectory() ? JptGenMessages.Delete_Folder_Error : JptGenMessages.Delete_File_Error; + throw new IOException( NLS.bind(msgId,f.getPath())); } } @@ -88,7 +88,7 @@ public class FileUtil throws IOException { if (dest.exists() && !dest.canWrite()) - throw new IOException( FILE_READONLY_ERR ); //throw with a clear error because otherwise FileOutputStream throws FileNotFoundException! + throw new IOException( NLS.bind(JptGenMessages.File_Read_Only_Error, dest.getPath())); //throw with a clear error because otherwise FileOutputStream throws FileNotFoundException! java.io.FileOutputStream fout = new java.io.FileOutputStream(dest.getPath(), false/*append*/); try { fout.write(bytes); |