Java Code Examples for com.intellij.util.io.URLUtil#SCHEME_SEPARATOR

The following examples show how to use com.intellij.util.io.URLUtil#SCHEME_SEPARATOR . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BlazeAndroidTestEventsHandler.java    From intellij with Apache License 2.0 6 votes vote down vote up
@Override
public String testLocationUrl(
    Label label,
    @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;
}
 
Example 2
Source File: VfsUtil.java    From consulo with Apache License 2.0 6 votes vote down vote up
/**
 * @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);
  }
}
 
Example 3
Source File: BlazeWebTestEventsHandler.java    From intellij with Apache License 2.0 6 votes vote down vote up
@Override
public String testLocationUrl(
    Label label,
    @Nullable Kind kind,
    String parentSuite,
    String name,
    @Nullable String className) {
  return WEB_TEST_PROTOCOL
      + URLUtil.SCHEME_SEPARATOR
      + label
      + SmRunnerUtils.TEST_NAME_PARTS_SPLITTER
      + parentSuite
      + SmRunnerUtils.TEST_NAME_PARTS_SPLITTER
      + name
      + SmRunnerUtils.TEST_NAME_PARTS_SPLITTER
      + Strings.nullToEmpty(className);
}
 
Example 4
Source File: BlazeJavaTestEventsHandler.java    From intellij with Apache License 2.0 6 votes vote down vote up
@Override
public String testLocationUrl(
    Label label,
    @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 + TEST_CASE_SEPARATOR + parentSuite + parameterComponent;
  }
  return classComponent + TEST_CASE_SEPARATOR + name;
}
 
Example 5
Source File: BlazeScalaTestRunLineMarkerContributor.java    From intellij with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example 6
Source File: ResourceModuleContentRootCustomizer.java    From intellij with Apache License 2.0 5 votes vote down vote up
@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);
  }
}
 
Example 7
Source File: UrlUtil.java    From intellij with Apache License 2.0 5 votes vote down vote up
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);
  }
}
 
Example 8
Source File: BlazeTestEventsHandler.java    From intellij with Apache License 2.0 5 votes vote down vote up
/** Converts the test case and suite names to a parsable location URL. */
default String testLocationUrl(
    Label label,
    @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;
}
 
Example 9
Source File: BlazeWebTestEventsHandler.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Override
public String suiteLocationUrl(Label label, @Nullable Kind kind, String name) {
  return WEB_TEST_PROTOCOL
      + URLUtil.SCHEME_SEPARATOR
      + label
      + SmRunnerUtils.TEST_NAME_PARTS_SPLITTER
      + name;
}
 
Example 10
Source File: BlazeGoTestEventsHandler.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Override
public String testLocationUrl(
    Label label,
    @Nullable Kind kind,
    String parentSuite,
    String name,
    @Nullable String className) {
  return SmRunnerUtils.GENERIC_TEST_PROTOCOL
      + URLUtil.SCHEME_SEPARATOR
      + label.withTargetName(parentSuite) // target and suite name won't match with web_tests
      + SmRunnerUtils.TEST_NAME_PARTS_SPLITTER
      + name;
}
 
Example 11
Source File: BlazeJavascriptTestEventsHandler.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Override
public String suiteLocationUrl(Label label, @Nullable Kind kind, String name) {
  return SmRunnerUtils.GENERIC_SUITE_PROTOCOL
      + URLUtil.SCHEME_SEPARATOR
      + label
      + SmRunnerUtils.TEST_NAME_PARTS_SPLITTER
      + name;
}
 
Example 12
Source File: BlazeJavascriptTestEventsHandler.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Override
public String testLocationUrl(
    Label label,
    @Nullable Kind kind,
    String parentSuite,
    String name,
    @Nullable String className) {
  return SmRunnerUtils.GENERIC_TEST_PROTOCOL
      + URLUtil.SCHEME_SEPARATOR
      + label
      + SmRunnerUtils.TEST_NAME_PARTS_SPLITTER
      + parentSuite
      + SmRunnerUtils.TEST_NAME_PARTS_SPLITTER
      + name;
}
 
Example 13
Source File: BlazeScalaTestRunLineMarkerContributor.java    From intellij with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example 14
Source File: BlazeScalaTestRunLineMarkerContributor.java    From intellij with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example 15
Source File: FsRoot.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public String getUrl() {
  return getFileSystem().getProtocol() + URLUtil.SCHEME_SEPARATOR + getPath();
}
 
Example 16
Source File: BlazeGoTestEventsHandler.java    From intellij with Apache License 2.0 4 votes vote down vote up
@Override
public String suiteLocationUrl(Label label, @Nullable Kind kind, String name) {
  return SmRunnerUtils.GENERIC_SUITE_PROTOCOL
      + URLUtil.SCHEME_SEPARATOR
      + label.withTargetName(name);
}
 
Example 17
Source File: BlazeJavaTestEventsHandler.java    From intellij with Apache License 2.0 4 votes vote down vote up
@Override
public String suiteLocationUrl(Label label, @Nullable Kind kind, String name) {
  return JavaTestLocator.SUITE_PROTOCOL + URLUtil.SCHEME_SEPARATOR + name;
}
 
Example 18
Source File: BlazeTestEventsHandler.java    From intellij with Apache License 2.0 4 votes vote down vote up
/** Converts the suite name to a parsable location URL. */
default String suiteLocationUrl(Label label, @Nullable Kind kind, String name) {
  return SmRunnerUtils.GENERIC_SUITE_PROTOCOL + URLUtil.SCHEME_SEPARATOR + name;
}
 
Example 19
Source File: BlazeAndroidTestEventsHandler.java    From intellij with Apache License 2.0 4 votes vote down vote up
@Override
public String suiteLocationUrl(Label label, @Nullable Kind kind, String name) {
  return SmRunnerUtils.GENERIC_SUITE_PROTOCOL + URLUtil.SCHEME_SEPARATOR + name;
}
 
Example 20
Source File: VirtualFileManager.java    From consulo with Apache License 2.0 2 votes vote down vote up
/**
 * Constructs URL by specified protocol and path. URL is a string which uniquely identifies file in all
 * file systems.
 *
 * @param protocol the protocol
 * @param path     the path
 * @return URL
 */
@Nonnull
public static String constructUrl(@Nonnull String protocol, @Nonnull String path) {
  return protocol + URLUtil.SCHEME_SEPARATOR + path;
}