Package org.eclipse.jface.text

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


  }
 
  public IRegion getAttributeValueRegion(String attributeName) throws BadLocationException {
    FindReplaceDocumentAdapter findReplaceAdapter = new FindReplaceDocumentAdapter(_document);
   
    IRegion region = findReplaceAdapter.find(_documentRegion.getOffset(), attributeName + "=\"" + getAttributeValue(attributeName) + "\"", true, true, false, false);
    if (region != null) {
      String tmp = attributeName + "=\"";
      return new Region(region.getOffset() + tmp.length(), region.getLength() - tmp.length() - 1);
    } else {
      return null;
View Full Code Here


        ITextEditor textEditor = (ITextEditor) editor;
        IDocument doc = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput());
        try {
          // search for line starting with label key
          FindReplaceDocumentAdapter finder = new FindReplaceDocumentAdapter(doc);
          IRegion keyRegion = finder.find(0, "^" + LabelFileEncodingHelper.saveConvert(labelKey,true).replaceAll("\\\\", "\\\\\\\\") + "\\s*=", true, false, false, true);
          if (keyRegion != null) {
            textEditor.getSelectionProvider().setSelection(new TextSelection(keyRegion.getOffset() + keyRegion.getLength(),0));
          }
        } catch (BadLocationException e) {
        }
View Full Code Here

      IDocument doc = change.getCurrentDocument(new NullProgressMonitor());
      // create Textedit
   
 
      FindReplaceDocumentAdapter find = new FindReplaceDocumentAdapter(doc);
      IRegion resultStart = find.find(0, "location\\s*=\\s*\"", true, true, false, true);
      IRegion resultStop = find.find(resultStart.getOffset() + resultStart.getLength(), "\"", true, true, false, false);
 
      String linkTarget = WGADesignStructureHelper.computeDirLinkTarget(info.getFile().getParent(), computeNewLinkTarget(info));
      TextEdit edit = new ReplaceEdit(resultStart.getLength() + resultStart.getOffset(), resultStop.getOffset() - (resultStart.getLength() + resultStart.getOffset()), linkTarget);
     
View Full Code Here

      // create Textedit
   
 
      FindReplaceDocumentAdapter find = new FindReplaceDocumentAdapter(doc);
      IRegion resultStart = find.find(0, "location\\s*=\\s*\"", true, true, false, true);
      IRegion resultStop = find.find(resultStart.getOffset() + resultStart.getLength(), "\"", true, true, false, false);
 
      String linkTarget = WGADesignStructureHelper.computeDirLinkTarget(info.getFile().getParent(), computeNewLinkTarget(info));
      TextEdit edit = new ReplaceEdit(resultStart.getLength() + resultStart.getOffset(), resultStop.getOffset() - (resultStart.getLength() + resultStart.getOffset()), linkTarget);
     
      change.setEdit(edit);
View Full Code Here

            int offset = -1;

            FindReplaceDocumentAdapter docFind = new FindReplaceDocumentAdapter(doc);

            IRegion regionEnd =
                docFind.find(selection.getOffset(), "^__END__", true, true, false, true);
            offset = (regionEnd != null) ? regionEnd.getOffset() : doc.getLength();

            String lineSep = getLineSeparator(doc.get());

            // format and insert the new subroutine code
View Full Code Here

      IRegion region = null;
      int index = 0;
     
      for(int i=0; i<ids.length; i++)
      {
        region = frda.find(index, '"' + ids[i] + '"', true, true, false, false);
        if(region != null)
        {
          index = region.getOffset();
        }
      }
View Full Code Here

          if ("java".equals(extension))
          {
            final ITextEditor textEditor = (ITextEditor)wEditor.getJavaEditor();
            final IDocument document = ((textEditor).getDocumentProvider()).getDocument(textEditor.getEditorInput());
            final FindReplaceDocumentAdapter frda = new FindReplaceDocumentAdapter(document);
            final IRegion region = frda.find(0, '"' + wicketId + '"', true, true, false, false);
            if (region != null)
            {
              textEditor.selectAndReveal(region.getOffset() + 1, wicketId.length());
              wEditor.setActiveEditor(wEditor.getJavaEditor());
            }
View Full Code Here

          else if ("html".equals(extension))
          {
            final ITextEditor textEditor = (ITextEditor)wEditor.getHtmlEditor();
            final IDocument document = ((textEditor).getDocumentProvider()).getDocument(textEditor.getEditorInput());
            final FindReplaceDocumentAdapter frda = new FindReplaceDocumentAdapter(document);
            final IRegion region = frda.find(0, "wicket:id=\"" + wicketId, true, true, true, false);
            if (region != null)
            {
              textEditor.selectAndReveal(region.getOffset() + 11, wicketId.length());
              wEditor.setActiveEditor(wEditor.getHtmlEditor());
            }
View Full Code Here

          else if ("properties".equals(extension) && propertiesEditor != null)
          {
            final ITextEditor textEditor = (ITextEditor)propertiesEditor;
            final IDocument document = ((textEditor).getDocumentProvider()).getDocument(textEditor.getEditorInput());
            final FindReplaceDocumentAdapter frda = new FindReplaceDocumentAdapter(document);
            IRegion regionBegin = frda.find(0, wicketId, true, true, true, false);
            if (regionBegin != null)
            {
              regionBegin = frda.find(regionBegin.getOffset(), "=", true, true, false, false);
              if (regionBegin != null)
              {
View Full Code Here

            final IDocument document = ((textEditor).getDocumentProvider()).getDocument(textEditor.getEditorInput());
            final FindReplaceDocumentAdapter frda = new FindReplaceDocumentAdapter(document);
            IRegion regionBegin = frda.find(0, wicketId, true, true, true, false);
            if (regionBegin != null)
            {
              regionBegin = frda.find(regionBegin.getOffset(), "=", true, true, false, false);
              if (regionBegin != null)
              {
                final IRegion lineRegion = document.getLineInformationOfOffset(regionBegin.getOffset());
                final int selectionLength = lineRegion.getOffset() + lineRegion.getLength() - regionBegin.getOffset();
                textEditor.selectAndReveal(regionBegin.getOffset() + 1, selectionLength);
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.