diff options
4 files changed, 40 insertions, 14 deletions
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/Activator.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/Activator.java index 548c8df9bc..27e9ccf105 100644 --- a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/Activator.java +++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/Activator.java @@ -60,6 +60,10 @@ public class Activator extends Plugin { null)); } + /** + * @deprecated see https://bugs.eclipse.org/bugs/show_bug.cgi?id=489111 + */ + @Deprecated public static void logErrorMessage(final String message) { log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, message, null)); } diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java index 796a849799..2992c17d17 100644 --- a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java +++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java @@ -222,7 +222,7 @@ public class DockerConnection ISecurePreferences node = root.node(key); try { if (passwd != null && !passwd.equals("")) //$NON-NLS-1$ - node.put("password", passwd, true /* encrypt */); + node.put("password", passwd, true /* encrypt */); //$NON-NLS-1$ } catch (StorageException e) { Activator.log(e); } @@ -630,16 +630,19 @@ public class DockerConnection } while (follow && !stop); listContainers(); } catch (com.spotify.docker.client.DockerRequestException e) { - Activator.logErrorMessage(e.message()); + Activator.logErrorMessage( + ProcessMessages.getString("Monitor_Logs_Exception"), e); //$NON-NLS-1$ throw new InterruptedException(); } catch (com.spotify.docker.client.DockerException | IOException e) { - Activator.logErrorMessage(e.getMessage()); + Activator.logErrorMessage( + ProcessMessages.getString("Monitor_Logs_Exception"), e); //$NON-NLS-1$ throw new InterruptedException(); } catch (InterruptedException e) { kill = true; Thread.currentThread().interrupt(); } catch (Exception e) { - Activator.logErrorMessage(e.getMessage()); + Activator.logErrorMessage( + ProcessMessages.getString("Monitor_Logs_Exception"), e); //$NON-NLS-1$ } finally { follow = false; copyClient.close(); // we are done with copyClient..dispose @@ -756,7 +759,7 @@ public class DockerConnection // ListContainersParam so we have // to do a kludge and put in control chars ourselves and pretend // we have a label with no value. - String separator = ""; + String separator = ""; //$NON-NLS-1$ StringBuffer labelString = new StringBuffer(); for (Entry<String, String> entry : labels.entrySet()) { labelString.append(separator); @@ -831,11 +834,15 @@ public class DockerConnection final ContainerInfo info = client.inspectContainer(id); return new DockerContainerInfo(info); } catch (com.spotify.docker.client.DockerRequestException e) { - Activator.logErrorMessage(e.message()); + Activator.logErrorMessage( + ProcessMessages.getString("Container_Info_Exception"), e); //$NON-NLS-1$ return null; } catch (com.spotify.docker.client.DockerException | InterruptedException e) { - Activator.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Failed to inspect container '" + id + "'", e)); + Activator.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, + ProcessMessages.getFormattedString( + "Container_Inspect_Exception", id), //$NON-NLS-1$ + e)); return null; } } @@ -849,12 +856,15 @@ public class DockerConnection final ImageInfo info = this.client.inspectImage(id); return new DockerImageInfo(info); } catch (com.spotify.docker.client.DockerRequestException e) { - Activator.logErrorMessage(e.message()); + Activator.logErrorMessage( + ProcessMessages.getString("Image_Info_Exception"), e); //$NON-NLS-1$ return null; } catch (com.spotify.docker.client.DockerException | InterruptedException e) { Activator.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, - "Failed to inspect container '" + id + "'", e)); + ProcessMessages.getFormattedString( + "Image_Inspect_Exception", id), //$NON-NLS-1$ + e)); return null; } } @@ -1032,7 +1042,8 @@ public class DockerConnection public boolean hasImage(final String repository, final String tag) { for (IDockerImage image : getImages()) { for (String repoTag : image.repoTags()) { - String tagExpr = (tag != null && !tag.isEmpty()) ? ':' + tag : ""; //$NON-NLS-1$ + String tagExpr = (tag != null && !tag.isEmpty()) ? ":" + tag //$NON-NLS-1$ + : ""; //$NON-NLS-1$ if (repoTag.equals(repository + tagExpr)) { return true; } @@ -1983,8 +1994,11 @@ public class DockerConnection InputStream tin = HttpHijackWorkaround.getInputStream(pty_stream); // org.eclipse.tm.terminal.connector.ssh.controls.SshWizardConfigurationPanel Map<String, Object> properties = new HashMap<>(); - properties.put(ITerminalsConnectorConstants.PROP_DELEGATE_ID, "org.eclipse.tm.terminal.connector.streams.launcher.streams"); - properties.put(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, "org.eclipse.tm.terminal.connector.streams.StreamsConnector"); + properties.put(ITerminalsConnectorConstants.PROP_DELEGATE_ID, + "org.eclipse.tm.terminal.connector.streams.launcher.streams"); //$NON-NLS-1$ + properties.put( + ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, + "org.eclipse.tm.terminal.connector.streams.StreamsConnector"); //$NON-NLS-1$ properties.put(ITerminalsConnectorConstants.PROP_TITLE, name); properties.put(ITerminalsConnectorConstants.PROP_LOCAL_ECHO, false); properties.put(ITerminalsConnectorConstants.PROP_FORCE_NEW, true); @@ -1998,7 +2012,7 @@ public class DockerConnection * LogStream overrides finalize() to close the stream being * used so we must preserve a reference to it. */ - properties.put("PREVENT_JVM_GC_FINALIZE", pty_stream); + properties.put("PREVENT_JVM_GC_FINALIZE", pty_stream); //$NON-NLS-1$ ITerminalService service = TerminalServiceFactory.getService(); service.openConsole(properties, null); } catch (Exception e) { diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/ProcessMessages.properties b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/ProcessMessages.properties index 2470031b3e..d18a804e01 100644 --- a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/ProcessMessages.properties +++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/ProcessMessages.properties @@ -12,3 +12,10 @@ Command_Not_Found=The ''{1}'' command could not be located in ''{0}'' Process_Error=Failed to execute command ''{0}'' (exit code={1}): {2} Process_Start_Exception=Failed to execute command ''{0}'': {1} Process_Monitor_Exception=Failed to monitor process +Monitor_Logs_Exception=Failed to monitor container logs +Settings_Detection_Exception=Failed to retrieve connection settings +Container_Info_Exception=Failed to retrieve container info +Image_Info_exception=Failed to retrieve image info +Container_Inspect_Exception=Failed to inspect container: ''{0}'' +Image_Inspect_Exception=Failed to inspect image: ''{0}'' + diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/ShellConnectionSettingsProvider.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/ShellConnectionSettingsProvider.java index 04e1dee3c6..74be44598b 100644 --- a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/ShellConnectionSettingsProvider.java +++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/ShellConnectionSettingsProvider.java @@ -120,7 +120,8 @@ public class ShellConnectionSettingsProvider implements IDockerConnectionSetting } script.setExecutable(true); } catch (IOException e) { - Activator.logErrorMessage(e.getMessage()); + Activator.logErrorMessage(ProcessMessages + .getString("Settings_Detection_Exception"), e); //$NON-NLS-1$ } } return script; |