Package com.google.collide.shared.document

Examples of com.google.collide.shared.document.LineInfo


    AnchorType topType = AnchorType.create(EditorTests.class, "top");

    Document doc = Document.createFromString("qwerty\nasdfgh\nzxcvbn\n");
    LineFinder lineFinder = doc.getLineFinder();
    AnchorManager anchorManager = doc.getAnchorManager();
    LineInfo lineInfo = lineFinder.findLine(1);

    Editor editor = Editor.create(new MockAppContext());
    editor.setDocument(doc);

    Anchor topAnchor = anchorManager.createAnchor(topType, lineInfo.line(), lineInfo.number(),
        AnchorManager.IGNORE_COLUMN);
    topAnchor.setRemovalStrategy(Anchor.RemovalStrategy.SHIFT);
    topAnchor.setInsertionPlacementStrategy(InsertionPlacementStrategy.EARLIER);

    Anchor bottomAnchor = anchorManager.createAnchor(bottomType, lineInfo.line(), lineInfo.number(),
        AnchorManager.IGNORE_COLUMN);
    bottomAnchor.setRemovalStrategy(Anchor.RemovalStrategy.SHIFT);
    bottomAnchor.setInsertionPlacementStrategy(InsertionPlacementStrategy.LATER);

    SelectionModel selection = editor.getSelection();
View Full Code Here


    expectLastCall().times(2);
    expect(mockMatchManager.getTotalMatches()).andReturn(8).times(2);
    mockMatchManager.setSearchPattern(anyObject(RegExp.class));

    // Mocking the behavior of addMatches is a bit more difficult...
    LineInfo lineSixInfo = gotoLineInfo(document, 6);
    LineInfo lineEightInfo = gotoLineInfo(document, 8);
    mockMatchManager.addMatches(lineSixInfo, 1);
    mockMatchManager.addMatches(lineEightInfo, 7);
    mockMatchManager.addMatches(not(or(eq(lineSixInfo), eq(lineEightInfo))), eq(0));
    expectLastCall().times(10);
    replay(mockMatchManager);
View Full Code Here

        analyzer.onLinesDeleted(deletedLines);
      }
    });

    LineFinder lineFinder = document.getLineFinder();
    LineInfo line2 = lineFinder.findLine(2);
    LineInfo line4 = lineFinder.findLine(4);
    String textToDelete = LineUtils.getText(line2.line(), 0, line4.line(), 0);
    helper.editor.getEditorDocumentMutator().deleteText(line2.line(), 2, 0, textToDelete.length());
    remover.remove();

    JsonArray<IncrementalScheduler.Task> parseRequests = helper.parseScheduler.requests;
    assertEquals("reparse scheduled", 1, parseRequests.size());
View Full Code Here

    callback.onMatchCountChanged(0);
    replay(callback);
   
    manager.getMatchCountChangedListenerRegistrar().add(callback);
   
    LineInfo line = document.getFirstLineInfo();
    manager.addMatches(line, 10);
    manager.addMatches(line, 5);
    manager.clearMatches();
  }
View Full Code Here

  public void testAddGetAndClearMatches() {
    SearchMatchManager manager = createMatchManager(document, model);
    manager.setSearchPattern(RegExp.compile("testing"));

    LineInfo line = document.getFirstLineInfo();
    manager.addMatches(line, 5);

    line.moveToNext();
    manager.addMatches(line, 5);

    line.moveToNext();
    manager.addMatches(line, 5);

    line.moveToNext();
    manager.addMatches(line, 5);

    assertEquals(20, manager.getTotalMatches());

    manager.clearMatches();
View Full Code Here

  public void testSelectMatchOnAddMatches() {
    SearchMatchManager manager = createMatchManager(document, model);
    manager.setSearchPattern(RegExp.compile("do"));

    // Should end up only selecting the first match in line 0
    LineInfo line = document.getFirstLineInfo();
    manager.addMatches(line, 3);
    assertSelection(document.getFirstLineInfo(), 5, 7);

    line.moveToNext();
    manager.addMatches(line, 2);
    assertSelection(document.getFirstLineInfo(), 5, 7);
  }
View Full Code Here

    manager.addMatches(line, 2);
    assertSelection(document.getFirstLineInfo(), 5, 7);
  }

  public void testFindNextMatchOnLine() {
    LineInfo lineEight = SearchTestsUtil.gotoLineInfo(document, 8);

    SearchMatchManager manager = createMatchManager(document, model);
    manager.setSearchPattern(RegExp.compile("doug", "gi"));

    // Select the first match then move forward two
View Full Code Here

    manager.selectNextMatch();
    assertSelection(lineEight, 13, 17);
  }

  public void testFindPreviousMatchOnLine() {
    LineInfo lineEight = SearchTestsUtil.gotoLineInfo(document, 8);

    SearchMatchManager manager = createMatchManager(document, model);
    manager.setSearchPattern(RegExp.compile("doug", "gi"));

    // Select the first match then move forward two
View Full Code Here

    manager.selectPreviousMatch();
    assertSelection(lineEight, 0, 4);
  }

  public void testFindPreviousMatchOnPreviousLine() {
    LineInfo lineSix = SearchTestsUtil.gotoLineInfo(document, 6);
    LineInfo lineEight = SearchTestsUtil.gotoLineInfo(document, 8);

    SearchMatchManager manager = createMatchManager(document, model);
    manager.setSearchPattern(RegExp.compile("doug", "gi"));

    manager.addMatches(lineEight, 7);
View Full Code Here

    manager.selectPreviousMatch();
    assertSelection(lineEight, 35, 39);
  }

  public void testFindNextMatchOnNextLine() {
    LineInfo lineSix = SearchTestsUtil.gotoLineInfo(document, 6);
    LineInfo lineEight = SearchTestsUtil.gotoLineInfo(document, 8);

    SearchMatchManager manager = createMatchManager(document, model);
    manager.setSearchPattern(RegExp.compile("doug", "gi"));

    manager.addMatches(lineSix, 1);
View Full Code Here

TOP

Related Classes of com.google.collide.shared.document.LineInfo

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.