]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.document.ui/src/org/simantics/document/ui/graphfile/ExternalEditorAdapter.java
Externalize strings in org.simantics.document.ui
[simantics/platform.git] / bundles / org.simantics.document.ui / src / org / simantics / document / ui / graphfile / ExternalEditorAdapter.java
index 42190d87829283cf165d4ede9a49422abf645fae..07ed6432771cced743a3a1ac5e17f3c7478c913c 100644 (file)
@@ -47,7 +47,7 @@ public class ExternalEditorAdapter extends AbstractResourceEditorAdapter impleme
     private static ExternalFileWatcher fileWatcher;
 
        public ExternalEditorAdapter() {
-               super("External Editor", Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/page.png"));
+               super(Messages.ExternalEditorAdapter_ExternalEditor, Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/page.png")); //$NON-NLS-2$ //$NON-NLS-3$
        }
 
        @Override
@@ -78,7 +78,7 @@ public class ExternalEditorAdapter extends AbstractResourceEditorAdapter impleme
                     StringBuilder sb = new StringBuilder();
                     String uri = graph.getPossibleURI(input);
                     if (uri != null) {
-                        sb.append(generateSHA1(uri)).append("_");
+                        sb.append(generateSHA1(uri)).append("_"); //$NON-NLS-1$
                     }
                     sb.append(graph.getRelatedValue(input, Layer0.getInstance(graph).HasName).toString());
                     Path filePath = Activator.getInstanceLocation().resolve(sb.toString());
@@ -86,11 +86,11 @@ public class ExternalEditorAdapter extends AbstractResourceEditorAdapter impleme
                         try {
                             GraphFileUtil.writeDataToFile(graph, input, filePath.toFile());
                         } catch (IOException | DatabaseException e) {
-                            LOGGER.error("Could not write data to file ", e);
+                            LOGGER.error("Could not write data to file ", e); //$NON-NLS-1$
                         }
                         return input;
                     });
-                    LOGGER.info("Adding tempFile {} with resource {}", filePath, input);
+                    LOGGER.info("Adding tempFile {} with resource {}", filePath, input); //$NON-NLS-1$
                     return filePath;
                 }
             });
@@ -103,20 +103,20 @@ public class ExternalEditorAdapter extends AbstractResourceEditorAdapter impleme
     }
 
     public static String generateSHA1(String message) {
-        return hashString(message, "SHA-1");
+        return hashString(message, "SHA-1"); //$NON-NLS-1$
     }
 
     private static String hashString(String message, String algorithm) {
         try {
             MessageDigest digest = MessageDigest.getInstance(algorithm);
-            byte[] hashedBytes = digest.digest(message.getBytes("UTF-8"));
+            byte[] hashedBytes = digest.digest(message.getBytes("UTF-8")); //$NON-NLS-1$
      
             return convertByteArrayToHexString(hashedBytes);
         } catch (NoSuchAlgorithmException | UnsupportedEncodingException ex) {
             // Should not happen
-            LOGGER.error("Could not generate hash", ex);
+            LOGGER.error("Could not generate hash", ex); //$NON-NLS-1$
         }
-        return "";
+        return ""; //$NON-NLS-1$
     }
 
     private static String convertByteArrayToHexString(byte[] arrayBytes) {
@@ -171,15 +171,15 @@ public class ExternalEditorAdapter extends AbstractResourceEditorAdapter impleme
                             Path parent = keys.get(key);
                             Path newPath = parent.resolve(pathEvent.context());
                             if (ENTRY_MODIFY == kind) {
-                                LOGGER.info("New path modified: " + newPath);
+                                LOGGER.info("New path modified: " + newPath); //$NON-NLS-1$
                                 Resource resource = tempFiles.get(newPath);
                                 if (resource != null) {
                                     GraphFileUtil.writeDataToGraph(newPath.toFile(), resource);
                                 } else {
-                                    LOGGER.warn("No resource found for {}", newPath.toAbsolutePath());
+                                    LOGGER.warn("No resource found for {}", newPath.toAbsolutePath()); //$NON-NLS-1$
                                 }
                             } else if (ENTRY_DELETE == kind) {
-                                System.out.println("New path deleted: " + newPath);
+                                System.out.println("New path deleted: " + newPath); //$NON-NLS-1$
                             }
                         }
                         if (!key.reset()) {
@@ -188,9 +188,9 @@ public class ExternalEditorAdapter extends AbstractResourceEditorAdapter impleme
                         }
                     } catch (InterruptedException e) {
                         if (!stopped.get())
-                            LOGGER.error("Could not stop", e);
+                            LOGGER.error("Could not stop", e); //$NON-NLS-1$
                     } catch (Throwable t) {
-                        LOGGER.error("An error occured", t);
+                        LOGGER.error("An error occured", t); //$NON-NLS-1$
                     }
                 }
             });
@@ -202,7 +202,7 @@ public class ExternalEditorAdapter extends AbstractResourceEditorAdapter impleme
         
         private void register(Path path) throws IOException {
             if (Files.isDirectory(path)) {
-                LOGGER.info("Registering path {}", path);
+                LOGGER.info("Registering path {}", path); //$NON-NLS-1$
                 WatchKey key = path.toAbsolutePath().register(ws, ENTRY_DELETE, ENTRY_MODIFY);
                 keys.put(key, path);
             }