bug 418088: Make error label in VexEditor selectable and show exception. 

Change-Id: I7d20829af65d5c35059475a8e3e22cabd0d1beb1
Signed-off-by: Carsten Hiesserich <carsten.hie@gmail.com>
diff --git a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/editor/VexEditor.java b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/editor/VexEditor.java
index 865f681..a23e8c0 100644
--- a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/editor/VexEditor.java
+++ b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/editor/VexEditor.java
@@ -47,7 +47,7 @@
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
 import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IEditorSite;
@@ -543,18 +543,56 @@
 		vexEditorListeners.fireEvent("styleChanged", new VexEditorEvent(this)); //$NON-NLS-1$
 	}
 
-	private void showLabel(final String message) {
+	/**
+	 * Dispose the VexWidget and display a message instead.
+	 * 
+	 * @param message
+	 *            The message to display.
+	 * @param ex
+	 *            The Exception to display
+	 */
+	private void showLabel(final String message, final Exception ex) {
 		if (loadingLabel == null) {
 			if (vexWidget != null) {
 				vexWidget.dispose();
 				vexWidget = null;
 			}
-			loadingLabel = new Label(parentControl, SWT.WRAP);
+			final GridLayout layout = new GridLayout();
+			layout.numColumns = 1;
+			layout.verticalSpacing = 0;
+			layout.marginHeight = 0;
+			layout.marginWidth = 0;
+			parentControl.setLayout(layout);
+
+			loadingLabel = new Text(parentControl, SWT.WRAP | SWT.V_SCROLL);
+			loadingLabel.setEditable(false);
+			final GridData gd = new GridData();
+			gd.grabExcessHorizontalSpace = true;
+			gd.grabExcessVerticalSpace = true;
+			gd.horizontalAlignment = GridData.FILL;
+			gd.verticalAlignment = GridData.FILL;
+			loadingLabel.setLayoutData(gd);
 		}
-		loadingLabel.setText(message);
+		final StringWriter sw = new StringWriter();
+		sw.append(message);
+		if (ex != null) {
+			sw.append("\n\n");
+			ex.printStackTrace(new PrintWriter(sw));
+		}
+		loadingLabel.setText(sw.toString());
 		parentControl.layout(true);
 	}
 
+	/**
+	 * Dispose the VexWidget and display a message instead.
+	 * 
+	 * @param message
+	 *            The message to display.
+	 */
+	private void showLabel(final String message) {
+		showLabel(message, null);
+	}
+
 	private void showVexWidget() {
 
 		if (vexWidget != null) {