Examples of PositionTracker


Examples of org.eclipse.search2.internal.ui.text.PositionTracker

                bm.connect(file.getFullPath(), new SubProgressMonitor(pm, 1));
                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;
                    }
                    String originalText = doc.get(offset, length);
View Full Code Here

Examples of org.eclipse.search2.internal.ui.text.PositionTracker

    }

    @SuppressWarnings("unchecked")
    private TextChange createFileChange(IFile file, Pattern pattern, Collection/*FileMatch*/matches,
            RefactoringStatus resultingStatus, Collection matchGroups) throws PatternSyntaxException, CoreException {
        PositionTracker tracker = InternalSearchUI.getInstance().getPositionTracker();

        TextFileChange change = new PyTextFileChange(Messages.format(
                SearchMessages.ReplaceRefactoring_group_label_change_for_file, file.getName()), file);
        change.setEdit(new MultiTextEdit());

        ITextFileBufferManager manager = FileBuffers.getTextFileBufferManager();
        manager.connect(file.getFullPath(), LocationKind.IFILE, null);
        try {
            ITextFileBuffer textFileBuffer = manager.getTextFileBuffer(file.getFullPath(), LocationKind.IFILE);
            if (textFileBuffer == null) {
                resultingStatus.addError(Messages.format(SearchMessages.ReplaceRefactoring_error_accessing_file_buffer,
                        file.getName()));
                return null;
            }
            IDocument document = textFileBuffer.getDocument();
            String lineDelimiter = TextUtilities.getDefaultLineDelimiter(document);

            for (Iterator iterator = matches.iterator(); iterator.hasNext();) {
                FileMatch match = (FileMatch) iterator.next();
                int offset = match.getOffset();
                int length = match.getLength();
                Position currentPosition = tracker.getCurrentPosition(match);
                if (currentPosition != null) {
                    offset = currentPosition.offset;
                    if (length != currentPosition.length) {
                        resultingStatus.addError(Messages.format(
                                SearchMessages.ReplaceRefactoring_error_match_content_changed, file.getName()));
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.