X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.debug.ui%2Fsrc%2Forg%2Fsimantics%2Fdebug%2Fui%2FSessionDebuggerView.java;h=1426afa6dc08af020fbabbf9cf619c4987265b7c;hp=0e0363fa87ec842b59a65d9119db15cc2a4a4135;hb=59724aa55a75a4efc3ec17e3b4a4ef62f463526e;hpb=1fe7ef332a6f996a13b4dda38bc85a743a154baa diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/SessionDebuggerView.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/SessionDebuggerView.java index 0e0363fa8..1426afa6d 100644 --- a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/SessionDebuggerView.java +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/SessionDebuggerView.java @@ -22,6 +22,7 @@ import java.util.Set; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; +import org.eclipse.osgi.util.NLS; import org.eclipse.swt.SWT; import org.eclipse.swt.browser.Browser; import org.eclipse.swt.custom.CTabFolder; @@ -51,7 +52,7 @@ import org.simantics.views.swt.SimanticsView; @SuppressWarnings("deprecation") public class SessionDebuggerView extends SimanticsView { - public static final String VIEW_ID = "org.simantics.debug.sessionDebugger"; + public static final String VIEW_ID = "org.simantics.debug.sessionDebugger"; //$NON-NLS-1$ private CTabFolder folder; private Text commandLine; @@ -63,7 +64,7 @@ public class SessionDebuggerView extends SimanticsView { @Override protected Set getBrowseContexts() { - return Collections.singleton(""); + return Collections.singleton(""); //$NON-NLS-1$ } private CTabItem createItem(int index, CTabFolder folder, Control control) { @@ -101,14 +102,14 @@ public class SessionDebuggerView extends SimanticsView { if (historyPosition < 0) { return; } else if (historyPosition == 0) { - commandLine.setText(""); + commandLine.setText(""); //$NON-NLS-1$ historyPosition = -1; } else { commandLine.setText(history.get(--historyPosition)); } } else if (e.keyCode == SWT.ESC) { historyPosition = -1; - commandLine.setText(""); + commandLine.setText(""); //$NON-NLS-1$ } else if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) { applyCommand(commandLine.getText()); } @@ -116,7 +117,7 @@ public class SessionDebuggerView extends SimanticsView { }); CTabItem shellItem = createItem(0, folder, shell); - shellItem.setText("Shell"); + shellItem.setText(Messages.SessionDebuggerView_Shell); // SessionDebugger deprecated = new SessionDebugger(folder, SWT.NONE, Simantics.getSession()); // deprecated.initializeUI(); @@ -140,7 +141,7 @@ public class SessionDebuggerView extends SimanticsView { } catch (DatabaseException e) { Activator.getDefault().getLog().log( new Status(IStatus.ERROR, Activator.PLUGIN_ID, - "Unexpected exception while applying command " + command, e)); + Messages.SessionDebuggerView_ActivatorUnexpectedException + command, e)); } } @@ -152,16 +153,16 @@ public class SessionDebuggerView extends SimanticsView { Path p = (Path) output; long size = Files.size(p); if (size < (1L << 16)) { - terminal.addFirst(new String(Files.readAllBytes(p), "UTF-8")); + terminal.addFirst(new String(Files.readAllBytes(p), "UTF-8")); //$NON-NLS-1$ } - terminal.addFirst("Wrote command '" + command + "' output to file " + p); + terminal.addFirst(NLS.bind(Messages.SessionDebuggerView_WroteCommand ,new Object[] { command , p})); } catch (IOException e) { Activator.getDefault().getLog().log( new Status(IStatus.ERROR, Activator.PLUGIN_ID, - "Unexpected I/O exception while applying command " + command, e)); + NLS.bind(Messages.SessionDebuggerView_ActivatorUnexpectedIOException , new Object[]{ command, e}))); } } else { - throw new IllegalArgumentException("Unsupported output argument type " + output); + throw new IllegalArgumentException("Unsupported output argument type " + output); //$NON-NLS-1$ } if (terminal.size() > 10) terminal.removeLast(); @@ -176,7 +177,7 @@ public class SessionDebuggerView extends SimanticsView { private void apply(String command, Object data) { if (data instanceof String) { SWTUtils.asyncExec(commandLine, () -> { - commandLine.setText(""); + commandLine.setText(""); //$NON-NLS-1$ addHistory(command, data); console.setText(formatTerminal()); }); @@ -184,33 +185,33 @@ public class SessionDebuggerView extends SimanticsView { SWTUtils.asyncExec(commandLine, () -> { try { addHistory(command, dumpListenerReport((ListenerReport) data)); - commandLine.setText(""); + commandLine.setText(""); //$NON-NLS-1$ console.setText(formatTerminal()); } catch (IOException e) { Activator.getDefault().getLog().log( new Status(IStatus.ERROR, Activator.PLUGIN_ID, - "Unexpected I/O exception while applying command " + command, e)); + Messages.SessionDebuggerView_ActivatorUnexpectedIOException + command, e)); } }); } } private Path dumpListenerReport(ListenerReport data) throws IOException { - File f = Simantics.getTempfile("debug", "listenerReport"); - try (PrintStream out = new PrintStream(f, "UTF-8")) { - out.print("
");
+        File f = Simantics.getTempfile("debug", "listenerReport"); //$NON-NLS-1$ //$NON-NLS-2$
+        try (PrintStream out = new PrintStream(f, "UTF-8")) { //$NON-NLS-1$
+            out.print("
"); //$NON-NLS-1$
             data.print(out);
-            out.print("
"); + out.print("
"); //$NON-NLS-1$ } return f.toPath(); } private String formatTerminal() { StringBuilder b = new StringBuilder(); - b.append("\n"); + b.append("\n"); //$NON-NLS-1$ for (String s : terminal) - b.append(s).append("
\n"); - b.append(""); + b.append(s).append("
\n"); //$NON-NLS-1$ + b.append(""); //$NON-NLS-1$ return b.toString(); }