Package com.google.collide.shared.document

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


  private static void checkAutoindenter(String text, int line1, int column1, int line2, int column2,
      final SignalEvent trigger, String expected, boolean allowScheduling) {
    PathUtil path = new PathUtil("test.py");
    TestUtils.MockIncrementalScheduler parseScheduler = new TestUtils.MockIncrementalScheduler();
    Document document = Document.createFromString(text);
    DocumentParser documentParser = createDocumentParser(path, true, parseScheduler, document);
    Editor editor = Editor.create(new MockAppContext());
    editor.setDocument(document);

    documentParser.begin();
View Full Code Here


    return TestUtils.BUILD_MODULE_NAME;
  }

  public void testCreate() {
    context = new MockAppContext();
    Document document = Document.createEmpty();
    IncomingDocOpDemultiplexer demux =
        IncomingDocOpDemultiplexer.create(context.getMessageFilter());
    DocumentCollaborationController controller = new DocumentCollaborationController(
        context, model, demux, document, JsonCollections.<DocumentSelection> createArray());
  }
View Full Code Here

    this.revisionBefore = revisionBefore;
    this.revisionAfter = revisionAfter;

    this.path = path;

    Document beforeDoc = Document.createEmpty();
    Document afterDoc = Document.createEmpty();

    DiffRenderer beforeRenderer = new DiffRenderer(beforeDoc, appContext.getResources(), true);
    DiffRenderer afterRenderer = new DiffRenderer(afterDoc, appContext.getResources(), false);

    for (int i = 0, n = diffChunks.size(); i < n; i++) {
View Full Code Here

   * @see #notifyForDocuments(Callback, int...)
   */
  public boolean notifyForFiles(Callback callback, String... fileEditSessionKeys) {
    int[] documentIds = new int[fileEditSessionKeys.length];
    for (int i = 0; i < documentIds.length; i++) {
      Document document = documentManager.getDocumentByFileEditSessionKey(fileEditSessionKeys[i]);
      Preconditions.checkNotNull(document,
          "Document for given fileEditSessionKey [" + fileEditSessionKeys[i] + "] does not exist");

      documentIds[i] = document.getId();
    }

    return notifyForDocuments(callback, documentIds);
  }
View Full Code Here

  public Document getDocumentByFileEditSessionKey(String fileEditSessionKey) {
    return documentsByFileEditSessionKey.get(fileEditSessionKey);
  }
 
  public void attachToEditor(final Document document, final Editor editor) {
    final Document oldDocument = editor.getDocument();
    if (oldDocument != null) {
      detachFromEditor(editor, oldDocument);
    }

    this.editor = editor;
View Full Code Here

    if (fileTreeModel.getWorkspaceRoot() != null) {
      // FileTreeModel is populated so get the file edit session key for this path
      FileTreeNode node = fileTreeModel.getWorkspaceRoot().findChildNode(path);
      if (node != null && node.getFileEditSessionKey() != null) {
        String fileEditSessionKey = node.getFileEditSessionKey();
        Document document = documentsByFileEditSessionKey.get(fileEditSessionKey);
        if (document != null) {
          callback.onDocumentReceived(document);
          return;
        }
      }
View Full Code Here

    /*
     * One last check to make sure we don't already have a Document for this
     * file
     */
    Document document = documentsByFileEditSessionKey.get(fileContents.getFileEditSessionKey());
    if (document == null) {
      document = createDocument(fileContents.getContents(), new PathUtil(fileContents.getPath()),
          fileContents.getFileEditSessionKey(), fileContents.getCcRevision(),
          fileContents.getConflicts(), fileContents.getConflictHandle(), fileContents);
      tryGarbageCollect();
View Full Code Here

   */
  private Document createDocument(String contents, PathUtil path, String fileEditSessionKey,
      int ccRevision, JsonArray<ConflictChunk> conflicts, ConflictHandle conflictHandle,
      final FileContents fileContents) {

    final Document document = Document.createFromString(contents);

    documents.add(document);

    boolean isLinkedToFile = fileEditSessionKey != null;
    if (isLinkedToFile) {
View Full Code Here

  }

  private void tryGarbageCollect() {
    int removeCount = documents.size() - MAX_CACHED_DOCUMENTS;
    for (int i = 0; i < documents.size() && removeCount > 0;) {
      Document document = documents.get(i);

      boolean documentIsOpen = editor != null && editor.getDocument() == document;
      if (documentIsOpen) {
        i++;
        continue;
View Full Code Here

  public void onNodeMoved(
      PathUtil oldPath, FileTreeNode node, PathUtil newPath, FileTreeNode newNode) {
    // Update the document path if the document exists.
    String fileEditSessionKey = (node == null) ? null : node.getFileEditSessionKey();
    if (fileEditSessionKey != null) {
      Document document = documentManager.getDocumentByFileEditSessionKey(fileEditSessionKey);
      if (document != null) {
        DocumentMetadata.putPath(document, newPath);
        return;
      }
    }
View Full Code Here

TOP

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

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.