当前位置: 首页>>代码示例>>Java>>正文


Java URLUtil.SCHEME_SEPARATOR属性代码示例

本文整理汇总了Java中com.intellij.util.io.URLUtil.SCHEME_SEPARATOR属性的典型用法代码示例。如果您正苦于以下问题:Java URLUtil.SCHEME_SEPARATOR属性的具体用法?Java URLUtil.SCHEME_SEPARATOR怎么用?Java URLUtil.SCHEME_SEPARATOR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.intellij.util.io.URLUtil的用法示例。


在下文中一共展示了URLUtil.SCHEME_SEPARATOR属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toUri

/**
 * @return correct URL, must be used only for external communication
 */
@NotNull
public static URI toUri(@NotNull VirtualFile file) {
  String path = file.getPath();
  try {
    String protocol = file.getFileSystem().getProtocol();
    if (file.isInLocalFileSystem()) {
      if (SystemInfo.isWindows && path.charAt(0) != '/') {
        path = '/' + path;
      }
      return new URI(protocol, "", path, null, null);
    }
    if (URLUtil.HTTP_PROTOCOL.equals(protocol)) {
      return new URI(URLUtil.HTTP_PROTOCOL + URLUtil.SCHEME_SEPARATOR + path);
    }
    return new URI(protocol, path, null);
  }
  catch (URISyntaxException e) {
    throw new IllegalArgumentException(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:VfsUtil.java

示例2: testLocationUrl

@Override
public String testLocationUrl(
    @Nullable Kind kind, String parentSuite, String name, @Nullable String className) {
  // ignore initial value of className -- it's the test runner class.
  name = StringUtil.trimTrailing(name, '-');
  if (!name.contains("-")) {
    return SmRunnerUtils.GENERIC_SUITE_PROTOCOL + URLUtil.SCHEME_SEPARATOR + name;
  }
  int ix = name.lastIndexOf('-');
  className = name.substring(0, ix);
  String methodName = name.substring(ix + 1);
  return SmRunnerUtils.GENERIC_SUITE_PROTOCOL
      + URLUtil.SCHEME_SEPARATOR
      + className
      + SmRunnerUtils.TEST_NAME_PARTS_SPLITTER
      + methodName;
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:17,代码来源:BlazeAndroidTestEventsHandler.java

示例3: getSpecs2TestUrl

@Nullable
private static String getSpecs2TestUrl(ScClass testClass, ScInfixExpr testCase) {
  String name = null;
  String protocol = null;
  if (TestNodeProvider.isSpecs2ScopeExpr(testCase)) {
    protocol = SmRunnerUtils.GENERIC_SUITE_PROTOCOL;
    name = Specs2Utils.getSpecs2ScopeName(testCase);
  } else if (TestNodeProvider.isSpecs2Expr(testCase)) {
    protocol = SmRunnerUtils.GENERIC_TEST_PROTOCOL;
    name = Specs2Utils.getSpecs2ScopedTestName(testCase);
  }
  if (name == null) {
    return null;
  }
  return protocol
      + URLUtil.SCHEME_SEPARATOR
      + testClass.getQualifiedName()
      + SmRunnerUtils.TEST_NAME_PARTS_SPLITTER
      + name;
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:20,代码来源:BlazeScalaTestRunLineMarkerContributor.java

示例4: toUri

/**
 * @return correct URL, must be used only for external communication
 */
@Nonnull
public static URI toUri(@Nonnull VirtualFile file) {
  String path = file.getPath();
  try {
    String protocol = file.getFileSystem().getProtocol();
    if (file.isInLocalFileSystem()) {
      if (SystemInfo.isWindows && path.charAt(0) != '/') {
        path = '/' + path;
      }
      return new URI(protocol, "", path, null, null);
    }
    if (URLUtil.HTTP_PROTOCOL.equals(protocol)) {
      return new URI(URLUtil.HTTP_PROTOCOL + URLUtil.SCHEME_SEPARATOR + path);
    }
    return new URI(protocol, path, null);
  }
  catch (URISyntaxException e) {
    throw new IllegalArgumentException(e);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:VfsUtil.java

示例5: toIdeaUrl

@NotNull
public static String toIdeaUrl(@NotNull String url, boolean removeLocalhostPrefix) {
  int index = url.indexOf(":/");
  if (index < 0 || (index + 2) >= url.length()) {
    return url;
  }

  if (url.charAt(index + 2) != '/') {
    String prefix = url.substring(0, index);
    String suffix = url.substring(index + 2);

    if (SystemInfoRt.isWindows) {
      return prefix + URLUtil.SCHEME_SEPARATOR + suffix;
    }
    else if (removeLocalhostPrefix && prefix.equals(URLUtil.FILE_PROTOCOL) && suffix.startsWith(LOCALHOST_URI_PATH_PREFIX)) {
      // sometimes (e.g. in Google Chrome for Mac) local file url is prefixed with 'localhost' so we need to remove it
      return prefix + ":///" + suffix.substring(LOCALHOST_URI_PATH_PREFIX.length());
    }
    else {
      return prefix + ":///" + suffix;
    }
  }
  else if (SystemInfoRt.isWindows && (index + 3) < url.length() && url.charAt(index + 3) == '/' && url.regionMatches(0, StandardFileSystems.FILE_PROTOCOL_PREFIX, 0, StandardFileSystems.FILE_PROTOCOL_PREFIX.length())) {
    // file:///C:/test/file.js -> file://C:/test/file.js
    for (int i = index + 4; i < url.length(); i++) {
      char c = url.charAt(i);
      if (c == '/') {
        break;
      }
      else if (c == ':') {
        return StandardFileSystems.FILE_PROTOCOL_PREFIX + url.substring(index + 4);
      }
    }
    return url;
  }
  return url;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:VfsUtilCore.java

示例6: makeKey

/**
 * Makes the password database key for the URL: inserts the login after the scheme: http://[email protected]
 */
@NotNull
private static String makeKey(@NotNull String url, @Nullable String login) {
  if (login == null) {
    return url;
  }
  Couple<String> pair = UriUtil.splitScheme(url);
  String scheme = pair.getFirst();
  if (!StringUtil.isEmpty(scheme)) {
    return scheme + URLUtil.SCHEME_SEPARATOR + login + "@" + pair.getSecond();
  }
  return login + "@" + url;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:GitHttpGuiAuthenticator.java

示例7: pathToUrl

@NotNull
private static String pathToUrl(@NotNull String filePath) {
  filePath = FileUtil.toSystemIndependentName(filePath);
  if (filePath.endsWith(".srcjar") || filePath.endsWith(".jar")) {
    return URLUtil.JAR_PROTOCOL + URLUtil.SCHEME_SEPARATOR + filePath + URLUtil.JAR_SEPARATOR;
  } else if (filePath.contains("src.jar!")) {
    return URLUtil.JAR_PROTOCOL + URLUtil.SCHEME_SEPARATOR + filePath;
  } else {
    return VfsUtilCore.pathToUrl(filePath);
  }
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:11,代码来源:ResourceModuleContentRootCustomizer.java

示例8: pathToUrl

public static String pathToUrl(String filePath) {
  filePath = FileUtil.toSystemIndependentName(filePath);
  if (filePath.endsWith(".srcjar") || filePath.endsWith(".jar")) {
    return URLUtil.JAR_PROTOCOL + URLUtil.SCHEME_SEPARATOR + filePath + URLUtil.JAR_SEPARATOR;
  } else if (filePath.contains("src.jar!")) {
    return URLUtil.JAR_PROTOCOL + URLUtil.SCHEME_SEPARATOR + filePath;
  } else {
    return VirtualFileManager.constructUrl(
        VirtualFileSystemProvider.getInstance().getSystem().getProtocol(), filePath);
  }
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:11,代码来源:UrlUtil.java

示例9: testLocationUrl

/** Converts the test case and suite names to a parsable location URL. */
default String testLocationUrl(
    @Nullable Kind kind, String parentSuite, String name, @Nullable String className) {
  String base = SmRunnerUtils.GENERIC_TEST_PROTOCOL + URLUtil.SCHEME_SEPARATOR;
  if (Strings.isNullOrEmpty(className)) {
    return base + name;
  }
  return base + className + SmRunnerUtils.TEST_NAME_PARTS_SPLITTER + name;
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:9,代码来源:BlazeTestEventsHandler.java

示例10: testLocationUrl

@Override
public String testLocationUrl(
    @Nullable Kind kind, String parentSuite, String name, @Nullable String classname) {
  if (classname == null) {
    return null;
  }
  String classComponent = JavaTestLocator.TEST_PROTOCOL + URLUtil.SCHEME_SEPARATOR + classname;
  String parameterComponent = extractParameterComponent(name);
  if (parameterComponent != null) {
    return classComponent + "." + parentSuite + parameterComponent;
  }
  return classComponent + "." + name;
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:13,代码来源:BlazeJavaTestEventsHandler.java

示例11: getTestClassUrl

@Nullable
private static String getTestClassUrl(TestFramework framework, ScClass testClass) {
  if (!framework.isTestClass(testClass)) {
    return null;
  }
  return SmRunnerUtils.GENERIC_SUITE_PROTOCOL
      + URLUtil.SCHEME_SEPARATOR
      + testClass.getQualifiedName();
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:9,代码来源:BlazeScalaTestRunLineMarkerContributor.java

示例12: getTestMethodUrl

@Nullable
private static String getTestMethodUrl(
    TestFramework framework, ScClass testClass, ScFunctionDefinition method) {
  if (!framework.isTestMethod(method)) {
    return null;
  }
  return SmRunnerUtils.GENERIC_TEST_PROTOCOL
      + URLUtil.SCHEME_SEPARATOR
      + testClass.getQualifiedName()
      + SmRunnerUtils.TEST_NAME_PARTS_SPLITTER
      + method.getName();
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:12,代码来源:BlazeScalaTestRunLineMarkerContributor.java

示例13: testLocationUrl

@Override
public String testLocationUrl(
    @Nullable Kind kind, String parentSuite, String name, @Nullable String className) {
  return SmRunnerUtils.GENERIC_TEST_PROTOCOL
      + URLUtil.SCHEME_SEPARATOR
      + parentSuite
      + SmRunnerUtils.TEST_NAME_PARTS_SPLITTER
      + name;
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:9,代码来源:BlazeGoTestEventsHandler.java

示例14: getHost

@NotNull
private static String getHost(@NotNull String url) {
  Pair<String, String> split = URLUtil.splitScheme(url);
  String scheme = split.getFirst();
  String urlItself = split.getSecond();
  int pathStart = urlItself.indexOf("/");
  return scheme + URLUtil.SCHEME_SEPARATOR + urlItself.substring(0, pathStart);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:8,代码来源:GitHttpGuiAuthenticator.java

示例15: makeKey

/**
 * Makes the password database key for the URL: inserts the login after the scheme: http://[email protected]
 */
@NotNull
private static String makeKey(@NotNull String url, @NotNull String login) {
  Pair<String,String> pair = URLUtil.splitScheme(url);
  String scheme = pair.getFirst();
  if (StringUtil.isEmpty(scheme)) {
    return scheme + URLUtil.SCHEME_SEPARATOR + login + "@" + pair.getSecond();
  }
  return login + "@" + url;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:12,代码来源:GitHttpGuiAuthenticator.java


注:本文中的com.intellij.util.io.URLUtil.SCHEME_SEPARATOR属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。