From eb399de7e2607d92533e1f9e7aaacdb5723cedd5 Mon Sep 17 00:00:00 2001 From: Pierre-Yves B. Date: Sat, 1 Jun 2019 18:24:23 +0100 Subject: 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. --- .../org/eclipse/ui/texteditor/EditorMessages.java | 6 ++++-- .../ui/texteditor/EditorMessages.properties | 16 +++++++++------- .../org/eclipse/ui/texteditor/FindNextAction.java | 7 +++++-- .../eclipse/ui/texteditor/FindReplaceDialog.java | 22 +++++++++++++--------- 4 files changed, 31 insertions(+), 20 deletions(-) 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 d355d95d7bc..5bc5d9509fb 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 @@ final class EditorMessages extends NLS { 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 908aed6df07..552911f9c68 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_found_pattern={0}{1}: {2} Editor_FindIncremental_render_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_ReplaceFindButton_label=Replace/Fin&d 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 8e037e803a7..773b7c20d44 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.jface.text.TextUtilities; 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 @@ public class FindNextAction extends ResourceAction implements IUpdate { 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 00860cd97be..f1070ace33c 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 @@ class FindReplaceDialog extends Dialog { 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 @@ class FindReplaceDialog extends Dialog { * Sets the given status message in the status line. * * @param error true 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 @@ class FindReplaceDialog extends Dialog { 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 @@ class FindReplaceDialog extends Dialog { * @param message the message */ private void statusError(String message) { - statusMessage(true, message); + statusMessage(true, message, message); } /** @@ -1347,7 +1350,7 @@ class FindReplaceDialog extends Dialog { * @param message the message */ private void statusMessage(String message) { - statusMessage(false, message); + statusMessage(false, message, message); } /** @@ -1385,7 +1388,8 @@ class FindReplaceDialog extends Dialog { 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()); -- cgit v1.2.3