本文整理匯總了Java中com.intellij.openapi.application.PathManager.getJarPathForClass方法的典型用法代碼示例。如果您正苦於以下問題:Java PathManager.getJarPathForClass方法的具體用法?Java PathManager.getJarPathForClass怎麽用?Java PathManager.getJarPathForClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.openapi.application.PathManager
的用法示例。
在下文中一共展示了PathManager.getJarPathForClass方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: computeClassLocation
import com.intellij.openapi.application.PathManager; //導入方法依賴的package包/類
private static FileSystemLocation computeClassLocation(Class<?> clazz) {
String classRootPath = PathManager.getJarPathForClass(clazz);
if (classRootPath == null) {
throw new IllegalStateException("Cannot find root directory for " + clazz);
}
File root = new File(classRootPath);
if (!root.exists()) {
throw new IllegalStateException("Classes root " + root + " doesn't exist");
}
if (!root.isDirectory()) {
//this means that clazz is located in a library, perhaps we should throw exception here
return FileSystemLocation.ULTIMATE;
}
String moduleName = root.getName();
String chunkPrefix = "ModuleChunk(";
if (moduleName.startsWith(chunkPrefix)) {
//todo[nik] this is temporary workaround to fix tests on TeamCity which compiles the whole modules cycle to a single output directory
moduleName = StringUtil.trimStart(moduleName, chunkPrefix);
moduleName = moduleName.substring(0, moduleName.indexOf(','));
}
return getCommunityModules().contains(moduleName) ? FileSystemLocation.COMMUNITY : FileSystemLocation.ULTIMATE;
}
示例2: getPathsToAnnotationsDirectoriesInDevelopmentMode
import com.intellij.openapi.application.PathManager; //導入方法依賴的package包/類
@NotNull
private static List<String> getPathsToAnnotationsDirectoriesInDevelopmentMode(final String moduleName) {
final String annotationsRoot = PathManager.getJarPathForClass(Flow.class);
if (annotationsRoot == null) return Collections.emptyList();
return Arrays.asList(annotationsRoot, FileUtil.toSystemIndependentName(new File(new File(annotationsRoot).getParentFile(),
moduleName).getAbsolutePath()));
}
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:8,代碼來源:JetBrainsAnnotationsExternalLibraryResolver.java
示例3: getPlatformApiPath
import com.intellij.openapi.application.PathManager; //導入方法依賴的package包/類
@Nullable
private static String getPlatformApiPath() {
String platformJar = PathManager.getJarPathForClass(Application.class);
if (platformJar == null) {
return null;
}
File jarFile = new File(platformJar).getAbsoluteFile();
File jarDir = jarFile.getParentFile();
if (jarDir == null) {
return null;
}
if (jarDir.getName().equals("lib")) {
// Building against IDE distribution.
// root/ <- we want this
// |-lib/
// | `-openapi.jar (jarFile)
// `-plugins/
return jarDir.getParent();
} else if (jarDir.getName().equals("core-api")) {
// Building against source.
// tools/idea/ <- we want this
// |-platform/
// | `-core-api/
// | `-libcore-api.jar (jarFile)
// `-plugins/
File platformDir = jarDir.getParentFile();
if (platformDir != null && platformDir.getName().equals("platform")) {
return platformDir.getParent();
}
}
return null;
}
示例4: enhanceRemoteProcessing
import com.intellij.openapi.application.PathManager; //導入方法依賴的package包/類
@Override
public void enhanceRemoteProcessing(@NotNull SimpleJavaParameters parameters) throws ExecutionException {
PathsList classPath = parameters.getClassPath();
// Gradle i18n bundle.
ExternalSystemApiUtil.addBundle(classPath, GradleBundle.PATH_TO_BUNDLE, GradleBundle.class);
// Gradle tool jars.
String toolingApiPath = PathManager.getJarPathForClass(ProjectConnection.class);
if (toolingApiPath == null) {
LOG.warn(GradleBundle.message("gradle.generic.text.error.jar.not.found"));
throw new ExecutionException("Can't find gradle libraries");
}
File gradleJarsDir = new File(toolingApiPath).getParentFile();
File[] gradleJars = gradleJarsDir.listFiles(FileFilters.filesWithExtension("jar"));
if (gradleJars == null) {
LOG.warn(GradleBundle.message("gradle.generic.text.error.jar.not.found"));
throw new ExecutionException("Can't find gradle libraries at " + gradleJarsDir.getAbsolutePath());
}
for (File jar : gradleJars) {
classPath.add(jar.getAbsolutePath());
}
List<String> additionalEntries = ContainerUtilRt.newArrayList();
ContainerUtilRt.addIfNotNull(additionalEntries, PathUtil.getJarPathForClass(GroovyObject.class));
ContainerUtilRt.addIfNotNull(additionalEntries, PathUtil.getJarPathForClass(GsonBuilder.class));
ContainerUtilRt.addIfNotNull(additionalEntries, PathUtil.getJarPathForClass(ExternalProject.class));
ContainerUtilRt.addIfNotNull(additionalEntries, PathUtil.getJarPathForClass(JavaProjectData.class));
ContainerUtilRt.addIfNotNull(additionalEntries, PathUtil.getJarPathForClass(LanguageLevel.class));
ContainerUtilRt.addIfNotNull(additionalEntries, PathUtil.getJarPathForClass(StdModuleTypes.class));
ContainerUtilRt.addIfNotNull(additionalEntries, PathUtil.getJarPathForClass(JavaModuleType.class));
ContainerUtilRt.addIfNotNull(additionalEntries, PathUtil.getJarPathForClass(ModuleType.class));
ContainerUtilRt.addIfNotNull(additionalEntries, PathUtil.getJarPathForClass(EmptyModuleType.class));
ContainerUtilRt.addIfNotNull(additionalEntries, PathUtil.getJarPathForClass(ProjectImportAction.class));
ContainerUtilRt.addIfNotNull(additionalEntries, PathUtil.getJarPathForClass(Init.class));
ContainerUtilRt.addIfNotNull(additionalEntries, PathUtil.getJarPathForClass(org.slf4j.Logger.class));
ContainerUtilRt.addIfNotNull(additionalEntries, PathUtil.getJarPathForClass(Log4jLoggerFactory.class));
for (String entry : additionalEntries) {
classPath.add(entry);
}
}
示例5: addEnhancerLibrary
import com.intellij.openapi.application.PathManager; //導入方法依賴的package包/類
private static void addEnhancerLibrary(JpsModule module) {
String path = PathManager.getJarPathForClass(Enhance.class);
JpsLibrary library = module.addModuleLibrary("appengine-enhancer", JpsJavaLibraryType.INSTANCE);
library.addRoot(new File(path), JpsOrderRootType.COMPILED);
module.getDependenciesList().addLibraryDependency(library);
}