Java Code Examples for com.intellij.util.PathUtil#getJarPathForClass()

The following examples show how to use com.intellij.util.PathUtil#getJarPathForClass() . 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: IntelliJIDEA.java    From intellijcoder with MIT License 5 votes vote down vote up
private void addJUnitLibraryDependency(ModifiableRootModel moduleRootModel) {
    // add junit library
    String junitJarPath = PathUtil.getJarPathForClass(org.junit.Test.class);
    addLibraryDependency(moduleRootModel, junitJarPath);
    // if the hamcrest classes are in a separate jar, add it too (as of JUnit 4.11, they are separate)
    String hamcrestJarPath = PathUtil.getJarPathForClass(org.hamcrest.SelfDescribing.class);
    if (!hamcrestJarPath.equals(junitJarPath)) {
        addLibraryDependency(moduleRootModel, hamcrestJarPath);
    }
}
 
Example 2
Source File: RemoteAgentManagerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public <T extends RemoteAgent> T createAgent(RemoteAgentProxyFactory agentProxyFactory,
                                             List<File> instanceLibraries,
                                             List<Class<?>> commonJarClasses,
                                             String specificsRuntimeModuleName,
                                             String specificsBuildJarPath,
                                             Class<T> agentInterface,
                                             String agentClassName,
                                             Class<?> pluginClass) throws Exception {

  List<Class<?>> allCommonJarClasses = new ArrayList<Class<?>>();
  allCommonJarClasses.addAll(commonJarClasses);
  allCommonJarClasses.add(RemoteAgent.class);
  allCommonJarClasses.add(agentInterface);

  List<File> libraries = new ArrayList<File>();
  libraries.addAll(instanceLibraries);

  for (Class<?> clazz : allCommonJarClasses) {
    libraries.add(new File(PathUtil.getJarPathForClass(clazz)));
  }

  File plugin = new File(PathUtil.getJarPathForClass(pluginClass));
  String allPluginsDir = plugin.getParent();
  if (plugin.isDirectory()) {
    // runtime behavior
    File specificsModule = new File(allPluginsDir, specificsRuntimeModuleName);
    libraries.add(specificsModule);
  }
  else {
    // build behavior
    File specificsDir = new File(allPluginsDir, FileUtil.toSystemDependentName(specificsBuildJarPath));
    libraries.add(specificsDir);
  }

  return agentProxyFactory.createProxy(libraries, agentInterface, agentClassName);
}
 
Example 3
Source File: ApplicationInfo.java    From consulo with Apache License 2.0 5 votes vote down vote up
private ApplicationInfo() {
  String jarPathForClass = PathUtil.getJarPathForClass(Application.class);

  try (JarFile jarFile = new JarFile(jarPathForClass)) {
    Manifest manifest = jarFile.getManifest();

    Attributes attributes = manifest.getMainAttributes();

    String buildNumber = attributes.getValue("Consulo-Build-Number");
    if (buildNumber != null) {
      myBuild = BuildNumber.fromString(buildNumber);
    }

    // yyyyMMddHHmm
    String buildDate = attributes.getValue("Consulo-Build-Date");
    if (buildDate != null) {
      myBuildDate = parseDate(buildDate);
    }
  }
  catch (Throwable e) {
    Logger.getInstance(ApplicationInfo.class).error(e);
  }

  if (myBuild == null) {
    myBuild = BuildNumber.fallback();
  }

  if (myBuildDate == null) {
    myBuildDate = Calendar.getInstance();
  }
}
 
Example 4
Source File: GradleImportingTestCase.java    From intellij-quarkus with Eclipse Public License 2.0 4 votes vote down vote up
@NotNull
private static File wrapperJar() {
  return new File(PathUtil.getJarPathForClass(GradleWrapperMain.class));
}
 
Example 5
Source File: BlazeGDBServerProvider.java    From intellij with Apache License 2.0 4 votes vote down vote up
@Override
protected String compute() {
  String jarPath = PathUtil.getJarPathForClass(BlazeCidrLauncher.class);
  File pluginrootDirectory = new File(jarPath).getParentFile().getParentFile();
  return new File(pluginrootDirectory, "gdb/gdbserver").getPath();
}
 
Example 6
Source File: Injector.java    From intellijcoder with MIT License 4 votes vote down vote up
private static ArenaConfigManager injectArenaConfigManager() {
    return new ArenaConfigManager(injectFileSystem(), PathUtil.getJarPathForClass(IntelliJCoderArenaPlugin.class));
}