Package com.google.collide.shared.document.anchor

Examples of com.google.collide.shared.document.anchor.Anchor


    final int l = nodes.size();
    if (l > 0) {
      AnchorManager anchorManager =
          nodes.get(0).getAnchor().getLine().getDocument().getAnchorManager();
      for (int i = 0; i < l; i++) {
        Anchor anchor = nodes.get(i).getAnchor();
        if (anchor.isAttached()) {
          anchorManager.removeAnchor(anchor);
        }
      }
    }
  }
View Full Code Here


    if (nameColumn < 0) {
      nameColumn = text.lastIndexOf(itemName);
    }
    if (nameColumn >= 0) {
      node.setEnabled(true);
      Anchor anchor = anchorManager.createAnchor(
          OUTLINE_NODE_ANCHOR_TYPE, line, IGNORE_LINE_NUMBER, nameColumn);
      node.setAnchor(anchor);
    }
  }
View Full Code Here

      debuggingSidebar.addBreakpoint(allBreakpoints.get(i));
    }
  }

  private void anchorBreakpointAndUpdateSidebar(Breakpoint breakpoint) {
    Anchor anchor = breakpoints.anchorBreakpoint(breakpoint);
    debuggingSidebar.updateBreakpoint(breakpoint, anchor.getLine().getText());
  }
View Full Code Here

    document.getAnchorManager().removeAnchor(lineExecutionAnchor);
  }

  private static Anchor createExecutionLineAnchor(Document document, int lineNumber) {
    LineInfo lineInfo = document.getLineFinder().findLine(lineNumber);
    Anchor anchor = document.getAnchorManager().createAnchor(EXECUTION_LINE_ANCHOR_TYPE,
        lineInfo.line(), lineInfo.number(), AnchorManager.IGNORE_COLUMN);
    anchor.setRemovalStrategy(Anchor.RemovalStrategy.SHIFT);
    return anchor;
  }
View Full Code Here

    String text = line.getText();
    String itemName = node.getName();
    int nameColumn = text.indexOf(itemName, node.getColumn());
    if (nameColumn >= 0) {
      node.setEnabled(true);
      Anchor anchor = anchorManager.createAnchor(
          OUTLINE_NODE_ANCHOR_TYPE, line, IGNORE_LINE_NUMBER, nameColumn);
      node.setAnchor(anchor);
    }
  }
View Full Code Here

  }
 
  @Override
  public void onNodeAction(TreeNodeElement<OutlineNode> node) {
    OutlineNode data = node.getData();
    Anchor anchor = data.getAnchor();
    if (anchor == null) {
      return;
    }
    if (anchor.isAttached()) {
      // TODO: check that item is still there,
      //               see comments in OutlineNodeBuilder.
      Line line = anchor.getLine();
      if (line.getText().contains(data.getName())) {
        editor.getFocusManager().focus();
        LineFinder lineFinder = editor.getDocument().getLineFinder();
        editor.scrollTo(lineFinder.findLine(line).number(), anchor.getColumn());
        return;
      }
    }
    // If we didn't find what we were looking for, then:
    // 1) render node as disabled
View Full Code Here

    }
  }

  static void assertAnchorPositions(Object... anchorAndLineNumbersAndColumnsAlternating) {
    for (int i = 0; i < anchorAndLineNumbersAndColumnsAlternating.length; i++) {
      Anchor anchor = (Anchor) anchorAndLineNumbersAndColumnsAlternating[i];
      int lineNumber = (Integer) anchorAndLineNumbersAndColumnsAlternating[++i];
      int column = (Integer) anchorAndLineNumbersAndColumnsAlternating[++i];

      assertEquals(lineNumber, anchor.getLineNumber());
      assertEquals(column, anchor.getColumn());
    }
  }
View Full Code Here

    }
  }

  static void assertAnchorLineNumbers(Object... anchorAndLineNumbersAlternating) {
    for (int i = 0; i < anchorAndLineNumbersAlternating.length; i++) {
      Anchor anchor = (Anchor) anchorAndLineNumbersAlternating[i];
      int lineNumber = (Integer) anchorAndLineNumbersAlternating[++i];

      assertEquals(lineNumber, anchor.getLineNumber());
    }
  }
View Full Code Here

    }
  }

  static void assertAnchorColumns(Object... anchorAndColumnsAlternating) {
    for (int i = 0; i < anchorAndColumnsAlternating.length; i++) {
      Anchor anchor = (Anchor) anchorAndColumnsAlternating[i];
      int column = (Integer) anchorAndColumnsAlternating[++i];

      assertEquals(column, anchor.getColumn());
    }
  }
View Full Code Here

   * Verify we can walk the anchors in order.
   */
  public void testSimpleTraversal() {
    AnchorList anchorList = anchorManager.getAnchors(doc.getFirstLine());
    assertEquals(2, anchorList.size());
    Anchor anchor = anchorList.get(0);

    for (Anchor a : anchors) {
      assertSame(anchor, a);
      anchor = anchorManager.getNextAnchor(anchor);
    }
View Full Code Here

TOP

Related Classes of com.google.collide.shared.document.anchor.Anchor

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.