129
|
1 /*******************************************************************************
|
|
2 * Copyright (c) 2000, 2005 IBM Corporation and others.
|
|
3 * All rights reserved. This program and the accompanying materials
|
|
4 * are made available under the terms of the Eclipse Public License v1.0
|
|
5 * which accompanies this distribution, and is available at
|
|
6 * http://www.eclipse.org/legal/epl-v10.html
|
|
7 *
|
|
8 * Contributors:
|
|
9 * IBM Corporation - initial API and implementation
|
|
10 * Port to the D programming language:
|
|
11 * Frank Benoit <benoit@tionex.de>
|
|
12 *******************************************************************************/
|
|
13
|
|
14 module dwtx.jface.text.IFindReplaceTargetExtension3;
|
|
15
|
|
16 import dwt.dwthelper.utils;
|
|
17
|
|
18 /**
|
|
19 * Extension interface for {@link dwtx.jface.text.IFindReplaceTarget}.
|
|
20 * <p>
|
|
21 * Extends the find replace target's <code>findAndSelect</code> and
|
|
22 * <code>replaceSelection</code> methods to allow and be aware of regular
|
|
23 * expression find/replace.
|
|
24 *
|
|
25 * @since 3.0
|
|
26 */
|
|
27 public interface IFindReplaceTargetExtension3 {
|
|
28
|
|
29 /**
|
|
30 * Searches for a string starting at the given offset and using the specified search
|
|
31 * directives. If a string has been found it is selected and its start offset is
|
|
32 * returned. If regExSearch is <code>true</code> the findString is
|
|
33 * interpreted as a regular expression.
|
|
34 *
|
|
35 * @param offset the offset at which searching starts
|
|
36 * @param findString the specification of what should be found
|
|
37 * @param searchForward <code>true</code> searches forward, <code>false</code> backwards
|
|
38 * @param caseSensitive <code>true</code> performs a case sensitive search, <code>false</code> an insensitive search
|
|
39 * @param wholeWord if <code>true</code> only occurrences are reported in which the findString stands as a word by itself.
|
|
40 * Must not be used in combination with <code>regExSearch</code>.
|
|
41 * @param regExSearch if <code>true</code> findString represents a regular expression
|
|
42 * Must not be used in combination with <code>wholeWord</code>.
|
|
43 * @return the position of the specified string, or -1 if the string has not been found
|
|
44 * @throws java.util.regex.PatternSyntaxException if regExSearch is <code>true</code> and findString is an invalid regular expression
|
|
45 */
|
|
46 int findAndSelect(int offset, String findString, bool searchForward, bool caseSensitive, bool wholeWord, bool regExSearch);
|
|
47
|
|
48 /**
|
|
49 * Replaces the currently selected range of characters with the given text.
|
|
50 * If regExReplace is <code>true</code> the text is interpreted as a
|
|
51 * regular expression that is used to process the selected text in order to
|
|
52 * produce the actual replacement of the selected text.
|
|
53 * <p>
|
|
54 * This target must be editable. Otherwise nothing happens.
|
|
55 *
|
|
56 * @param text the specification of the substitution text
|
|
57 * @param regExReplace if <code>true</code> text represents a regular
|
|
58 * expression
|
|
59 * @throws IllegalStateException in case of regular expressions, this call
|
|
60 * is not preceded by a call to <code>findAndSelect</code>
|
|
61 * @throws java.util.regex.PatternSyntaxException if regExReplace is
|
|
62 * <code>true</code> and text is an invalid regular expression
|
|
63 */
|
|
64 void replaceSelection(String text, bool regExReplace);
|
|
65 }
|