Package com.google.collide.client.util

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


      // If this gets more complicated, make it a visitor type thing
      boolean isAlwaysRun = target.getRunMode() == RunMode.ALWAYS_RUN;
      boolean hasClearedCurrentFile = currentFilePath == null;
      boolean hasClearedAlwaysRun = !isAlwaysRun;
      PathUtil alwaysRunPath = isAlwaysRun ? new PathUtil(target.getAlwaysRunFilename()) : null;

      for (int i = 0; (!hasClearedCurrentFile || !hasClearedAlwaysRun) && i < oldNodes.size();
          i++) {
        FileTreeNode node = oldNodes.get(i);
        if (!hasClearedCurrentFile) {
View Full Code Here


    documentManager.getDocument(navigationEvent.getPath(), this);
  }

  @Override
  public void onDocumentReceived(Document document) {
    PathUtil path = DocumentMetadata.getPath(document);

    if (mostRecentNavigationEvent == null || !mostRecentNavigationEvent.isActiveLeaf()
        || !path.equals(mostRecentNavigationEvent.getPath())) {
      // User selected another file or navigated away since this request, ignore
      return;
    }

    openDocument(document, path);
View Full Code Here

  @Override
  public void onUneditableFileContentsReceived(FileContents uneditableFile) {
    showDisplayOnly(uneditableFile);
    WorkspacePlace.PLACE.fireEvent(
        new FileOpenedEvent(false, new PathUtil(uneditableFile.getPath())));
  }
View Full Code Here

  /**
   * Changes the display for an uneditable file.
   */
  private void showDisplayOnly(FileContents uneditableFile) {
    PathUtil filePath = new PathUtil(uneditableFile.getPath());
    if (!filePath.equals(mostRecentNavigationEvent.getPath())) {
      // User selected another file since this request, ignore
      return;
    }

    isSelectedFileEditable = false;

    // Set the tab title to the current open file
    Elements.setCollideTitle(filePath.getBaseName());

    contentArea.setContent(uneditableDisplay);
    uneditableDisplay.displayUneditableFileContents(uneditableFile);
    editorBundle.getBreadcrumbs().setPath(filePath);
  }
View Full Code Here

   * Adds a node to our model from a broadcasted workspace tree mutation.
   */
  private void handleExternalAdd(String newPath, TreeNodeInfo newNode, String newTipId) {

    String ourClientId = BootstrapSession.getBootstrapSession().getActiveClientId();
    PathUtil path = new PathUtil(newPath);
    FileTreeNode rootNode = fileTreeModel.getWorkspaceRoot();

    // If the root is null... then we are receiving mutations before we even got
    // the workspace in the first place. So we should ignore.
    // TODO: This is a potential race. We need to schedule a pending
    // referesh for the tree!!
    if (rootNode == null) {
      Log.warn(getClass(), "Receiving ADD tree mutations before the root node is set for node: "
          + path.getPathString());
      return;
    }

    FileTreeNode existingNode = rootNode.findChildNode(path);
    if (existingNode == null) {
View Full Code Here

      fileTreeModel.dispatchAddNode(existingNode.getParent(), existingNode, newTipId);
    }
  }

  private void handleExternalCopy(String newpath, TreeNodeInfo newNode, String newTipId) {
    PathUtil path = new PathUtil(newpath);
    FileTreeNode rootNode = fileTreeModel.getWorkspaceRoot();

    // If the root is null... then we are receiving mutations before we even got
    // the workspace in the first place. So we should ignore.
    // TODO: This is a potential race. We need to schedule a pending
    // referesh for the tree!!
    if (rootNode == null) {
      Log.warn(getClass(), "Receiving COPY tree mutations before the root node is set for node: "
          + path.getPathString());
      return;
    }

    FileTreeNode installedNode = (FileTreeNode) newNode;
    fileTreeModel.addNode(path, installedNode, newTipId);
View Full Code Here

    // Note that for deletes we do NOT currently optimistically update the UI.
    // So we need to remove the node, even if we triggered said delete.
    JsonArray<PathUtil> pathsToDelete = JsonCollections.createArray();
    for (int i = 0; i < deletedNodes.size(); i++) {
      pathsToDelete.add(new PathUtil(deletedNodes.get(i).getOldPath()));
    }
    fileTreeModel.removeNodes(pathsToDelete, newTipId);
  }
View Full Code Here

    }
    fileTreeModel.removeNodes(pathsToDelete, newTipId);
  }

  private void handleExternalMove(String oldPathStr, String newPathStr, String newTipId) {
    PathUtil oldPath = new PathUtil(oldPathStr);
    PathUtil newPath = new PathUtil(newPathStr);
    FileTreeNode rootNode = fileTreeModel.getWorkspaceRoot();

    // If the root is null... then we are receiving mutations before we even got
    // the workspace in the first place. So we should ignore.
    // TODO: This is a potential race. We need to schedule a pending
View Full Code Here

  }

  public void handleSubtreeReplaced(GetDirectoryResponse response) {
    FileTreeNode incomingSubtree = FileTreeNode.transform(response.getBaseDirectory());
    fileTreeModel.replaceNode(
        new PathUtil(response.getPath()), incomingSubtree, response.getRootId());
    if (PathUtil.WORKSPACE_ROOT.equals(new PathUtil(response.getPath()))) {
      fileTreeModel.maybeSetLastAppliedTreeMutationRevision(response.getRootId());
    }
  }
View Full Code Here

  public void onNodeMoved(
      PathUtil oldPath, FileTreeNode node, PathUtil newPath, FileTreeNode newNode) {
    // if the moved node is currently open in the editor, or is a dir that is
    // somewhere in the path of whatever is open in the editor, then fix the
    // breadcrumbs
    PathUtil editorPath = editorBundle.getBreadcrumbs().getPath();
    if (editorPath == null) {
      return;
    }

    if (oldPath.containsPath(editorPath)) {
      // replace the start of the editor's path with the node's new path
      final PathUtil newEditorPath = PathUtil.concatenate(newPath,
          PathUtil.createExcludingFirstN(editorPath, oldPath.getPathComponentsCount()));

      editorBundle.getBreadcrumbs().setPath(newEditorPath);

      // Wait until DocumentManagerFileTreeModelListener updates the path in the document.
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.