Skip to content

Commit 9f90486

Browse files
committed
Improve display of multi-line single String launch validation errors
mainly on Windows. Follow-up on - #2055
1 parent e0822fe commit 9f90486

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/JUnitLaunchValidationOperation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private void checkJunitVersion(ILaunchConfiguration configuration, Set<IPluginMo
7575
}
7676

7777
private void addError(String message) {
78-
fErrors.put(message.replaceAll("\\R", " "), null); //$NON-NLS-1$//$NON-NLS-2$
78+
fErrors.put(message, null);
7979
}
8080

8181
@Override

ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/PluginStatusDialog.java

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package org.eclipse.pde.internal.ui.launcher;
1717

1818
import java.util.Map;
19+
import java.util.Map.Entry;
1920

2021
import org.eclipse.core.runtime.MultiStatus;
2122
import org.eclipse.debug.core.ILaunchConfiguration;
@@ -44,6 +45,7 @@
4445
import org.eclipse.swt.widgets.Label;
4546
import org.eclipse.swt.widgets.Link;
4647
import org.eclipse.swt.widgets.Shell;
48+
import org.eclipse.swt.widgets.Text;
4749
import org.eclipse.ui.PlatformUI;
4850

4951
/**
@@ -185,14 +187,23 @@ protected Control createDialogArea(Composite parent) {
185187

186188
Label label = new Label(container, SWT.NONE);
187189
label.setText(PDEUIMessages.PluginStatusDialog_label);
188-
189-
treeViewer = new TreeViewer(container);
190-
treeViewer.setContentProvider(new ContentProvider());
191-
treeViewer.setLabelProvider(PDEPlugin.getDefault().getLabelProvider());
192-
treeViewer.setComparator(new ViewerComparator());
193-
treeViewer.setInput(fInput);
194-
treeViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
195-
190+
GridData gridData = new GridData(GridData.FILL_BOTH);
191+
192+
Entry<?, ?> onlyEntry = fInput.size() == 1 ? fInput.entrySet().iterator().next() : null;
193+
if (onlyEntry != null && onlyEntry.getKey() instanceof String errorMessage && errorMessage.contains("\n") //$NON-NLS-1$
194+
&& onlyEntry.getValue() == null) {
195+
Text message = new Text(container, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
196+
message.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
197+
message.setText(errorMessage);
198+
message.setLayoutData(gridData);
199+
} else {
200+
treeViewer = new TreeViewer(container);
201+
treeViewer.setContentProvider(new ContentProvider());
202+
treeViewer.setLabelProvider(PDEPlugin.getDefault().getLabelProvider());
203+
treeViewer.setComparator(new ViewerComparator());
204+
treeViewer.setInput(fInput);
205+
treeViewer.getControl().setLayoutData(gridData);
206+
}
196207
getShell().setText(PDEUIMessages.PluginStatusDialog_pluginValidation);
197208
Dialog.applyDialogFont(container);
198209
return container;

0 commit comments

Comments
 (0)