/******************************************************************************* * Copyright (c) 2000, 2005 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.jface.text; /** * Extension interface for {@link org.eclipse.jface.text.IFindReplaceTarget}. *

* Extends the find replace target's findAndSelect and * replaceSelection methods to allow and be aware of regular * expression find/replace. * * @since 3.0 */ public interface IFindReplaceTargetExtension3 { /** * Searches for a string starting at the given offset and using the specified search * directives. If a string has been found it is selected and its start offset is * returned. If regExSearch is true the findString is * interpreted as a regular expression. * * @param offset the offset at which searching starts * @param findString the specification of what should be found * @param searchForward true searches forward, false backwards * @param caseSensitive true performs a case sensitive search, false an insensitive search * @param wholeWord if true only occurrences are reported in which the findString stands as a word by itself. * Must not be used in combination with regExSearch. * @param regExSearch if true findString represents a regular expression * Must not be used in combination with wholeWord. * @return the position of the specified string, or -1 if the string has not been found * @throws java.util.regex.PatternSyntaxException if regExSearch is true and findString is an invalid regular expression */ int findAndSelect(int offset, String findString, boolean searchForward, boolean caseSensitive, boolean wholeWord, boolean regExSearch); /** * Replaces the currently selected range of characters with the given text. * If regExReplace is true the text is interpreted as a * regular expression that is used to process the selected text in order to * produce the actual replacement of the selected text. *

* This target must be editable. Otherwise nothing happens. * * @param text the specification of the substitution text * @param regExReplace if true text represents a regular * expression * @throws IllegalStateException in case of regular expressions, this call * is not preceded by a call to findAndSelect * @throws java.util.regex.PatternSyntaxException if regExReplace is * true and text is an invalid regular expression */ void replaceSelection(String text, boolean regExReplace); }