Package com.google.collide.client.util

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


    }

    WorkspaceTreeUpdate msg = fileTreeModel.makeEmptyTreeUpdate();
    for (int i = 0, n = nodesToMove.size(); i < n; i++) {
      FileTreeNode nodeToMove = nodesToMove.get(i);
      PathUtil targetPath = new PathUtil.Builder().addPath(parentDirData.getNodePath())
          .addPathComponent(FileTreeUtils.allocateName(
              parentDirData.<DirInfoImpl>cast(), nodeToMove.getName())).build();
      msg.getMutations().add(FileTreeUtils.makeMutation(Mutation.Type.MOVE,
          nodeToMove.getNodePath(), targetPath, nodeToMove.isDirectory(),
          nodeToMove.getFileEditSessionKey()));
View Full Code Here


   * @return the node if it was found, or null if it was not found or if this
   *         node is not a directory
   */
  public final FileTreeNode findChildNode(PathUtil path) {
    FileTreeNode closest = findClosestChildNode(path);
    PathUtil absolutePath = PathUtil.concatenate(getNodePath(), path);
    if (closest == null || !absolutePath.equals(closest.getNodePath())) {
      return null;
    }
    return closest;
  }
View Full Code Here

      Log.warn(getClass(), "Attempting to add a node before the root is set", path);
      return;
    }

    // Find the parent directory of the node.
    final PathUtil parentDirPath = PathUtil.createExcludingLastN(path, 1);
    FileTreeNode parentDir = getWorkspaceRoot().findChildNode(parentDirPath);

    if (parentDir != null && parentDir.isComplete()) {
      // The parent directory is complete, so add the node.
      addNode(parentDir, newNode, workspaceRootId);
View Full Code Here

        // Error already logged.
      }
    };

    // Request the target directory.
    final PathUtil parentDirPath = PathUtil.createExcludingLastN(newPath, 1);
    FileTreeNode parentDir = workspaceRoot.findChildNode(parentDirPath);
    if (parentDir == null || !parentDir.isComplete()) {
      if (oldNode == null) {
        // Early exit if neither the old node nor the target directory is loaded.       
        return;
View Full Code Here

          editor.scrollTo(lineNumber, column);
        }
      });
    } else {
      currentPlace.fireChildPlaceNavigation(FileSelectedPlace.PLACE.createNavigationEvent(
          new PathUtil(path), lineNumber, column, false));
    }
  }
View Full Code Here

      onNodeRemoved(oldParent, node.getRenderedTreeNode());
      // do not kill the back reference (as in onNodeRemoved)!
    }

    if (newNode != null) {
      PathUtil parentDirPath = PathUtil.createExcludingLastN(newPath, 1);
      onNodeAdded(parentDirPath, newNode);
    }
  }
View Full Code Here

      }

      private void prepareForDraggingToOutside(
          TreeNodeElement<FileTreeNode> node, DragEvent event) {
        FileTreeNode fileTreeNode = node.getData();
        PathUtil nodePath = fileTreeNode.getNodePath();

        String downloadFileName = fileTreeNode.isDirectory() ? nodePath.getBaseName() + ".zip"
            : nodePath.getBaseName();

        Location location = elemental.client.Browser.getWindow().getLocation();
        String urlHttpHostPort = location.getProtocol() + "//" + location.getHost();

        String downloadUrl = "application/octet-stream:" + downloadFileName + ":"
View Full Code Here

    return null;
  }

  @VisibleForTesting
  FileTreeNode findFileNode(String displayPath) {
    PathUtil lookupPath = new PathUtil(displayPath);
    if (!displayPath.startsWith("/")) {
      PathUtil contextDir = PathUtil.createExcludingLastN(new PathUtil(contextPath), 1);
      lookupPath = PathUtil.concatenate(contextDir, lookupPath);
    }
    return fileTreeModel.getWorkspaceRoot().findChildNode(lookupPath);
  }
View Full Code Here

  /**
   * Sets the path and type that these breadcrumbs display.
   */
  public void setPath(ConflictedPath conflictedPath) {
    PathUtil newPath = new PathUtil(conflictedPath.getPath());
    JsonArray<Breadcrumb> newFilePath = JsonCollections.createArray();
    for (int i = 0, n = newPath.getPathComponentsCount(); i < n; i++) {
      if (i == n - 1 && conflictedPath.getNodeType() == TreeNodeInfo.FILE_TYPE) {
        newFilePath.add(getView().createBreadcrumb(newPath.getPathComponent(i), PathType.FILE));
      } else {
        newFilePath.add(getView().createBreadcrumb(newPath.getPathComponent(i), PathType.FOLDER));
      }
    }
    currentFilePath = newPath;
    changeBreadcrumbPath(newFilePath);
  }
View Full Code Here

      RunTarget currentTarget = targetPopup.getRunTarget();
      if (currentTarget == null || currentTarget.getAlwaysRunFilename() == null) {
        return;
      }

      PathUtil currentAlwaysRunPath = new PathUtil(currentTarget.getAlwaysRunFilename());
      PathUtil relativePath = currentAlwaysRunPath.makeRelativeToParent(oldPath);
      if (relativePath != null) {
        // Either this node, or some ancestor node got renamed.
        PathUtil newFilePath = PathUtil.concatenate(newPath, relativePath);
        RunTargetImpl impl = (RunTargetImpl) currentTarget;
        impl.setAlwaysRunFilename(newFilePath.getPathString());
        targetPopup.setRunTarget(impl);
      }
    }
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.