Bug 121634 - [find/replace] status bar must show the string being
searched when "String Not Found"

Change-Id: I13fbad199668fd86691456616e4b20eeedba2443
Signed-off-by: Pierre-Yves B. <PyvesDev@gmail.com>
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/EditorMessages.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/EditorMessages.java
index d355d95..5bc5d95 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/EditorMessages.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/EditorMessages.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
  *
  * This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License 2.0
@@ -9,7 +9,8 @@
  * SPDX-License-Identifier: EPL-2.0
  *
  * Contributors:
- *     IBM Corporation - initial API and implementation
+ *     IBM Corporation - initial API and implementation.
+ *     Pierre-Yves B., pyvesdev@gmail.com - Bug 121634: [find/replace] status bar must show the string being searched when "String Not Found"
  *******************************************************************************/
 package org.eclipse.ui.texteditor;
 
@@ -116,6 +117,7 @@
 	public static String FindReplace_ReplaceAllButton_label;
 	public static String FindReplace_CloseButton_label;
 	public static String FindReplace_Status_noMatch_label;
+	public static String FindReplace_Status_noMatchWithValue_label;
 	public static String FindReplace_Status_replacement_label;
 	public static String FindReplace_Status_replacements_label;
 	public static String FindReplace_Status_wrapped_label;
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/EditorMessages.properties b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/EditorMessages.properties
index 908aed6..552911f 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/EditorMessages.properties
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/EditorMessages.properties
@@ -1,5 +1,5 @@
 ###############################################################################
-# Copyright (c) 2000, 2011 IBM Corporation and others.
+# Copyright (c) 2000, 2019 IBM Corporation and others.
 #
 # This program and the accompanying materials
 # are made available under the terms of the Eclipse Public License 2.0
@@ -10,6 +10,7 @@
 #
 # Contributors:
 #     IBM Corporation - initial API and implementation
+#     Pierre-Yves B., pyvesdev@gmail.com - Bug 121634: [find/replace] status bar must show the string being searched when "String Not Found"
 ###############################################################################
 
 
@@ -18,7 +19,7 @@
 Editor_error_no_provider=Text editor does not have a document provider
 
 Editor_error_save_title=Save Problems
-Editor_error_save_message=Save could not be completed. Try File > Save As... if the problem persists. 
+Editor_error_save_message=Save could not be completed. Try File > Save As... if the problem persists.
 
 Editor_error_save_deleted_title=Cannot Save
 Editor_error_save_deleted_message=The file has been deleted or is not accessible.
@@ -74,8 +75,8 @@
 Editor_FindIncremental_render_tab=<TAB>
 
 # The following two properties must end in a space
-Editor_FindIncremental_wrapped=Wrapped 
-Editor_FindIncremental_reverse=Reverse 
+Editor_FindIncremental_wrapped=Wrapped
+Editor_FindIncremental_reverse=Reverse
 
 Editor_ConvertLineDelimiter_title=Converting line delimiters...
 
@@ -111,12 +112,13 @@
 FindReplace_ReplaceSelectionButton_label=&Replace
 FindReplace_ReplaceAllButton_label=Replace &All
 FindReplace_CloseButton_label=Close
-FindReplace_Status_noMatch_label=String Not Found
-FindReplace_Status_replacement_label=1 Match replaced
+FindReplace_Status_noMatch_label=String not found
+FindReplace_Status_noMatchWithValue_label=String ''{0}'' not found
+FindReplace_Status_replacement_label=1 match replaced
 FindReplace_Status_replacements_label={0} matches replaced
 FindReplace_Status_wrapped_label=Wrapped search
 
-FindNext_Status_noMatch_label=String Not Found
+FindNext_Status_noMatch_label=String ''{0}'' not found
 
 AbstractDocumentProvider_ok=OK
 AbstractDocumentProvider_error=ERROR
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindNextAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindNextAction.java
index 8e037e8..773b7c2 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindNextAction.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindNextAction.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
  *
  * This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License 2.0
@@ -10,6 +10,7 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     Pierre-Yves B., pyvesdev@gmail.com - Bug 121634: [find/replace] status bar must show the string being searched when "String Not Found"
  *******************************************************************************/
 
 package org.eclipse.ui.texteditor;
@@ -35,6 +36,7 @@
 import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IWorkbenchPart;
 import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.internal.texteditor.NLSUtility;
 import org.eclipse.ui.internal.texteditor.TextEditorPlugin;
 
 
@@ -165,7 +167,8 @@
 		if (manager == null)
 			return;
 
-		manager.setMessage(EditorMessages.FindNext_Status_noMatch_label);
+		String msg= NLSUtility.format(EditorMessages.FindNext_Status_noMatch_label, fFindString);
+		manager.setMessage(msg);
 	}
 
 	/**
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceDialog.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceDialog.java
index 00860cd..f1070ac 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceDialog.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceDialog.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
  *
  * This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License 2.0
@@ -11,6 +11,7 @@
  * Contributors:
  *     IBM Corporation - initial API and implementation
  *     SAP SE, christian.georgi@sap.com - Bug 487357: Make find dialog content scrollable
+ *     Pierre-Yves B., pyvesdev@gmail.com - Bug 121634: [find/replace] status bar must show the string being searched when "String Not Found"
  *******************************************************************************/
 package org.eclipse.ui.texteditor;
 
@@ -976,7 +977,8 @@
 		int index= findIndex(findString, findReplacePosition, forwardSearch, caseSensitive, wrapSearch, wholeWord, regExSearch, beep);
 
 		if (index == -1) {
-			statusMessage(EditorMessages.FindReplace_Status_noMatch_label);
+			String msg= NLSUtility.format(EditorMessages.FindReplace_Status_noMatchWithValue_label, findString);
+			statusMessage(false, EditorMessages.FindReplace_Status_noMatch_label, msg);
 			return false;
 		}
 
@@ -1316,10 +1318,11 @@
 	 * Sets the given status message in the status line.
 	 *
 	 * @param error <code>true</code> if it is an error
-	 * @param message the error message
+	 * @param dialogMessage the message to display in the dialog's status line
+	 * @param editorMessage the message to display in the editor's status line
 	 */
-	private void statusMessage(boolean error, String message) {
-		fStatusLabel.setText(message);
+	private void statusMessage(boolean error, String dialogMessage, String editorMessage) {
+		fStatusLabel.setText(dialogMessage);
 
 		if (error)
 			fStatusLabel.setForeground(JFaceColors.getErrorText(fStatusLabel.getDisplay()));
@@ -1328,7 +1331,7 @@
 
 		IEditorStatusLine statusLine= getStatusLineManager();
 		if (statusLine != null)
-			statusLine.setMessage(error, message, null);
+			statusLine.setMessage(error, editorMessage, null);
 
 		if (error)
 			getShell().getDisplay().beep();
@@ -1339,7 +1342,7 @@
 	 * @param message the message
 	 */
 	private void statusError(String message) {
-		statusMessage(true, message);
+		statusMessage(true, message, message);
 	}
 
 	/**
@@ -1347,7 +1350,7 @@
 	 * @param message the message
 	 */
 	private void statusMessage(String message) {
-		statusMessage(false, message);
+		statusMessage(false, message, message);
 	}
 
 	/**
@@ -1385,7 +1388,8 @@
 						statusMessage(msg);
 					}
 				} else {
-					statusMessage(EditorMessages.FindReplace_Status_noMatch_label);
+					String msg= NLSUtility.format(EditorMessages.FindReplace_Status_noMatchWithValue_label, findString);
+					statusMessage(false, EditorMessages.FindReplace_Status_noMatch_label, msg);
 				}
 			} catch (PatternSyntaxException ex) {
 				statusError(ex.getLocalizedMessage());