Fixed bug 346271: [working sets] Hide/Remove dialog should not mention the remove case for 'Other Projects' working set
diff --git a/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/DeleteAction.java b/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/DeleteAction.java
index a016f37..8743e30 100644
--- a/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/DeleteAction.java
+++ b/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/DeleteAction.java
@@ -110,26 +110,32 @@
 		if (selection.size() == 1) {
 			IWorkingSet workingSet= (IWorkingSet)selection.getFirstElement();
 			final String workingSetID= workingSet.getId();
-				dialog= new MessageDialog(getShell(), ReorgMessages.DeleteWorkingSet_single, null, MessageFormat.format(ReorgMessages.DeleteWorkingSet_removeorhideworkingset_single,
-						new Object[] { workingSet.getLabel() }), MessageDialog.QUESTION, new String[] { ReorgMessages.DeleteWorkingSet_Hide, ReorgMessages.DeleteWorkingSet_Remove,
-						IDialogConstants.CANCEL_LABEL }, 0) {
-					/*
-					 * @see org.eclipse.jface.dialogs.MessageDialog#createButton(org.eclipse.swt.widgets.Composite, int, java.lang.String, boolean)
-					 * @since 3.5
-					 */
-					@Override
-					protected Button createButton(Composite parent, int id, String label, boolean defaultButton) {
-						Button button= super.createButton(parent, id, label, defaultButton);
+			String dialogMessage;
+			if (isDefaultWorkingSet(workingSetID))
+				dialogMessage= MessageFormat.format(ReorgMessages.DeleteWorkingSet_hideworkingset_single, new Object[] { workingSet.getLabel() });
+			else
+				dialogMessage= MessageFormat.format(ReorgMessages.DeleteWorkingSet_removeorhideworkingset_single, new Object[] { workingSet.getLabel() });
+			
+			dialog= new MessageDialog(getShell(), ReorgMessages.DeleteWorkingSet_single, null, dialogMessage, MessageDialog.QUESTION, new String[] { ReorgMessages.DeleteWorkingSet_Hide,
+					ReorgMessages.DeleteWorkingSet_Remove,
+					IDialogConstants.CANCEL_LABEL }, 0) {
+				/*
+				 * @see org.eclipse.jface.dialogs.MessageDialog#createButton(org.eclipse.swt.widgets.Composite, int, java.lang.String, boolean)
+				 * @since 3.5
+				 */
+				@Override
+				protected Button createButton(Composite parent, int id, String label, boolean defaultButton) {
+					Button button= super.createButton(parent, id, label, defaultButton);
 					if (id == REMOVE_BUTTON && IWorkingSetIDs.OTHERS.equals(workingSetID))
-							button.setEnabled(false);
-						return button;
-					}
-				};
+						button.setEnabled(false);
+					return button;
+				}
+			};
 		} else {
 			dialog= new MessageDialog(getShell(), ReorgMessages.DeleteWorkingSet_multiple, null, MessageFormat.format(ReorgMessages.DeleteWorkingSet_removeorhideworkingset_multiple,
 					new Object[] { new Integer(selection.size()) }),
 					MessageDialog.QUESTION, new String[] { ReorgMessages.DeleteWorkingSet_Hide, ReorgMessages.DeleteWorkingSet_Remove,
-					IDialogConstants.CANCEL_LABEL }, 0);
+							IDialogConstants.CANCEL_LABEL }, 0);
 		}
 
 		int dialogResponse= dialog.open();
@@ -137,25 +143,50 @@
 			Iterator<?> iter= selection.iterator();
 			IWorkingSetManager manager= PlatformUI.getWorkbench().getWorkingSetManager();
 			while (iter.hasNext()) {
-				IWorkingSet workingSet= (IWorkingSet)iter.next();
-				if (!(IWorkingSetIDs.OTHERS.equals(workingSet.getId())))
+				IWorkingSet workingSet= (IWorkingSet) iter.next();
+				if (isDefaultWorkingSet(workingSet.getId())) {
+					ArrayList< IWorkingSet> list= new ArrayList<IWorkingSet>();
+					list.add(workingSet);
+					hideWorkingSets(list);
+				} else
 					manager.removeWorkingSet(workingSet);
 			}
 		} else if (dialogResponse == HIDE_BUTTON) {
-			IWorkbenchPage page= JavaPlugin.getActivePage();
-			if (page != null) {
-				IWorkbenchPart activePart= page.getActivePart();
-				if (activePart instanceof PackageExplorerPart) {
-					PackageExplorerPart packagePart= (PackageExplorerPart)activePart;
-					WorkingSetModel model= packagePart.getWorkingSetModel();
-					List<IWorkingSet> activeWorkingSets= new ArrayList<IWorkingSet>(Arrays.asList(model.getActiveWorkingSets()));
-					activeWorkingSets.removeAll(SelectionUtil.toList(selection));
-					model.setActiveWorkingSets(activeWorkingSets.toArray(new IWorkingSet[activeWorkingSets.size()]));
-				}
+			hideWorkingSets((List<IWorkingSet>) SelectionUtil.toList(selection));
+		}
+	}
+
+	/**
+	 * Hides all the working sets in the list from the Package Explorer.
+	 * 
+	 * @param selection the selection of working sets 
+	 * @since 3.8
+	 */
+	private void hideWorkingSets(List<IWorkingSet> selection) {
+		IWorkbenchPage page= JavaPlugin.getActivePage();
+		if (page != null) {
+			IWorkbenchPart activePart= page.getActivePart();
+			if (activePart instanceof PackageExplorerPart) {
+				PackageExplorerPart packagePart= (PackageExplorerPart) activePart;
+				WorkingSetModel model= packagePart.getWorkingSetModel();
+				List<IWorkingSet> activeWorkingSets= new ArrayList<IWorkingSet>(Arrays.asList(model.getActiveWorkingSets()));
+				activeWorkingSets.removeAll(selection);
+				model.setActiveWorkingSets(activeWorkingSets.toArray(new IWorkingSet[activeWorkingSets.size()]));
 			}
 		}
 	}
 
+	/**
+	 * Checks if the working set is default working set.
+	 * 
+	 * @param workingSetID the working set id
+	 * @return <code>true</code> if default working set, <code>false</code> otherwise 
+	 * @since 3.8
+	 */
+	private boolean isDefaultWorkingSet(String workingSetID) {
+		return IWorkingSetIDs.OTHERS.equals(workingSetID);
+	}
+
 	/* (non-Javadoc)
 	 * @see org.eclipse.jdt.ui.actions.SelectionDispatchAction#run(org.eclipse.jface.viewers.IStructuredSelection)
 	 */
diff --git a/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/ReorgMessages.java b/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/ReorgMessages.java
index 7d56a2f..56b2278 100644
--- a/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/ReorgMessages.java
+++ b/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/ReorgMessages.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 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
@@ -81,6 +81,7 @@
 	public static String DeleteAction_4;
 	public static String DeleteWorkingSet_Hide;
 	public static String DeleteWorkingSet_removeorhideworkingset_single;
+	public static String DeleteWorkingSet_hideworkingset_single;
 	public static String DeleteWorkingSet_removeorhideworkingset_multiple;
 	public static String DeleteWorkingSet_Remove;
 	public static String DeleteWorkingSet_single;
diff --git a/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/ReorgMessages.properties b/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/ReorgMessages.properties
index 3b7d9ad..0ab32b7 100644
--- a/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/ReorgMessages.properties
+++ b/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/ReorgMessages.properties
@@ -1,5 +1,5 @@
 ###############################################################################
-# Copyright (c) 2000, 2010 IBM Corporation and others.
+# Copyright (c) 2000, 2011 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
@@ -32,6 +32,7 @@
 DeleteAction_4=Deletes the selected elements
 DeleteWorkingSet_Hide=&Hide
 DeleteWorkingSet_removeorhideworkingset_single=Do you want to remove the working set ''{0}'' or only hide it from the Package Explorer?
+DeleteWorkingSet_hideworkingset_single=Do you want to hide the working set ''{0}'' from the Package Explorer?
 DeleteWorkingSet_removeorhideworkingset_multiple=Do you want to remove these {0} working sets or only hide them from the Package Explorer?
 DeleteWorkingSet_Remove=&Remove
 DeleteWorkingSet_single=Delete Working Set