Package org.eclipse.jdt.internal.ui.text

Examples of org.eclipse.jdt.internal.ui.text.JavaPresentationReconciler


     * @return the text presentation or <code>null</code>, if reconciliation should be canceled
     */
    public TextPresentation createPresentation(List<?> addedPositions,
            List<?> removedPositions) {
        JavaSourceViewer sourceViewer = _sourceViewer;
        JavaPresentationReconciler presentationReconciler = _presentationReconciler;

        if ((sourceViewer == null) || (presentationReconciler == null)) {
            return null;
        }

        if (isCanceled()) {
            return null;
        }

        IDocument document = sourceViewer.getDocument();

        if (document == null) {
            return null;
        }

        int minStart = Integer.MAX_VALUE;
        int maxEnd = Integer.MIN_VALUE;

        for (int i = 0, n = removedPositions.size(); i < n; i++) {
            HighlightedPosition position = (HighlightedPosition) removedPositions
                    .get(i);
            int offset = position.getOffset();
            minStart = Math.min(minStart, offset);
            maxEnd = Math.max(maxEnd, offset + position.getLength());
        }

        for (int i = 0, n = addedPositions.size(); i < n; i++) {
            HighlightedPosition position = (HighlightedPosition) addedPositions
                    .get(i);
            int offset = position.getOffset();
            minStart = Math.min(minStart, offset);
            maxEnd = Math.max(maxEnd, offset + position.getLength());
        }

        if (minStart < maxEnd) {
            try {
                return presentationReconciler.createRepairDescription(
                        new Region(minStart, maxEnd - minStart), document);
            } catch (RuntimeException e) {
                // Assume concurrent modification from UI thread
            }
        }
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.ui.text.JavaPresentationReconciler

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.