1 19 20 package org.netbeans.editor; 21 22 import java.util.Map ; 23 import java.util.regex.Matcher ; 24 import java.util.regex.Pattern ; 25 import java.util.regex.PatternSyntaxException ; 26 import javax.swing.text.BadLocationException ; 27 import javax.swing.text.Document ; 28 import org.netbeans.lib.editor.util.swing.DocumentUtilities; 29 import org.openide.DialogDisplayer; 30 import org.openide.ErrorManager; 31 import org.openide.NotifyDescriptor; 32 import org.openide.util.NbBundle; 33 34 39 public class DocumentFinder 40 { 41 50 public static int[] find( 51 BaseDocument doc, int startOffset, int endOffset, Map props, 52 boolean oppositeDir 53 ) throws BadLocationException { 54 return org.netbeans.modules.editor.lib2.search.DocumentFinder.find(doc, startOffset, endOffset, props, oppositeDir); 55 } 56 57 public static int[] findBlocks( 58 BaseDocument doc, int startOffset, int endOffset, 59 Map props, int blocks[] 60 ) throws BadLocationException { 61 return org.netbeans.modules.editor.lib2.search.DocumentFinder.findBlocks(doc, startOffset, endOffset, props, blocks); 62 } 63 64 69 public static FindReplaceResult findReplaceResult( 70 String replaceString, BaseDocument doc, int startOffset, int endOffset, 71 Map props, boolean oppositeDir 72 ) throws BadLocationException { 73 org.netbeans.modules.editor.lib2.search.DocumentFinder.FindReplaceResult result = 74 org.netbeans.modules.editor.lib2.search.DocumentFinder.findReplaceResult( 75 replaceString, doc, startOffset, endOffset, props, oppositeDir); 76 77 return new FindReplaceResult(result.getFoundPositions(), result.getReplacedString()); 78 } 79 80 private DocumentFinder() { 81 82 } 83 84 public static class FindReplaceResult{ 85 private int[] positions; 86 private String replacedString; 87 88 public FindReplaceResult(int[] positions, String replacedString){ 89 this.positions = positions; 90 this.replacedString = replacedString; 91 } 92 93 public String getReplacedString(){ 94 return replacedString; 95 } 96 97 public int[] getFoundPositions(){ 98 return positions; 99 } 100 } } 102 103 104 | Popular Tags |