Package org.eclipse.jface.text.link

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


    if (position == null || !fDocument.equals(position.getDocument()))
      // position is not valid if not in this document
      position= null;

    LinkedPosition exit= fExitPosition;
    if (exit == null || !fDocument.equals(exit.getDocument()))
      // position is not valid if not in this document
      exit= null;


    if (exit != null) {
View Full Code Here


   *
   * @param list the list of positions to prune
   */
  private void prune(List list) {
    for (Iterator iter= list.iterator(); iter.hasNext();) {
      LinkedPosition pos= (LinkedPosition) iter.next();
      if (!pos.getDocument().equals(fDocument))
        iter.remove();
    }
  }
View Full Code Here

    }

    // index == -1

    // find the position that follows closest to the current position
    LinkedPosition found= null;
    for (Iterator it= fList.iterator(); it.hasNext(); ) {
      LinkedPosition p= (LinkedPosition) it.next();
      if (p.offset > current.offset)
        if (found == null || found.offset > p.offset)
          found= p;
    }
View Full Code Here

    }

    // index == -1

    // find the position that follows closest to the current position
    LinkedPosition found= null;
    for (Iterator it= fList.iterator(); it.hasNext(); ) {
      LinkedPosition p= (LinkedPosition) it.next();
      if (p.offset < current.offset)
        if (found == null || found.offset < p.offset)
          found= p;
    }
    if (found != null) {
View Full Code Here

     *
     * <p><code>o1</code> and <code>o2</code> are required to be instances
     * of <code>LinkedPosition</code>.</p>
     */
    public int compare(Object o1, Object o2) {
      LinkedPosition p1= (LinkedPosition)o1;
      LinkedPosition p2= (LinkedPosition)o2;
      int i= p1.getSequenceNumber() - p2.getSequenceNumber();
      if (i != 0)
        return i;
      return p1.getOffset() - p2.getOffset();
    }
View Full Code Here

        LinkedPositionGroup group= new LinkedPositionGroup();

        int[] offsets= variable.getOffsets();
        int length= variable.getLength();

        LinkedPosition first;
        {
          String[] values= variable.getValues();
          ICompletionProposal[] proposals= new ICompletionProposal[values.length];
          for (int j= 0; j < values.length; j++) {
            ensurePositionCategoryInstalled(document, model);
            Position pos= new Position(offsets[0] + start, length);
            document.addPosition(getCategory(), pos);
            proposals[j]= new PositionBasedCompletionProposal(values[j], pos, length);
          }
         
          if (proposals.length > 1)
            first= new ProposalPosition(document, offsets[0] + start, length, proposals);
          else
            first= new LinkedPosition(document, offsets[0] + start, length);
        }

        for (int j= 0; j != offsets.length; j++)
          if (j == 0)
            group.addPosition(first);
          else
            group.addPosition(new LinkedPosition(document, offsets[j] + start, length));

        model.addGroup(group);
        hasPositions= true;
      }
View Full Code Here

          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

  public static void renameHtmlTag(FuzzyXMLElement element, ITextViewer htmlViewer, final WodParserCache cache) throws BadLocationException {
    IDocument htmlDocument = htmlViewer.getDocument();
    LinkedModeModel.closeAllModels(htmlDocument);
    LinkedPositionGroup linkedGroup = new LinkedPositionGroup();

    linkedGroup.addPosition(new LinkedPosition(htmlDocument, element.getOffset() + element.getNameOffset() + 1, element.getNameLength(), 0));
    if (element.hasCloseTag()) {
      linkedGroup.addPosition(new LinkedPosition(htmlDocument, element.getCloseTagOffset() + element.getCloseNameOffset() + 1, element.getCloseNameLength(), 1));
    }

    QuickRenameRefactoring.enterLinkedMode(linkedGroup, cache, htmlViewer);
  }
View Full Code Here

      FuzzyXMLElement woElement = (FuzzyXMLElement) woTag;
      FuzzyXMLAttribute woNameAttr = woElement.getAttributeNode("name");
      if (woNameAttr != null) {
        int offset = woElement.getOffset() + woNameAttr.getValueDataOffset() + 1;
        int length = woNameAttr.getValueDataLength();
        linkedGroup.addPosition(new LinkedPosition(htmlDocument, offset, length, sequence++));
      }
    }
    return sequence;
  }
View Full Code Here

    IWodModel wodModel = cache.getWodEntry().getModel();
    IWodElement wodElement = wodModel.getElementNamed(woElementName);
    if (wodElement != null) {
      Position namePosition = wodElement.getElementNamePosition();
      if (namePosition != null) {
        linkedGroup.addPosition(new LinkedPosition(wodDocument, namePosition.getOffset(), namePosition.getLength(), sequence++));
      }
    }
    return sequence;
  }
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.