Package org.eclipse.search.ui.text

Examples of org.eclipse.search.ui.text.Match


      Logger.logException("offset: " + Integer.toString(jspStart), e); //$NON-NLS-1$
    }
    createSearchMarker(jspFile, jspStart, jspEnd, lineNumber);
   
    if(this.fJavaRequestor != null) {
      Match match = new Match(jspFile, jspStart, jspEnd - jspStart);
      this.fJavaRequestor.reportMatch(match);
    }
  }
View Full Code Here


    private Match getCurrentMarker() {
        return (Match) fMarkers.get(0);
    }

    private void replace(IProgressMonitor pm, String replacementText) throws BadLocationException, CoreException {
        Match marker = getCurrentMarker();
        pm.beginTask(SearchMessages.ReplaceDialog_task_replace, 10);
        replaceInFile(pm, (IFile) marker.getElement(), replacementText, new Match[] { marker });
    }
View Full Code Here

        pm.beginTask(SearchMessages.ReplaceDialog_task_replace, 10);
        replaceInFile(pm, (IFile) marker.getElement(), replacementText, new Match[] { marker });
    }

    private void replaceInFile(IProgressMonitor pm, String replacementText) throws BadLocationException, CoreException {
        Match firstMarker = getCurrentMarker();
        Match[] markers = collectMarkers((IFile) firstMarker.getElement());
        pm.beginTask(Messages.format(SearchMessages.ReplaceDialog_task_replaceInFile,
                ((IFile) firstMarker.getElement()).getFullPath().toOSString()), 4);
        replaceInFile(pm, (IFile) firstMarker.getElement(), replacementText, markers);
    }
View Full Code Here

                ITextFileBuffer fb = bm.getTextFileBuffer(file.getFullPath());
                boolean wasDirty = fb.isDirty();
                IDocument doc = fb.getDocument();
                for (int i = 0; i < markers.length; i++) {
                    PositionTracker tracker = InternalSearchUI.getInstance().getPositionTracker();
                    Match match = markers[i];
                    int offset = match.getOffset();
                    int length = match.getLength();
                    Position currentPosition = tracker.getCurrentPosition(match);
                    if (currentPosition != null) {
                        offset = currentPosition.offset;
                        length = currentPosition.length;
                    }
View Full Code Here

        Assert.isTrue(fMarkers.size() > 0);
        gotoCurrentMarker();
    }

    private void skipFile() {
        Match currentMarker = getCurrentMarker();
        if (currentMarker == null)
            return;
        IResource currentFile = (IResource) currentMarker.getElement();
        while (fMarkers.size() > 0 && getCurrentMarker().getElement().equals(currentFile))
            fMarkers.remove(0);
        gotoCurrentMarker();
    }
View Full Code Here

        gotoCurrentMarker();
    }

    private void gotoCurrentMarker() {
        if (fMarkers.size() > 0) {
            Match marker = getCurrentMarker();
            Control focusControl = getShell().getDisplay().getFocusControl();
            try {
                selectEntry(marker);
                ITextEditor editor = null;
                if (NewSearchUI.reuseEditor())
                    editor = openEditorReuse(marker);
                else
                    editor = openEditorNoReuse(marker);
                Position p = InternalSearchUI.getInstance().getPositionTracker().getCurrentPosition(marker);
                if (p != null)
                    editor.selectAndReveal(p.getOffset(), p.getLength());
                else
                    editor.selectAndReveal(marker.getOffset(), marker.getLength());
                if (focusControl != null && !focusControl.isDisposed())
                    focusControl.setFocus();
            } catch (PartInitException e) {
                String message = Messages.format(SearchMessages.ReplaceDialog_error_unable_to_open_text_editor,
                        ((IFile) marker.getElement()).getName());
                MessageDialog.openError(getParentShell(), getDialogTitle(), message);
            }
        }
    }
View Full Code Here

     */
    private int countResources() {
        IResource r = null;
        int count = 0;
        for (Iterator elements = fMarkers.iterator(); elements.hasNext();) {
            Match element = (Match) elements.next();
            if (!element.getElement().equals(r)) {
                count++;
                r = (IResource) element.getElement();
            }
        }
        return count;
    }
View Full Code Here

    }

    private Match[] collectMarkers(IFile resource) {
        List matching = new ArrayList();
        for (int i = 0; i < fMarkers.size(); i++) {
            Match marker = (Match) fMarkers.get(i);
            if (!resource.equals(marker.getElement()))
                break;
            matching.add(marker);
        }
        Match[] markers = new Match[matching.size()];
        return (Match[]) matching.toArray(markers);
View Full Code Here

    if( !matchedTerms.contains(searchString) && !currentSearchQuery.isFuzzy() ) { // check for exact match on the line
     
      int pos = lcaseLine.indexOf(searchString);
     
      while( pos != -1 ) {
        Match m = new Match(searchString, pos, searchString.length());
        matchLine.add(m, true);
        pos = lcaseLine.indexOf(searchString, pos + searchString.length() - 1);
      }
    }
   
    float matchedTermBoost = 0;
   
    for(String term: matchedTerms) {             
      List<Integer> offsets = terms.get(term);
     
      for(int offset: offsets) {
        int pos = lcaseLine.indexOf(term, offset);
        if( pos == -1 ) continue;
        Match m = new Match(term, pos, term.length());
        matchLine.add(m);
      }
     
      float boost = searchTerms.get(term);
     
View Full Code Here

              getClassLoaderSupport(project).executeCallback(
                  new IProjectClassLoaderSupport.IProjectClassLoaderAwareCallback() {
                    public void doWithActiveProjectClassLoader() throws Throwable {
                      for (IAopReference reference : getMatches(beans, definition,
                          new AspectDefinitionMatcher())) {
                        Match match = new Match(reference, Match.UNIT_LINE, -1, -1);
                        result.addMatch(match);
                      }
                    }
                  });
            }
View Full Code Here

TOP

Related Classes of org.eclipse.search.ui.text.Match

Copyright © 2018 www.massapicom. 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.