diff options
author | Dani Megert | 2002-08-29 15:58:28 +0000 |
---|---|---|
committer | Dani Megert | 2002-08-29 15:58:28 +0000 |
commit | e3fbe4574786dd63bde3f893caad21ae5635c68e (patch) | |
tree | f30c6347caa559844a8f4d5caa67616e6a245957 | |
parent | 872759ea7d6cbf1c2d3f3cabf2b50ae91095ea65 (diff) | |
download | eclipse.platform.text-e3fbe4574786dd63bde3f893caad21ae5635c68e.tar.gz eclipse.platform.text-e3fbe4574786dd63bde3f893caad21ae5635c68e.tar.xz eclipse.platform.text-e3fbe4574786dd63bde3f893caad21ae5635c68e.zip |
Support to hide inexact matches
3 files changed, 61 insertions, 15 deletions
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.properties b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.properties index 9ff8248607d..cf70b6c2254 100644 --- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.properties +++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.properties @@ -59,6 +59,9 @@ Search.Error.openResultView.message= Could not open the search results view Search.Error.deleteMarkers.title= Search Error Search.Error.deleteMarkers.message= An error occurred during deletion of search markers +Search.Error.findMarkers.title= Search Error +Search.Error.findMarkers.message= An error occurred while gathering the search markers + Search.Error.createMarker.title=Search Error Search.Error.createMarker.message= Could not create the search marker @@ -156,6 +159,7 @@ ExceptionDialog.seeErrorLogMessage= See error log for more details SearchPreferencePage.emphasizePotentialMatches= &Emphasize inexact matches SearchPreferencePage.potentialMatchFgColor= &Foreground color for inexact matches: SearchPreferencePage.reuseEditor= &Reuse editors to show matches +SearchPreferencePage.ignorePotentialMatches= &Ignore inexact matches ReplaceAction.label_all= Re&place... ReplaceAction.label_selected= Rep&lace Selected... @@ -187,3 +191,8 @@ ReplaceDialog.error.unable_to_open_text_editor=It is not possible to open the bu SelectAllAction.label= Select A&ll SelectAllAction.tooltip= Select All + +RemovePotentialMatchesAction.removePotentialMatches.text= Remove Inexact Matches +RemovePotentialMatchesAction.removePotentialMatches.tooltip= Remove all inexact matches +RemovePotentialMatchesAction.dialog.title= Remove Inexact Matches +RemovePotentialMatchesAction.dialog.message= The current search result does not contain inexact matches. diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPreferencePage.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPreferencePage.java index cb33fdabf3a..b959dbbd097 100644 --- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPreferencePage.java +++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPreferencePage.java @@ -23,12 +23,27 @@ import org.eclipse.ui.help.WorkbenchHelp; */ public class SearchPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { + + /* + * FIXE: This is a workaround for bug 22987 + */ + private class FixedBooleanFieldEditor extends BooleanFieldEditor { + public FixedBooleanFieldEditor(String name, String label, Composite parent) { + super(name, label, DEFAULT, parent); + } + public void setEnabled(boolean state, Composite parent) { + getChangeControl(parent).setEnabled(state); + } + } + + public static final String IGNORE_POTENTIAL_MATCHES= "org.eclipse.search.potentialMatch.ignore"; //$NON-NLS-1$ public static final String EMPHASIZE_POTENTIAL_MATCHES= "org.eclipse.search.potentialMatch.emphasize"; //$NON-NLS-1$ public static final String POTENTIAL_MATCH_FG_COLOR= "org.eclipse.search.potentialMatch.fgColor"; //$NON-NLS-1$ public static final String REUSE_EDITOR= "org.eclipse.search.reuseEditor"; //$NON-NLS-1$ private ColorFieldEditor fColorEditor; private BooleanFieldEditor fEmphasizedCheckbox; + private BooleanFieldEditor fIgnorePotentialMatchesCheckbox; private Composite fParent; public SearchPreferencePage() { @@ -39,6 +54,7 @@ public class SearchPreferencePage extends FieldEditorPreferencePage implements I public static void initDefaults(IPreferenceStore store) { RGB gray= new RGB(85, 85, 85); store.setDefault(EMPHASIZE_POTENTIAL_MATCHES, true); + store.setDefault(IGNORE_POTENTIAL_MATCHES, false); PreferenceConverter.setDefault(store, POTENTIAL_MATCH_FG_COLOR, gray); store.setDefault(REUSE_EDITOR, false); } @@ -48,6 +64,11 @@ public class SearchPreferencePage extends FieldEditorPreferencePage implements I return store.getBoolean(REUSE_EDITOR); } + public static boolean arePotentialMatchesIgnored() { + IPreferenceStore store= SearchPlugin.getDefault().getPreferenceStore(); + return store.getBoolean(IGNORE_POTENTIAL_MATCHES); + } + public static boolean arePotentialMatchesEmphasized() { IPreferenceStore store= SearchPlugin.getDefault().getPreferenceStore(); return store.getBoolean(EMPHASIZE_POTENTIAL_MATCHES); @@ -71,7 +92,13 @@ public class SearchPreferencePage extends FieldEditorPreferencePage implements I ); addField(boolEditor); - fEmphasizedCheckbox= new BooleanFieldEditor( + fIgnorePotentialMatchesCheckbox= new FixedBooleanFieldEditor( + IGNORE_POTENTIAL_MATCHES, + SearchMessages.getString("SearchPreferencePage.ignorePotentialMatches"), //$NON-NLS-1$ + getFieldEditorParent()); + addField(fIgnorePotentialMatchesCheckbox); + + fEmphasizedCheckbox= new FixedBooleanFieldEditor( EMPHASIZE_POTENTIAL_MATCHES, SearchMessages.getString("SearchPreferencePage.emphasizePotentialMatches"), //$NON-NLS-1$ getFieldEditorParent()); @@ -83,11 +110,15 @@ public class SearchPreferencePage extends FieldEditorPreferencePage implements I getFieldEditorParent() ); addField(fColorEditor); - fColorEditor.setEnabled(arePotentialMatchesEmphasized(), getFieldEditorParent()); + + fEmphasizedCheckbox.setEnabled(!arePotentialMatchesIgnored(), getFieldEditorParent()); + fColorEditor.setEnabled(!arePotentialMatchesIgnored() && arePotentialMatchesEmphasized(), getFieldEditorParent()); } public void propertyChange(PropertyChangeEvent event) { - fColorEditor.setEnabled(fEmphasizedCheckbox.getBooleanValue(), getFieldEditorParent()); + boolean arePotentialMatchesIgnored= fIgnorePotentialMatchesCheckbox.getBooleanValue(); + fEmphasizedCheckbox.setEnabled(!arePotentialMatchesIgnored, getFieldEditorParent()); + fColorEditor.setEnabled(!arePotentialMatchesIgnored && fEmphasizedCheckbox.getBooleanValue(), getFieldEditorParent()); } public void init(IWorkbench workbench) { @@ -95,6 +126,8 @@ public class SearchPreferencePage extends FieldEditorPreferencePage implements I protected void performDefaults() { super.performDefaults(); - fColorEditor.setEnabled(fEmphasizedCheckbox.getBooleanValue(), getFieldEditorParent()); + boolean arePotentialMatchesIgnored= fIgnorePotentialMatchesCheckbox.getBooleanValue(); + fEmphasizedCheckbox.setEnabled(!arePotentialMatchesIgnored, getFieldEditorParent()); + fColorEditor.setEnabled(!arePotentialMatchesIgnored && fEmphasizedCheckbox.getBooleanValue(), getFieldEditorParent()); } } diff --git a/org.eclipse.search/search/org/eclipse/search/ui/SearchUI.java b/org.eclipse.search/search/org/eclipse/search/ui/SearchUI.java index 759df541b0f..6525942c003 100644 --- a/org.eclipse.search/search/org/eclipse/search/ui/SearchUI.java +++ b/org.eclipse.search/search/org/eclipse/search/ui/SearchUI.java @@ -133,17 +133,6 @@ public final class SearchUI { * * The goto action can decide to use or ignore this preference. * - * <p> - * [Issue: Work in progress - not yet stable.] - * </p> - * <p> - * [Issue: Always returns <code>true</code> yet due to bug 6784.] - * </p> - * <p> - * [Issue: Bug is now fixed. But because it is not yet clear if - * old style should be supported. Therefore returning <code>false</code>] - * </p> - * * @return <code>true</code> if editors should be reused for showing search results * @since 2.0 */ @@ -152,6 +141,21 @@ public final class SearchUI { } /** + * Returns the preference whether a search engine is + * allowed to report potential matches or not. + * <p> + * Search engines which can report inexact matches must + * respect this preference i.e. they should not report + * inexact matches if this method returns <code>true</code> + * </p> + * @return <code>true</code> if search engine must not report inexact matches + * @since 2.1 + */ + public static boolean arePotentialMatchesIgnored() { + return SearchPreferencePage.arePotentialMatchesIgnored(); + } + + /** * Block instantiation. */ private SearchUI() { |