Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.FindReplaceDocumentAdapter.find()


      searchPattern= NON_EMPTY_COMPLETION_BOUNDARY + asRegPattern(prefix);
    } else {
      searchPattern= COMPLETION_BOUNDARY + asRegPattern(prefix);
    }
   
    IRegion reg= searcher.find(firstPosition, searchPattern, true, CASE_SENSITIVE, false, true);
    while (reg != null) {
      // since the boundary may be of nonzero length
      int wordSearchPos= reg.getOffset() + reg.getLength() - prefix.length();
      // try to complete to a word. case is irrelevant here.
      IRegion word= searcher.find(wordSearchPos, COMPLETION_WORD_REGEX, true, true, false, true);
View Full Code Here


    IRegion reg= searcher.find(firstPosition, searchPattern, true, CASE_SENSITIVE, false, true);
    while (reg != null) {
      // since the boundary may be of nonzero length
      int wordSearchPos= reg.getOffset() + reg.getLength() - prefix.length();
      // try to complete to a word. case is irrelevant here.
      IRegion word= searcher.find(wordSearchPos, COMPLETION_WORD_REGEX, true, true, false, true);
      if (word.getLength() > prefix.length() ) { // empty suggestion will be added later
        String wholeWord= document.get(word.getOffset(), word.getLength());
        String completion= wholeWord.substring(prefix.length());
        if (currentWordLast && reg.getOffset() == firstPosition) { // we got the word at caret as completion
          currentWordCompletion= completion; // add it as the last word.
View Full Code Here

      }
      int nextPos= word.getOffset() + word.getLength();
      if (nextPos >= document.getLength() ) {
        break;
      }
      reg= searcher.find(nextPos, searchPattern, true, CASE_SENSITIVE, false, true);
    }
   
    // the word at caret position goes last (bug 132533).
    if (currentWordCompletion != null) {
      res.add(currentWordCompletion);
View Full Code Here

    FindReplaceDocumentAdapter searcher= new FindReplaceDocumentAdapter(document);

    // search only at word boundaries
    String searchPattern= COMPLETION_BOUNDARY + asRegPattern(prefix);

    IRegion reg= searcher.find(0, searchPattern, true, CASE_SENSITIVE, false, true);
    while (reg != null) {
      // since the boundary may be of nonzero length
      int wordSearchPos= reg.getOffset() + reg.getLength() - prefix.length();
      // try to complete to a word. case is of no matter here
      IRegion word= searcher.find(wordSearchPos, COMPLETION_WORD_REGEX, true, true, false, true);
View Full Code Here

    IRegion reg= searcher.find(0, searchPattern, true, CASE_SENSITIVE, false, true);
    while (reg != null) {
      // since the boundary may be of nonzero length
      int wordSearchPos= reg.getOffset() + reg.getLength() - prefix.length();
      // try to complete to a word. case is of no matter here
      IRegion word= searcher.find(wordSearchPos, COMPLETION_WORD_REGEX, true, true, false, true);
            if (word.getOffset() + word.getLength() > firstPosition) {
                break;
            }
      if (word.getLength() > prefix.length() ) { // empty suggestion will be added later
        String found= document.get(word.getOffset(), word.getLength());
View Full Code Here

      }
            int nextPos= word.getOffset() + word.getLength();
            if (nextPos >= firstPosition ) { // for efficiency only
                break;
            }
      reg= searcher.find(nextPos, searchPattern, true, CASE_SENSITIVE, false, true);
    }
        Collections.reverse(res);

    return res;
  }
View Full Code Here

    targetSignature = ((ToolComponent)getParent()).getToolName() + "." + targetSignature;
    String startRegionRegex = "method\\s+" + targetSignature + "\\s*begin";
    String endRegionRegex = "(?s)(.+?)(?-s)end method;";
    try {
      FindReplaceDocumentAdapter frAdapter = new FindReplaceDocumentAdapter(document);
      IRegion startRegion = frAdapter.find(0, startRegionRegex, true, false, false, true);
     
      if (startRegion == null)
        return null; // no method implementation
     
      IRegion endRegion = frAdapter.find(startRegion.getOffset()+startRegion.getLength()+"begin".length(), endRegionRegex, true, false, false, true);
View Full Code Here

      IRegion startRegion = frAdapter.find(0, startRegionRegex, true, false, false, true);
     
      if (startRegion == null)
        return null; // no method implementation
     
      IRegion endRegion = frAdapter.find(startRegion.getOffset()+startRegion.getLength()+"begin".length(), endRegionRegex, true, false, false, true);
      IRegion sourceRegion = null;
      if (includeSignature){
        sourceRegion = new Region(startRegion.getOffset(), "begin".length()+startRegion.getLength()+endRegion.getLength());
      } else {
        sourceRegion = new Region(endRegion.getOffset(), endRegion.getLength()-"end method;".length());
View Full Code Here

  protected void parse(IDocument document) {

    try {
      FindReplaceDocumentAdapter frAdapter = new FindReplaceDocumentAdapter(document);
      // do the attributes
      IRegion region = frAdapter.find(0, ATTRIBUTE_REGEX, true, false, false, true);
      String attributeLabel = null;
      while (region != null){
        int offset = region.getOffset();
        int length = region.getLength();
        Position p = new Position(offset, length);
View Full Code Here

        Matcher sig = attributePattern.matcher(attributeLabel);
        if (sig.find()){
          attributeLabel = sig.group(2);
          fContent.add(new Segment(attributeLabel, p, makeIconString("attribute", sig.group(1))));
        }
        region = frAdapter.find(offset+length, ATTRIBUTE_REGEX, true, false, false, true);
      }
      // do the virtual attributes
      region = frAdapter.find(0, VIRTUAL_ATTRIBUTE_REGEX, true, false, false, true);
      attributeLabel = null;
      while (region != null){
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.