Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortod2003-11-21 15:54:40 +0000
committertod2003-11-21 15:54:40 +0000
commit3b995b287208e304421dca15c4a6830dd644868f (patch)
tree5aefa710fc22f9a1c7cf6a7546edc4b5f58dac90
parentf285f057931354c844bc8dd4a7b729f138d3414a (diff)
downloadeclipse.platform.text-3b995b287208e304421dca15c4a6830dd644868f.tar.gz
eclipse.platform.text-3b995b287208e304421dca15c4a6830dd644868f.tar.xz
eclipse.platform.text-3b995b287208e304421dca15c4a6830dd644868f.zip
Merge with HEADmerge_new_look_M5
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceDialog.java40
1 files changed, 33 insertions, 7 deletions
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 0e9a942cf..4731a33f3 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
@@ -710,9 +710,10 @@ class FindReplaceDialog extends Dialog {
setGridData(fIsRegExCheckBox, GridData.BEGINNING, false, GridData.CENTER, false);
((GridData)fIsRegExCheckBox.getLayoutData()).horizontalSpan= 2;
fIsRegExCheckBox.setSelection(fIsRegExInit);
- fIncrementalCheckBox.setEnabled(!isRegExSearchAvailableAndChecked());
- fWholeWordCheckBox.setEnabled(!isRegExSearchAvailableAndChecked());
- fIsRegExCheckBox.addSelectionListener(new SelectionListener() {
+ fIsRegExCheckBox.addSelectionListener(new SelectionAdapter() {
+ /*
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
public void widgetSelected(SelectionEvent e) {
boolean newState= fIsRegExCheckBox.getSelection();
fIncrementalCheckBox.setEnabled(!newState);
@@ -722,11 +723,17 @@ class FindReplaceDialog extends Dialog {
fFindFieldContentAssistant.enableAutoActivation(newState);
fReplaceFieldContentAssistant.enableAutoActivation(newState);
}
-
- public void widgetDefaultSelected(SelectionEvent e) {
+ });
+ fWholeWordCheckBox.setEnabled(!isRegExSearchAvailableAndChecked());
+ fWholeWordCheckBox.addSelectionListener(new SelectionAdapter() {
+ /*
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ public void widgetSelected(SelectionEvent e) {
+ updateButtonState();
}
});
-
+ fIncrementalCheckBox.setEnabled(!isRegExSearchAvailableAndChecked());
return panel;
}
@@ -1457,7 +1464,7 @@ class FindReplaceDialog extends Dialog {
boolean enable= fTarget != null && (fActiveShell == fParentShell || fActiveShell == getShell());
String str= getFindString();
- boolean findString= (str != null && str.length() > 0);
+ boolean findString= str != null && str.length() > 0 && (isRegExSearchAvailableAndChecked() || !isWholeWordSearch() || isWord(str));
fFindNextButton.setEnabled(enable && findString);
fReplaceSelectionButton.setEnabled(!disableReplace && enable && isEditable() && selection && (!fNeedsInitialFindBeforeReplace || !isRegExSearchAvailableAndChecked()));
@@ -1467,6 +1474,25 @@ class FindReplaceDialog extends Dialog {
}
/**
+ * Tests whether each character in the given
+ * string is a letter.
+ *
+ * @param str
+ * @return <code>true</code> if the given string is a worf
+ * @since 3.0
+ */
+ private boolean isWord(String str) {
+ if (str == null)
+ return false;
+
+ for (int i= 0, length= str.length(); i < length; i++) {
+ if (!Character.isLetter(str.charAt(i)))
+ return false;
+ }
+ return true;
+ }
+
+ /**
* Updates the given combo with the given content.
* @param combo combo to be updated
* @param content to be put into the combo

Back to the top