Merge branch 'master' of ssh://git.eclipse.org/gitroot/equinox/rt.equinox.bundles
diff --git a/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/ConsoleMessages.properties b/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/ConsoleMessages.properties
index 64bc484..ad516ea 100755
--- a/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/ConsoleMessages.properties
+++ b/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/ConsoleMessages.properties
@@ -1,5 +1,5 @@
 ###############################################################################
-# Copyright (c) 2003, 2011 IBM Corporation and others.
+# Copyright (c) 2003, 2012 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
@@ -97,3 +97,6 @@
 CONSOLE_DISABLED_COUNT_MESSAGE={0} disabled bundle(s) in the system
 CONSOLE_DISABLED_BUNDLE_HEADER=Bundle   :\t{0} (id={1})
 CONSOLE_DISABLED_BUNDLE_REASON=Reason(s):\t{0} (policy={1})
+CONSOLE_STOP_MESSAGE=Really want to stop Equinox? (y/n; default=y)  
+CONSOLE_STOP_CONFIRMATION_YES=y
+CONSOLE_STOP_ERROR_READ_CONFIRMATION=Error while reading confirmation 
diff --git a/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/ConsoleMsg.java b/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/ConsoleMsg.java
index e0a9d5a..eee8340 100755
--- a/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/ConsoleMsg.java
+++ b/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/ConsoleMsg.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2004, 20011 IBM Corporation and others.
+ * Copyright (c) 2004, 2012 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
@@ -96,6 +96,9 @@
 	public static String CONSOLE_DISABLED_COUNT_MESSAGE;
 	public static String CONSOLE_DISABLED_BUNDLE_HEADER;
 	public static String CONSOLE_DISABLED_BUNDLE_REASON;
+	public static String CONSOLE_STOP_MESSAGE;
+	public static String CONSOLE_STOP_CONFIRMATION_YES;
+	public static String CONSOLE_STOP_ERROR_READ_CONFIRMATION;
 
 	public static String STARTLEVEL_FRAMEWORK_ACTIVE_STARTLEVEL;
 	public static String STARTLEVEL_BUNDLE_STARTLEVEL;
diff --git a/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/EquinoxCommandProvider.java b/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/EquinoxCommandProvider.java
index 66fd7a6..9e7008e 100755
--- a/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/EquinoxCommandProvider.java
+++ b/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/EquinoxCommandProvider.java
@@ -12,7 +12,11 @@
 
 package org.eclipse.equinox.console.commands;
 
+import java.io.BufferedReader;
+import java.io.Closeable;
 import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.net.URL;
@@ -185,8 +189,10 @@
 	 */
 	@Descriptor(ConsoleMsg.CONSOLE_HELP_EXIT_COMMAND_DESCRIPTION)
 	public void exit() throws Exception {
-		System.out.println();
-		System.exit(0);
+		if (confirmStop()) {
+			System.out.println();
+			System.exit(0);
+		}
 	}
 
 	/**
@@ -1169,8 +1175,10 @@
 	 */
 	@Descriptor(ConsoleMsg.CONSOLE_HELP_CLOSE_COMMAND_DESCRIPTION)
 	public void close() throws Exception {
-		context.getBundle(0).stop();
-		System.exit(0);
+		if (confirmStop()) {
+			context.getBundle(0).stop();
+			System.exit(0);
+		}
 	}
 
 	/**
@@ -2026,5 +2034,26 @@
 		}
 
 	}
+	
+	private boolean confirmStop() {
+		System.out.print(ConsoleMsg.CONSOLE_STOP_MESSAGE);
+		System.out.flush();
+		
+		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
+		String reply = null;
+		try {
+			reply = reader.readLine();
+		} catch (IOException e) {
+			System.out.println(ConsoleMsg.CONSOLE_STOP_ERROR_READ_CONFIRMATION);
+		}
+		
+		if (reply != null) {
+			if (reply.toLowerCase().startsWith(ConsoleMsg.CONSOLE_STOP_CONFIRMATION_YES) || reply.length() == 0) {
+				return true;
+			}
+		}
+		
+		return false;
+	}
 }