Package com.google.collide.client.util

Examples of com.google.collide.client.util.PathUtil


    checkAutoindenter(text, 2, 2, 2, 2, AutoindenterTest.TRIGGER_ENTER, expected, false);
  }

  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);
View Full Code Here


    FileTreeModel model = getFileTree(buildComplexTree());
    indexer.setFileTreeModel(model);

    // Verify that two results are returned from two different directories
    JsonArray<PathUtil> results =
        indexer.getMatchesRelativeToPath(new PathUtil("/src"), regex("hello"), 2);
    assertEquals(1, results.size());

    // Returns the proper two files
    assertContainsPaths(ImmutableList.of("/src/hello.html"), results);
  }
View Full Code Here

        .setStartLineNumber(0)
        .setStartColumn(0)
        .setEndLineNumber(3)
        .setEndColumn(0);

    CodeFile codeFile = new CodeFile(new PathUtil("/foobar.js"));
    codeFile.setRootCodeBlock(fileCodeBlock);
    assertEquals(1, codeFile.getRootScope().getSubscopes().size());
    assertEquals(2, codeFile.getRootScope().getSubscopes().get(0).getSubscopes().size());

    assertScopeBounds(0, 0, 3, 0, codeFile.getRootScope());
View Full Code Here

        .setStartLineNumber(0)
        .setStartColumn(0)
        .setEndLineNumber(5)
        .setEndColumn(0);

    CodeFile codeFile = new CodeFile(new PathUtil("/foobar.js"));
    codeFile.setRootCodeBlock(fileCodeBlock);
    assertEquals(2, codeFile.getRootScope().getSubscopes().size());
    assertEquals(1, codeFile.getRootScope().getSubscopes().get(0).getSubscopes().size());

    assertScopeBounds(0, 0, 5, 0, codeFile.getRootScope());
View Full Code Here

  private void checkCommentSelection(
      String text, String expected, int line1, int column1, int line2, int column2,
      int expectedLine1, int expectedColumn1, int expectedLine2, int expectedColumn2) {
    MockAutocompleterEnvironment helper = new MockAutocompleterEnvironment();
    helper.setup(new PathUtil("test.js"), text, line1, column1, false);
    final Editor editor = helper.editor;
    editor.getInput().getActionExecutor().addDelegate(
        LanguageHelperResolver.getHelper(SyntaxType.JS).getActionExecutor());
    LineFinder lineFinder = editor.getDocument().getLineFinder();
    editor.getSelection().setSelection(
View Full Code Here

   */
  private void handleFileReceived(GetFileContentsResponse response) {
    boolean isUneditable =
        (response.getFileContents().getContentType() == ContentType.UNKNOWN_BINARY)
        || (response.getFileContents().getContentType() == ContentType.IMAGE);
    PathUtil path = new PathUtil(response.getFileContents().getPath());

    cancelLoadingMessage();

    JsonArray<GetDocumentCallback> callbacks = outstandingCallbacks.remove(path.getPathString());
    Preconditions.checkNotNull(callbacks);

    if (!response.getFileExists()) {
      // Dispatch to callbacks directly
      for (int i = 0, n = callbacks.size(); i < n; i++) {
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();
    } else {
      /*
       * Ensure we have the latest path stashed in the metadata. One case where
       * this matters is if a file is renamed, we will have had the old path --
       * this logic will update its path.
       */
      DocumentMetadata.putPath(document, new PathUtil(fileContents.getPath()));
    }

    for (int i = 0, n = callbacks.size(); i < n; i++) {
      callbacks.get(i).onDocumentReceived(document);
    }
View Full Code Here

    JsonArray<Document> documents = documentManager.getDocuments();
    JsonArray<Pair<Document, Editor>> openDocuments = documentManager.getOpenDocuments();

    for (int k = 0; k < oldNodes.size(); k++) {
      // Note that this can be a parent directory
      PathUtil removedPath = oldNodes.get(k).getNodePath();

      for (int i = 0, n = documents.size(); i < n; i++) {
        Document document = documents.get(i);

        if (DocumentMetadata.isLinkedToFile(document)) {
          PathUtil path = DocumentMetadata.getPath(document);
          if (path == null || !removedPath.containsPath(path)) {
            continue;
          }

          updateEditorsForFileInvalidated(document, openDocuments, false);
View Full Code Here

  @Override
  public void onNodeReplaced(FileTreeNode oldNode, FileTreeNode newNode) {
    JsonArray<Document> documents = documentManager.getDocuments();
    JsonArray<Pair<Document, Editor>> openDocuments = documentManager.getOpenDocuments();
    PathUtil nodePath = newNode.getNodePath();

    for (int i = 0, n = documents.size(); i < n; i++) {
      Document document = documents.get(i);
      if (DocumentMetadata.isLinkedToFile(document) && nodePath.containsPath(
          DocumentMetadata.getPath(document))) {
        updateEditorsForFileInvalidated(document, openDocuments, true);
      }
    }
  }
View Full Code Here

    contentArea.setLocationBreadcrumbsVisibility(false);
    fileHistory.setup(contentArea.getView().getHeaderElement());
    contentArea.getEditorToolBar().hide();

    /* Get file contents and diff */
    PathUtil filePath = navigationEvent.getPath();
    fileHistory.setPath(filePath);
    timeline.setPath(filePath);
    timeline.setLoading();
    api.getFileRevisions(filePath, navigationEvent.getRootId());
  }
View Full Code Here

TOP

Related Classes of com.google.collide.client.util.PathUtil

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.