| author | Tomasz Zarna | 2013-01-25 11:09:15 (EST) |
|---|---|---|
| committer | Paul Webster | 2013-01-25 11:09:15 (EST) |
| commit | 674ea200ba288ab8158b212287dfa7cad3bb0da3 (patch) (side-by-side diff) | |
| tree | 66b2810ac212d274151b557251ecd6048ed795b8 | |
| parent | c9aa8b84b52f34fa3f80d4542196efb6c5cfe6d7 (diff) | |
| download | eclipse.platform.ui-674ea200ba288ab8158b212287dfa7cad3bb0da3.zip eclipse.platform.ui-674ea200ba288ab8158b212287dfa7cad3bb0da3.tar.gz eclipse.platform.ui-674ea200ba288ab8158b212287dfa7cad3bb0da3.tar.bz2 | |
Bug 394402 - [ErrorHandling] Display multiple line messages in Status inv20130125-160915
separate lines
Split them up.
| -rw-r--r-- | bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ErrorDialog.java | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ErrorDialog.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ErrorDialog.java index f2baf1c..5e125c0 100644 --- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ErrorDialog.java +++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ErrorDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -14,6 +14,16 @@ *******************************************************************************/ package org.eclipse.jface.dialogs; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.StringReader; +import java.util.ArrayList; +import java.util.Iterator; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.util.Policy; import org.eclipse.swt.SWT; import org.eclipse.swt.dnd.Clipboard; import org.eclipse.swt.dnd.TextTransfer; @@ -33,12 +43,6 @@ import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.MenuItem; import org.eclipse.swt.widgets.Shell; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; - -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.jface.util.Policy; - /** * A dialog to display one or more errors to the user, as contained in an * <code>IStatus</code> object. If an error contains additional detailed @@ -484,7 +488,11 @@ public class ErrorDialog extends IconAndMessageDialog { } String message = buildingStatus.getMessage(); sb.append(message); - listToPopulate.add(sb.toString()); + java.util.List lines = readLines(sb.toString()); + for (Iterator iterator = lines.iterator(); iterator.hasNext();) { + String line = (String) iterator.next(); + listToPopulate.add(line); + } incrementNesting = true; } @@ -526,6 +534,21 @@ public class ErrorDialog extends IconAndMessageDialog { } } + private static java.util.List readLines(final String s) { + java.util.List lines = new ArrayList(); + BufferedReader reader = new BufferedReader(new StringReader(s)); + String line; + try { + while ((line = reader.readLine()) != null) { + if (line.length() > 0) + lines.add(line); + } + } catch (IOException e) { + // shouldn't get this + } + return lines; + } + /** * This method checks if {@link #populateList(List, IStatus, int, boolean)} * will add anything to the list. |

