gpt4 book ai didi

org.eclipse.che.api.fs.server.WsPathUtils.resolve()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-26 11:25:05 26 4
gpt4 key购买 nike

本文整理了Java中org.eclipse.che.api.fs.server.WsPathUtils.resolve()方法的一些代码示例,展示了WsPathUtils.resolve()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WsPathUtils.resolve()方法的具体详情如下:
包路径:org.eclipse.che.api.fs.server.WsPathUtils
类名称:WsPathUtils
方法名:resolve

WsPathUtils.resolve介绍

暂无

代码示例

代码示例来源:origin: org.eclipse.che.core/che-core-api-git

private boolean haveChanges(String projectPath, List<String> paths) {
 boolean statusChanged = false;
 for (String path : paths) {
  String filePath = resolve(projectPath, path);
  FileTime fileTime = projectFiles.get(filePath);
  try {
   FileTime currentFileTime = getLastModifiedTime(Paths.get(filePath));
   if (fileTime == null || !fileTime.equals(currentFileTime)) {
    projectFiles.put(filePath, currentFileTime);
    statusChanged = true;
   }
  } catch (IOException exception) {
   if (exception instanceof NoSuchFileException) {
    statusChanged = projectFiles.remove(filePath) != null;
   } else {
    LOG.error(exception.getMessage());
   }
  }
 }
 return statusChanged;
}

代码示例来源:origin: org.eclipse.che.plugin/che-plugin-cpp-lang-server

@Override
public void onCreateProject(
  String projectWsPath, Map<String, AttributeValue> attributes, Map<String, String> options)
  throws ForbiddenException, ConflictException, ServerException, NotFoundException {
 try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream(RESOURCE_NAME)) {
  fsManager.createDir(projectWsPath);
  String wsPath = resolve(projectWsPath, FILE_NAME);
  fsManager.createFile(wsPath, inputStream);
 } catch (IOException e) {
  throw new ServerException(e);
 }
}

代码示例来源:origin: org.eclipse.che.plugin/che-plugin-cpp-lang-server

@Override
public void onCreateProject(
  String projectWsPath, Map<String, AttributeValue> attributes, Map<String, String> options)
  throws ForbiddenException, ConflictException, ServerException, NotFoundException {
 try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream(RESOURCE_NAME)) {
  fsManager.createDir(projectWsPath);
  String wsPath = resolve(projectWsPath, FILE_NAME);
  fsManager.createFile(wsPath, inputStream);
 } catch (IOException e) {
  throw new ServerException(e);
 }
}

代码示例来源:origin: org.eclipse.che.plugin/che-plugin-nodejs-lang-server

@Override
public void onCreateProject(
  String projectWsPath, Map<String, AttributeValue> attributes, Map<String, String> options)
  throws ForbiddenException, ConflictException, ServerException, NotFoundException {
 try (InputStream inputStream =
   getClass().getClassLoader().getResourceAsStream("files/default_node_content")) {
  fsManager.createDir(projectWsPath);
  String wsPath = resolve(projectWsPath, "hello.js");
  fsManager.createFile(wsPath, inputStream);
 } catch (IOException e) {
  throw new ServerException(e);
 }
}

代码示例来源:origin: org.eclipse.che.plugin/che-plugin-python-lang-server

@Override
public void onCreateProject(
  String projectWsPath, Map<String, AttributeValue> attributes, Map<String, String> options)
  throws ForbiddenException, ConflictException, ServerException, NotFoundException {
 try (InputStream inputStream =
   getClass().getClassLoader().getResourceAsStream("files/default_python_content")) {
  fsManager.createDir(projectWsPath);
  String wsPath = resolve(projectWsPath, "main.py");
  fsManager.createFile(wsPath, inputStream);
 } catch (IOException e) {
  throw new ServerException(e);
 }
}

代码示例来源:origin: org.eclipse.che.plugin/che-plugin-ceylon-lang-server

@Override
public void onCreateProject(
  String projectWsPath, Map<String, AttributeValue> attributes, Map<String, String> options)
  throws ForbiddenException, ConflictException, ServerException, NotFoundException {
 fsManager.createDir(projectWsPath);
 fsManager.createDir(resolve(projectWsPath, "source"));
 fsManager.createDir(resolve(projectWsPath, "resource"));
 for (String file : PROJECT_FILES) {
  InputStream inputStream = new ByteArrayInputStream(getProjectContent("project/" + file));
  String wsPath = resolve(projectWsPath, file);
  fsManager.createFile(wsPath, inputStream, true, true);
  if (file.startsWith("ceylonb")) {
   fsManager.toIoFile(wsPath).setExecutable(true);
  }
 }
}

代码示例来源:origin: org.eclipse.che.plugin/che-plugin-java-ext-lang-server

try {
 String projectWsPath = absolutize(projectPath);
 String projectCheFolderWsPath = resolve(projectWsPath, CHE_FOLDER);
 String cheFormatterWsPath = resolve(projectCheFolderWsPath, CHE_FORMATTER_XML);

代码示例来源:origin: org.eclipse.che.plugin/che-plugin-java-ext-lang-server

@POST
@Path("update/workspace")
@Consumes(MediaType.TEXT_PLAIN)
@ApiOperation(value = "Updates configuration of the jav formatter for the workspace")
@ApiResponses({
 @ApiResponse(code = 200, message = "Formatter was imported successfully"),
 @ApiResponse(code = 500, message = "Internal server error occurred")
})
public void updateRootFormatter(
  @ApiParam(value = "The content of the formatter. Eclipse code formatting is supported only")
    String content)
  throws ServerException {
 try {
  String rootCheFolderWsPath = absolutize(CHE_FOLDER);
  if (!fsManager.existsAsDir(rootCheFolderWsPath)) {
   fsManager.createDir(rootCheFolderWsPath);
  }
  String cheFormatterWsPath = resolve(rootCheFolderWsPath, CHE_FORMATTER_XML);
  if (!fsManager.existsAsFile(cheFormatterWsPath)) {
   fsManager.createFile(cheFormatterWsPath, content);
  } else {
   fsManager.update(cheFormatterWsPath, content);
  }
 } catch (ServerException | ConflictException | NotFoundException e) {
  throw new ServerException(e);
 }
}

代码示例来源:origin: org.eclipse.che.core/che-core-api-git

@DELETE
@Path("repository")
public void deleteRepository(@Context UriInfo uriInfo) throws ApiException {
 ProjectConfig project =
   projectManager
     .get(projectPath)
     .orElseThrow(() -> new NotFoundException("Can't find project"));
 String dotGitWsPath = resolve(absolutize(projectPath), ".git");
 fsManager.delete(dotGitWsPath);
 eventService.publish(
   newDto(GitRepositoryDeletedEvent.class)
     .withProjectName(project.getName())
     .withProjectPath(projectPath));
}

代码示例来源:origin: org.eclipse.che.core/che-core-api-git

@Override
public Map<String, VcsStatus> getStatus(String wsPath, List<String> paths)
  throws ServerException {
 Map<String, VcsStatus> result = new HashMap<>();
 try {
  ProjectConfig project =
    projectManager
      .getClosest(absolutize(wsPath))
      .orElseThrow(() -> new NotFoundException("Can't find project"));
  Status status =
    getStatus(
      project.getName(), pathTransformer.transform(project.getPath()).toString(), paths);
  paths.forEach(
    path -> {
     String itemWsPath = resolve(project.getPath(), path);
     if (status.getUntracked().contains(path)) {
      result.put(itemWsPath, UNTRACKED);
     } else if (status.getAdded().contains(path)) {
      result.put(itemWsPath, ADDED);
     } else if (status.getModified().contains(path) || status.getChanged().contains(path)) {
      result.put(itemWsPath, MODIFIED);
     } else {
      result.put(itemWsPath, NOT_MODIFIED);
     }
    });
 } catch (NotFoundException e) {
  throw new ServerException(e.getMessage());
 }
 return result;
}

代码示例来源:origin: org.eclipse.che.core/che-core-api-git

paths.forEach(
  path -> {
   String itemWsPath = resolve(project.getPath(), path);
   if (status.getUntracked().contains(path)) {
    statusMap.put(itemWsPath, UNTRACKED);

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com