Package ptolemy.backtrack.eclipse.plugin.editor.SemanticHighlightingReconciler

Examples of ptolemy.backtrack.eclipse.plugin.editor.SemanticHighlightingReconciler.HighlightedPosition


        if ((n - i) > 2) {
            List<StyleRange> ranges = new ArrayList<StyleRange>(n - i);

            for (; i < n; i++) {
                HighlightedPosition position = _positions.get(i);

                if (!position.isDeleted()) {
                    ranges.add(position.createStyleRange());
                }
            }

            StyleRange[] array = new StyleRange[ranges.size()];
            array = (StyleRange[]) ranges.toArray(array);
            textPresentation.replaceStyleRanges(array);
        } else {
            for (; i < n; i++) {
                HighlightedPosition position = _positions.get(i);

                if (!position.isDeleted()) {
                    textPresentation.replaceStyleRange(position
                            .createStyleRange());
                }
            }
        }
    }
View Full Code Here


     * @return The new highlighted position
     */
    public HighlightedPosition createHighlightedPosition(int offset,
            int length, HighlightingStyle highlighting) {
        // TODO: reuse deleted positions
        return new HighlightedPosition(offset, length, highlighting,
                _positionUpdater);
    }
View Full Code Here

        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(
View Full Code Here

     *
     * @param highlighting The highlighting
     */
    public void highlightingStyleChanged(HighlightingStyle highlighting) {
        for (int i = 0, n = _positions.size(); i < n; i++) {
            HighlightedPosition position = _positions.get(i);

            if (position.getHighlighting() == highlighting) {
                _sourceViewer.invalidateTextPresentation(position.getOffset(),
                        position.getLength());
            }
        }
    }
View Full Code Here

                List<HighlightedPosition> oldPositions = _positions;
                int newSize = (_positions.size() + addedPositions.length)
                        - removedPositions.length;
                List<HighlightedPosition> newPositions = new ArrayList<HighlightedPosition>(
                        newSize);
                HighlightedPosition position = null;
                HighlightedPosition addedPosition = null;

                for (int i = 0, j = 0, n = oldPositions.size(), m = addedPositions.length; (i < n)
                        || (position != null)
                        || (j < m)
                        || (addedPosition != null);) {
                    while ((position == null) && (i < n)) {
                        position = oldPositions.get(i++);

                        if (position.isDeleted()
                                || _contain(removedPositionsList, position)) {
                            document.removePosition(positionCategory, position);
                            position = null;
                        }
                    }

                    if ((addedPosition == null) && (j < m)) {
                        addedPosition = addedPositions[j++];
                        document.addPosition(positionCategory, addedPosition);
                    }

                    if (position != null) {
                        if (addedPosition != null) {
                            if (position.getOffset() <= addedPosition
                                    .getOffset()) {
                                newPositions.add(position);
                                position = null;
                            } else {
                                newPositions.add(addedPosition);
View Full Code Here

     * @param length The range length
     * @param highlighting
     */
    private void _addPositionFromUI(int offset, int length,
            HighlightingStyle highlighting) {
        HighlightedPosition position = createHighlightedPosition(offset,
                length, highlighting);

        synchronized (_positionLock) {
            _insertPosition(position);
        }
View Full Code Here

        int i = -1;
        int j = positions.size();

        while ((j - i) > 1) {
            int k = (i + j) >> 1;
            HighlightedPosition position = positions.get(k);

            if (position.getOffset() > offset) {
                j = k;
            } else {
                i = k;
            }
        }
View Full Code Here

        int i = -1;
        int j = positions.size();

        while ((j - i) > 1) {
            int k = (i + j) >> 1;
            HighlightedPosition position = positions.get(k);

            if (position.getOffset() >= offset) {
                j = k;
            } else {
                i = k;
            }
        }
View Full Code Here

    /**
     * Invalidate text presentation of all positions.
     */
    private void _invalidateTextPresentation() {
        for (int i = 0, n = _positions.size(); i < n; i++) {
            HighlightedPosition position = _positions.get(i);
            _sourceViewer.invalidateTextPresentation(position.getOffset(),
                    position.getLength());
        }
    }
View Full Code Here

            try {
                Position[] positions = event.getDocument().getPositions(
                        _category);

                for (int i = 0; i != positions.length; i++) {
                    HighlightedPosition position = (HighlightedPosition) positions[i];

                    // Also update deleted positions because they get deleted by the background thread and removed/invalidated only in the UI runnable
                    //                  if (position.isDeleted())
                    //                      continue;
                    int offset = position.getOffset();
                    int length = position.getLength();
                    int end = offset + length;

                    if (offset > eventEnd) {
                        updateWithPrecedingEvent(position, event);
                    } else if (end < eventOffset) {
View Full Code Here

TOP

Related Classes of ptolemy.backtrack.eclipse.plugin.editor.SemanticHighlightingReconciler.HighlightedPosition

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.