Examples of HighlightedPosition


Examples of org.eclipse.wst.sse.ui.internal.style.SemanticHighlightingManager.HighlightedPosition

    int maxEnd= Integer.MIN_VALUE;
    int i= computeIndexAtOffset(fPositions, region.getOffset()), n= computeIndexAtOffset(fPositions, region.getOffset() + region.getLength());
    if (n - i > 2) {
      List ranges= new ArrayList(n - i);
      for (; i < n; i++) {
        HighlightedPosition position= (HighlightedPosition) fPositions.get(i);
        if (!position.isDeleted()) {
          if (!position.isReadOnly())
            ranges.add(position.createStyleRange());
          else {
            int offset= position.getOffset();
            minStart= Math.min(minStart, offset);
            maxEnd= Math.max(maxEnd, offset + position.getLength());
          }
           
        }
      }
      StyleRange[] array= new StyleRange[ranges.size()];
      array= (StyleRange[]) ranges.toArray(array);
      textPresentation.replaceStyleRanges(array);
    } else {
      for (; i < n; i++) {
        HighlightedPosition position= (HighlightedPosition) fPositions.get(i);
        if (!position.isDeleted()) {
          if (!position.isReadOnly())
            textPresentation.replaceStyleRange(position.createStyleRange());
          else {
            int offset= position.getOffset();
            minStart= Math.min(minStart, offset);
            maxEnd= Math.max(maxEnd, offset + position.getLength());
          }
        }
      }
    }
    if (minStart < maxEnd) {
View Full Code Here

Examples of org.eclipse.wst.sse.ui.internal.style.SemanticHighlightingManager.HighlightedPosition

   *
   * @param highlighting The highlighting
   */
  public void highlightingStyleChanged(HighlightingStyle highlighting) {
    for (int i= 0, n= fPositions.size(); i < n; i++) {
      HighlightedPosition position= (HighlightedPosition) fPositions.get(i);
      if (position.getHighlighting() == highlighting && fSourceViewer instanceof ITextViewerExtension2)
        ((ITextViewerExtension2) fSourceViewer).invalidateTextPresentation(position.getOffset(), position.getLength());
      else
        fSourceViewer.invalidateTextPresentation();
    }
  }
View Full Code Here

Examples of org.eclipse.wst.sse.ui.internal.style.SemanticHighlightingManager.HighlightedPosition

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

        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

Examples of org.eclipse.wst.sse.ui.internal.style.SemanticHighlightingManager.HighlightedPosition

  private void addPosition(Position position, HighlightingStyle highlighting, boolean isReadOnly) {
    boolean isExisting = false;
    // TODO: use binary search
    for (int i = 0, n = fRemovedPositions.size(); i < n; i++) {
      HighlightedPosition highlightedPosition = (HighlightedPosition) fRemovedPositions.get(i);
      if (highlightedPosition == null)
        continue;
      if (highlightedPosition.isEqual(position, highlighting)) {
        isExisting = true;
        fRemovedPositions.set(i, null);
        fNOfRemovedPositions--;
        break;
      }
View Full Code Here

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

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

     * @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

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

        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

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

     *
     * @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

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

                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

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

     * @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
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.