Bug 376296 - [console] Add option to refresh command to refresh all installed bundles. This commit adds a -all option to the refresh command. If -all is present, then all installed bundles will be refreshed.
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 2bd5751..e0a9d5a 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
@@ -134,7 +134,8 @@
 	public static final String CONSOLE_HELP_GC_COMMAND_DESCRIPTION = "perform a garbage collection";
 	public static final String CONSOLE_HELP_INIT_COMMAND_DESCRIPTION = "uninstall all bundles";
 	public static final String CONSOLE_HELP_CLOSE_COMMAND_DESCRIPTION = "shutdown and exit";
-	public static final String CONSOLE_HELP_REFRESH_COMMAND_DESCRIPTION = "refresh the packages of the specified bundles";
+	public static final String CONSOLE_HELP_REFRESH_COMMAND_DESCRIPTION = "refresh the packages of the specified bundles; if -all option is specified refresh packages of all installed bundles";
+	public static final String CONSOLE_HELP_REFRESH_ALL_OPTION_DESCRIPTION = "specify to refresh the packages of all installed bundles";
 	public static final String CONSOLE_HELP_REFRESH_COMMAND_ARGUMENT_DESCRIPTION = "list of bundles whose packages to be refreshed; if not present refreshes all bundles";
 	public static final String CONSOLE_HELP_EXEC_COMMAND_DESCRIPTION = "execute a command in a separate process and wait";
 	public static final String CONSOLE_HELP_EXEC_COMMAND_ARGUMENT_DESCRIPTION = "command to be executed";
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 a01091b..717d894 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
@@ -1179,8 +1179,12 @@
 	 *  @param bundles bundle(s) to be refreshed
 	 */
 	@Descriptor(ConsoleMsg.CONSOLE_HELP_REFRESH_COMMAND_DESCRIPTION)
-	public void r(@Descriptor(ConsoleMsg.CONSOLE_HELP_REFRESH_COMMAND_ARGUMENT_DESCRIPTION) Bundle... bundles) throws Exception {
-		refresh(bundles);
+	public void r(
+			@Descriptor(ConsoleMsg.CONSOLE_HELP_REFRESH_ALL_OPTION_DESCRIPTION)
+			@Parameter(absentValue = "false", presentValue = "true", names = { "-all" })
+			boolean shouldRefreshAll,
+			@Descriptor(ConsoleMsg.CONSOLE_HELP_REFRESH_COMMAND_ARGUMENT_DESCRIPTION) Bundle... bundles) throws Exception {
+		refresh(shouldRefreshAll, bundles);
 	}
 
 	/**
@@ -1190,11 +1194,17 @@
 	 */
 	@SuppressWarnings("deprecation")
 	@Descriptor(ConsoleMsg.CONSOLE_HELP_REFRESH_COMMAND_DESCRIPTION)
-	public void refresh(@Descriptor(ConsoleMsg.CONSOLE_HELP_REFRESH_COMMAND_ARGUMENT_DESCRIPTION) Bundle... bundles) throws Exception {
+	public void refresh(
+			@Descriptor(ConsoleMsg.CONSOLE_HELP_REFRESH_ALL_OPTION_DESCRIPTION)
+			@Parameter(absentValue = "false", presentValue = "true", names = { "-all" })
+			boolean shouldRefreshAll,
+			@Descriptor(ConsoleMsg.CONSOLE_HELP_REFRESH_COMMAND_ARGUMENT_DESCRIPTION) Bundle... bundles) throws Exception {
 		PackageAdmin packageAdmin = activator.getPackageAdmin();
 		if (packageAdmin != null) {
 			if(bundles != null && bundles.length > 0) {
 				packageAdmin.refreshPackages(bundles);
+			} else if (shouldRefreshAll == true) {
+				packageAdmin.refreshPackages(context.getBundles());
 			} else {
 				packageAdmin.refreshPackages(null);
 			}