Package org.eclipse.jface.text.link

Examples of org.eclipse.jface.text.link.LinkedPosition


          if (tabGroups[i].equals("carets") || tabGroups[i].equals("0")) {
            int caretCount = tabGroup.getTabStopList().size();
            for (int j = 0; j < caretCount; j++) {
              TabStop ts = tabGroup.getTabStopList().get(j);
              group = new LinkedPositionGroup();
              group.addPosition(new LinkedPosition(doc, start + ts.getStart(), ts.getLength()));
              model.addGroup(group);
              if (j == caretCount - 1) {
                exitPos = start + ts.getStart();
              }             
            }
          } else {
            group = new LinkedPositionGroup();
           
            for (int j = 0; j < tabGroup.getTabStopList().size(); j++) {
              TabStop ts = tabGroup.getTabStopList().get(j);
              group.addPosition(new LinkedPosition(doc, start + ts.getStart(), ts.getLength()));
            }
           
            model.addGroup(group);
          }
        }
View Full Code Here


            throws BadLocationException, BadPositionCategoryException {
        final BracketLevel level = new BracketLevel();
        fBracketLevelStack.push(level);

        final LinkedPositionGroup group = new LinkedPositionGroup();
        group.addPosition(new LinkedPosition(document, offset + 1, 0,
                LinkedPositionGroup.NO_STOP));

        final LinkedModeModel model = new LinkedModeModel();
        model.addLinkingListener(this);
        model.addGroup(group);
View Full Code Here

            try {
                final LinkedModeModel model = new LinkedModeModel();
                int last = 0, i = 0;
                for (final Point offsetAndLength : offsetsAndLengths) {
                    final LinkedPositionGroup group = new LinkedPositionGroup();
                    group.addPosition(new LinkedPosition(document, offsetAndLength.x,
                            offsetAndLength.y, ++i));
                    model.addGroup(group);
                    final int l = offsetAndLength.x + offsetAndLength.y;
                    if (l > last) {
                        last = l;
View Full Code Here

    boolean paired = false;
    try {
      document.replace(offset, length, new String(chars));
      LinkedModeModel model = new LinkedModeModel();
      LinkedPositionGroup group = new LinkedPositionGroup();
      group.addPosition(new LinkedPosition(document, offset + 1, 0, LinkedPositionGroup.NO_STOP));
      model.addGroup(group);
      model.forceInstall();

      LinkedModeUI ui = new LinkedModeUI(model, viewer);
      ui.setCyclingMode(LinkedModeUI.CYCLE_NEVER);
View Full Code Here

   * @param length the length of the {@link LinkedPosition}
   * @throws BadLocationException
   */
  private void addPosition(LinkedModeModel model, IDocument document, int offset, int length) throws BadLocationException {
    final LinkedPositionGroup group = new LinkedPositionGroup();
    group.addPosition(new LinkedPosition(document, offset, length, LinkedPositionGroup.NO_STOP));
    model.addGroup(group);
  }
View Full Code Here

        index--;
      index++;
     
      LinkedModeModel model= LinkedModeModel.getModel(document, offset);
      if (model != null) {
        LinkedPosition linkedPosition= model.findPosition(new LinkedPosition(document, offset, 0));
        if (linkedPosition != null) {
          int linkedPositionEnd= linkedPosition.getOffset() + linkedPosition.getLength();
          int lineOffset;
          try {
            lineOffset= document.getLineInformationOfOffset(offset).getOffset();
            if (offset != linkedPositionEnd && linkedPositionEnd - lineOffset < index)
              index= linkedPositionEnd - lineOffset;
View Full Code Here

      while (index < length && Character.isWhitespace(line.charAt(index)))
        index++;
     
      LinkedModeModel model= LinkedModeModel.getModel(document, offset);
      if (model != null) {
        LinkedPosition linkedPosition= model.findPosition(new LinkedPosition(document, offset, 0));
        if (linkedPosition != null) {
          int linkedPositionOffset= linkedPosition.getOffset();
          int lineOffset;
          try {
            lineOffset= document.getLineInformationOfOffset(offset).getOffset();
            if (offset != linkedPositionOffset && index < linkedPositionOffset - lineOffset)
              index= linkedPositionOffset - lineOffset;
View Full Code Here

        LinkedModeModel model = new LinkedModeModel();
 
        for (int i = 0; i < positions.length; i++) {
          LinkedPositionGroup group = new LinkedPositionGroup();
          Position position = positions[i];
          group.addPosition(new LinkedPosition(viewer.getDocument(), position.getOffset(), position.getLength(), i));
          model.addGroup(group);
        }
        model.forceInstall();

        LinkedModeUI ui = new EditorLinkedModeUI(model, viewer);
View Full Code Here

  private void apply(ITextViewer viewer, char trigger, int stateMask, Position start, Position end, int length) {
    IDocument document = viewer.getDocument();
    LinkedPositionGroup group = new LinkedPositionGroup();
    try {
        group.addPosition(new LinkedPosition(document, start.offset + 1, length, 0)); // offset by 1 for <
        group.addPosition(new LinkedPosition(document, end.offset + 2, length, 1)); // offset by 2 for </
     
      if(viewer instanceof ITextViewerExtension)
        ((ITextViewerExtension) viewer).setRedraw(true);

      LinkedModeModel linkedModeModel = new LinkedModeModel();
View Full Code Here

    try {
        IDOMNode node = (IDOMNode) ContentAssistUtils.getNodeAt(viewer, offset);
        IStructuredDocumentRegion startStructuredDocumentRegion = node.getStartStructuredDocumentRegion();
        ITextRegion region = (startStructuredDocumentRegion == null) ? null : startStructuredDocumentRegion.getRegionAtCharacterOffset(offset);
        if (region != null) {
          group.addPosition(new LinkedPosition(document, startStructuredDocumentRegion.getStartOffset() + region.getStart(), region.getTextLength(), 0));

          if ((region.getType() == DOMRegionContext.XML_TAG_NAME) && (node.getEndStructuredDocumentRegion() != null)) {
            region = node.getEndStructuredDocumentRegion().getRegions().get(1);
            if (region != null) {
              group.addPosition(new LinkedPosition(document, node.getEndStructuredDocumentRegion().getStartOffset() + region.getStart(), region.getTextLength(), 1));
            }
          }
        }
        else {
          IStructuredDocumentRegion endStructuredDocumentRegion = node.getEndStructuredDocumentRegion();
          region = (endStructuredDocumentRegion == null) ? null : endStructuredDocumentRegion.getRegionAtCharacterOffset(offset);
          if (region != null) {
            if ((region.getType() == DOMRegionContext.XML_TAG_NAME) && (node.getStartStructuredDocumentRegion() != null)) {
              ITextRegion startTagNameRegion = node.getStartStructuredDocumentRegion().getRegions().get(1);
              if (region != null) {
                group.addPosition(new LinkedPosition(document, node.getStartStructuredDocumentRegion().getStartOffset() + startTagNameRegion.getStart(), startTagNameRegion.getTextLength(), 0));
                group.addPosition(new LinkedPosition(document, endStructuredDocumentRegion.getStartOffset() + region.getStart(), region.getTextLength(), 1));
              }
            }
            else {
              group.addPosition(new LinkedPosition(document, endStructuredDocumentRegion.getStartOffset() + region.getStart(), region.getTextLength(), 0));
            }
          }
        }

        // TODO CompletionProposalPopup#insertProposal() calls
View Full Code Here

TOP

Related Classes of org.eclipse.jface.text.link.LinkedPosition

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.