Package java.nio.file

Examples of java.nio.file.Path


    return true;
  }
 
 
  public static String getModuleFQNameFromFilePath(String packagePath, String fileName) {
    Path path = MiscUtil.createPathOrNull(packagePath + "/" + fileName);
    if(path == null) {
      return null;
    }
   
    ModuleFullName moduleValidName = getValidModuleNameOrNull(path);
View Full Code Here


        if(dir == importFolder) {
          return FileVisitResult.CONTINUE;
        }
       
        assertTrue(dir.startsWith(importFolder));
        Path relPath = importFolder.relativize(dir);
        if(ModuleNamingRules.isValidPackageNameSegment(relPath.getFileName().toString())) {
          return FileVisitResult.CONTINUE;
        }
        return FileVisitResult.SKIP_SUBTREE;
      }
     
View Full Code Here

    });
  }
 
  protected void visitPotentialModuleFile(Path fullPath, Path importFolder) {
    assertTrue(fullPath.isAbsolute());
    Path relPath = importFolder.relativize(fullPath);
    ModuleFullName moduleFullName = ModuleNamingRules.getValidModuleNameOrNull(relPath);
    if(moduleFullName != null) {
      assertTrue(fullPath.isAbsolute());
      addModuleEntry(moduleFullName, fullPath);
    }
View Full Code Here

    p.getConfiguration().setConnectTimeoutMillis(20000);

    /*
     * get the path of the location for storage
     */
    Path path = null;
    if (pp.getStorage() == null)
      path = Paths.get("storage", "node_data", p.getP2PID() + "");
    else
      path = new File(pp.getStorage()).toPath();
    /*
     * and clean, if new session started and data should be zero
     */
    if (pp.isUsingEmptyStorage()) {
      logger.info("Cleaning storage folder...");
      deleteDirectory(path.toFile());
    }
    /*
     * create directory
     */

    final Peer peer = p;

    if (pp.isUsingStorage()) {
      /*
       * init the storage
       */
      Files.createDirectories(path);
      String file = path.toString();
      StorageGeneric storage = new StorageDisk(file);
      peer.getPeerBean().setStorage(storage);
      logger.info(String.format("Using TomP2P with file-storage on %s",
          file));
    }
View Full Code Here

   
    public void visitElementsAndNodes(IModelElement element, int depth) throws CoreException,
    InvalidPathExceptionX {
      if(element instanceof ISourceModule) {
        final ISourceModule sourceModule = (ISourceModule) element;
        Path filePath = DLTKUtils.getFilePath(sourceModule);
        ParsedModule parseModule = DToolClient.getDefaultModuleCache().getParsedModuleOrNull(filePath);
        if(parseModule == null)
          return;
       
        Module module = parseModule.module;
View Full Code Here

 
  @Test
  public void testTestData() throws Exception { testTestData$(); }
  public void testTestData$() throws Exception {
    ISourceModule srcModule = getModule(searchProj, "srcB", "", "search2");
    Path filePath = DLTKUtils.getFilePath(srcModule.getResource().getLocation());
    ParsedModule parseModule = DToolClient.getDefaultModuleCache().getParsedModuleOrNull(filePath);
    Module module = parseModule.module;
   
    DefUnit defUnit = MiscNodeUtils.getDefUniFromScope(module.getChildren(), "xxxTestUnboundRef");
    IModuleResolver mr = DToolClient.getDefault().getResolvedModule(filePath).getModuleResolver();
View Full Code Here

    new DeeSearchEngineTestUtils.ElementsAndDefUnitVisitor() {
      @Override
      protected void visitNode(ASTNode node, ISourceModule sourceModule) {
        if(node instanceof Reference) {
          Reference reference = (Reference) node;
          Path filePath = DToolClient_Bad.getFilePathOrNull(sourceModule);
          if(filePath == null) {
            return;
          }
         
          IModuleResolver mr = DToolClient_Bad.getResolverFor(filePath);
          Collection<INamedElement> targetDefElements = reference.findTargetDefElements(mr, false);
          if(targetDefElements == null || targetDefElements.isEmpty()) {
            return;
          }
         
          for (INamedElement defElement : targetDefElements) {
            DefUnit defUnit = defElement.resolveDefUnit();
            if(defUnit == null) {
              continue;
            }
            Module moduleNode = defUnit.getModuleNode();
            if(moduleNode == null) {
              continue; // consider this case more
            }
             
            ISourceModule defUnitSrcModule = findSourceModule(moduleNode, searchProj);
           
            ArrayList<Integer> nodeTreePath = DeeSearchEngineTestUtils.getNodeTreePath(defUnit);
            Pair<ISourceModule, ?> key = Pair.create(defUnitSrcModule, nodeTreePath);
           
            if(defUnitToReferencesMap.get(key) == null) {
              defUnitToReferencesMap.put(key, new HashSet<Reference>());
            }
           
            defUnitToReferencesMap.get(key).add(reference);
          }
        }
      }
    }.visitElementsAndNodes(getSrcFolder(searchProj, "srcA"), 10);
   
   
   
    for (Pair<ISourceModule, ?> key : defUnitToReferencesMap.keySet()) {
      ISourceModule sourceModule = key.getFirst();
      ArrayList<Integer> nodeTreePath = blindCast(key.getSecond());
     
      Path filePath = DLTKUtils.getFilePath(sourceModule);
     
      ParsedModule parseModule = DToolClient.getDefaultModuleCache().getParsedModuleOrNull(filePath);
      Module deeModule = parseModule == null ? null : parseModule.module;
      ASTNode node = DeeSearchEngineTestUtils.getNodeFromPath(deeModule, nodeTreePath);
     
View Full Code Here

  @Test
  public void testBasic() throws Exception { testBasic$(); }
  public void testBasic$() throws Exception {
    String relativePath = "relative/path/foo.d";
    ModuleSource moduleSource = new ModuleSource(relativePath, "module blah;");
    Path filePath = DToolClient.getPathHandleForModuleSource(moduleSource);
   
    ClientModuleParseCache clientModuleCache = client.getClientModuleCache();
    assertEquals(clientModuleCache.getParsedModuleOrNull(filePath, moduleSource).module.getName(), "blah");
    assertEquals(clientModuleCache.getExistingParsedModuleNode(filePath).getName(), "blah");
   
    testCodeCompletion(moduleSource, 0,
      "blah");
    testCodeCompletion(new ModuleSource(relativePath, "module xpto;"), 0,
      "xpto");
    assertTrue(client.getServerSemanticManager().getParseCache().getEntry(MiscUtil.createPath(relativePath))
      .isWorkingCopy() == false);
   
    Path path = DToolTestResources.getTestResourcePath().resolve("dummy__non_existant.d");
    assertTrue(path.isAbsolute());
    testCodeCompletion(new ModuleSource(path.toString(), "module blah;"), 0,
        "blah");
   
    // Error case
    try {
      client.doCodeCompletion((Path) null, 0, null);
View Full Code Here

   
    testProjectBPDependencies();
  }
 
  public void runBasicTestSequence______________(IProject project) throws Exception {
    Path location = project.getLocation().toFile().toPath();
   
    writeDubJsonAndCheckDubModel("{"+ jsEntry("name", "xptobundle")+ jsFileEnd(),
      project,
      main(location, null, "xptobundle", DEFAULT_VERSION, srcFolders(), rawDeps()));
   
View Full Code Here

    String dubTestJson = jsObject(jsEntry("name", "dub_test"),
      jsEntryValue("dependencies", "{ \"dub_lib\": \"~master\"}"));
    writeDubJson(project, dubTestJson);
   
    IProject libProject = createAndOpenProject(DUB_LIB, true).getProject();
    Path libProjectLocation = loc(libProject);
    String dubLibJson = jsObject(jsEntry("name", "dub_lib"));
    writeDubJson(libProject, dubLibJson);
   
    // DUB_LIB project buildpath entry not on DUB_TEST yet
    _awaitModelUpdates_();
View Full Code Here

TOP

Related Classes of java.nio.file.Path

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.