Merge "+ Support for debug console in run mode."
diff --git a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/DebugConsoleManager.java b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/DebugConsoleManager.java
index 5661854..24343c9 100644
--- a/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/DebugConsoleManager.java
+++ b/core/plugins/org.eclipse.dltk.debug.ui/src/org/eclipse/dltk/debug/ui/DebugConsoleManager.java
@@ -31,6 +31,7 @@
 import org.eclipse.dltk.compiler.util.Util;
 import org.eclipse.dltk.debug.core.DLTKDebugLaunchConstants;
 import org.eclipse.dltk.debug.core.model.IScriptDebugTarget;
+import org.eclipse.dltk.launching.ScriptLaunchConfigurationConstants;
 import org.eclipse.dltk.launching.process.IScriptProcess;
 import org.eclipse.osgi.util.NLS;
 import org.eclipse.ui.console.ConsolePlugin;
@@ -58,8 +59,16 @@
 		if (launch == null) {
 			return false;
 		}
-		if (!ILaunchManager.DEBUG_MODE.equals(launch.getLaunchMode())) {
-			return false;
+		if (!Boolean
+				.parseBoolean(launch
+						.getAttribute(ScriptLaunchConfigurationConstants.ATTR_USE_CONSOLE_IN_RUN_MODE))) {
+			if (!Boolean
+					.parseBoolean(launch
+							.getAttribute(ScriptLaunchConfigurationConstants.ATTR_USE_CONSOLE_IN_RUN_MODE))
+					&& !ILaunchManager.DEBUG_MODE
+							.equals(launch.getLaunchMode())) {
+				return false;
+			}
 		}
 		return launch.getProcesses().length != 0
 				&& DLTKDebugLaunchConstants.isDebugConsole(launch)
@@ -75,8 +84,7 @@
 		final IProcess[] processes = launch.getProcesses();
 		final IProcess process = processes.length != 0 ? processes[0] : null;
 		final IConsoleColorProvider colorProvider = getColorProvider(process != null ? process
-				.getAttribute(IProcess.ATTR_PROCESS_TYPE)
-				: null);
+				.getAttribute(IProcess.ATTR_PROCESS_TYPE) : null);
 		final ScriptDebugConsole console = new ScriptDebugConsole(launch,
 				computeName(launch), null, encoding, colorProvider);
 		if (process != null) {
@@ -102,8 +110,8 @@
 				.getLaunchConfiguration();
 		if (configuration != null) {
 			try {
-				return DebugPlugin.getDefault().getLaunchManager().getEncoding(
-						configuration);
+				return DebugPlugin.getDefault().getLaunchManager()
+						.getEncoding(configuration);
 			} catch (CoreException e) {
 				DLTKDebugUIPlugin.log(e);
 			}
@@ -293,8 +301,7 @@
 				}
 				DLTKDebugUIPlugin
 						.logErrorMessage(MessageFormat
-								.format(
-										"Extension {0} must specify an instanceof IConsoleColorProvider for class attribute.", //$NON-NLS-1$
+								.format("Extension {0} must specify an instanceof IConsoleColorProvider for class attribute.", //$NON-NLS-1$
 										new String[] { extension
 												.getDeclaringExtension()
 												.getUniqueIdentifier() }));
diff --git a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/ScriptLaunchConfigurationConstants.java b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/ScriptLaunchConfigurationConstants.java
index ec8c9cf..f6f5d40 100644
--- a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/ScriptLaunchConfigurationConstants.java
+++ b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/ScriptLaunchConfigurationConstants.java
@@ -23,6 +23,7 @@
 
 	// Attributes
 	public static final String ATTR_USE_INTERACTIVE_CONSOLE = "use_dltk_interactive_console"; //$NON-NLS-1$
+	public static final String ATTR_USE_CONSOLE_IN_RUN_MODE = "use_dltk_console"; //$NON-NLS-1$
 
 	public static final String ATTR_DLTK_CONSOLE_ID = "console_id"; //$NON-NLS-1$