本文整理匯總了Java中com.intellij.openapi.application.PathManager類的典型用法代碼示例。如果您正苦於以下問題:Java PathManager類的具體用法?Java PathManager怎麽用?Java PathManager使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PathManager類屬於com.intellij.openapi.application包,在下文中一共展示了PathManager類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createAntClassPath
import com.intellij.openapi.application.PathManager; //導入依賴的package包/類
private void createAntClassPath(final File platformDir) {
classPaths = new ArrayList<>();
//brutal hack. Do not do this at home, kids!
//we are hiding class in a classpath to confuse the classloader and pick our implementation
final String entry = PathManager.getResourceRoot(
HybrisIdeaAntLogger.class, "/" + HybrisIdeaAntLogger.class.getName().replace('.', '/') + ".class"
);
classPaths.add(new SinglePathEntry(entry));
//end of hack
final File platformLibDir = new File(platformDir, HybrisConstants.LIB_DIRECTORY);
classPaths.add(new AllJarsUnderDirEntry(platformLibDir));
classPaths.addAll(
extHybrisModuleDescriptorList
.parallelStream()
.map(e -> new AllJarsUnderDirEntry(new File(e.getRootDirectory(), HybrisConstants.LIB_DIRECTORY)))
.collect(Collectors.toList())
);
final File libDir = new File(platformDir, HybrisConstants.ANT_LIB_DIR);
classPaths.add(new AllJarsUnderDirEntry(libDir));
}
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:21,代碼來源:DefaultAntConfigurator.java
示例2: getRootDirs
import com.intellij.openapi.application.PathManager; //導入依賴的package包/類
public Set<String> getRootDirs(final Project project) {
if (!Registry.is("editor.config.stop.at.project.root")) {
return Collections.emptySet();
}
return CachedValuesManager.getManager(project).getCachedValue(project, new CachedValueProvider<Set<String>>() {
@Nullable
@Override
public Result<Set<String>> compute() {
final Set<String> dirs = new HashSet<String>();
final VirtualFile projectBase = project.getBaseDir();
if (projectBase != null) {
dirs.add(project.getBasePath());
for (Module module : ModuleManager.getInstance(project).getModules()) {
for (VirtualFile root : ModuleRootManager.getInstance(module).getContentRoots()) {
if (!VfsUtilCore.isAncestor(projectBase, root, false)) {
dirs.add(root.getPath());
}
}
}
}
dirs.add(PathManager.getConfigPath());
return new Result<Set<String>>(dirs, ProjectRootModificationTracker.getInstance(project));
}
});
}
示例3: createGreclipseLoader
import com.intellij.openapi.application.PathManager; //導入依賴的package包/類
@Nullable
private ClassLoader createGreclipseLoader(@Nullable String jar) {
if (StringUtil.isEmpty(jar)) return null;
if (jar.equals(myGreclipseJar)) {
return myGreclipseLoader;
}
try {
URL[] urls = {
new File(jar).toURI().toURL(),
new File(ObjectUtils.assertNotNull(PathManager.getJarPathForClass(GreclipseMain.class))).toURI().toURL()
};
ClassLoader loader = new URLClassLoader(urls, null);
Class.forName("org.eclipse.jdt.internal.compiler.batch.Main", false, loader);
myGreclipseJar = jar;
myGreclipseLoader = loader;
return loader;
}
catch (Exception e) {
LOG.error(e);
return null;
}
}
示例4: removeCoverageSuite
import com.intellij.openapi.application.PathManager; //導入依賴的package包/類
public void removeCoverageSuite(final CoverageSuite suite) {
final String fileName = suite.getCoverageDataFileName();
boolean deleteTraces = suite.isTracingEnabled();
if (!FileUtil.isAncestor(PathManager.getSystemPath(), fileName, false)) {
String message = "Would you like to delete file \'" + fileName + "\' ";
if (deleteTraces) {
message += "and traces directory \'" + FileUtil.getNameWithoutExtension(new File(fileName)) + "\' ";
}
message += "on disk?";
if (Messages.showYesNoDialog(myProject, message, CommonBundle.getWarningTitle(), Messages.getWarningIcon()) == Messages.YES) {
deleteCachedCoverage(fileName, deleteTraces);
}
} else {
deleteCachedCoverage(fileName, deleteTraces);
}
myCoverageSuites.remove(suite);
if (myCurrentSuitesBundle != null && myCurrentSuitesBundle.contains(suite)) {
CoverageSuite[] suites = myCurrentSuitesBundle.getSuites();
suites = ArrayUtil.remove(suites, suite);
chooseSuitesBundle(suites.length > 0 ? new CoverageSuitesBundle(suites) : null);
}
}
示例5: findEcjJarFile
import com.intellij.openapi.application.PathManager; //導入依賴的package包/類
@Nullable
public static File findEcjJarFile() {
File[] libs = {new File(PathManager.getHomePath(), "lib"), new File(PathManager.getHomePath(), "community/lib")};
for (File lib : libs) {
File[] children = lib.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.startsWith("ecj-") && name.endsWith(".jar");
}
});
if (children != null && children.length > 0) {
return children[0];
}
}
return null;
}
示例6: doCreateDeploymentRuntime
import com.intellij.openapi.application.PathManager; //導入依賴的package包/類
@Override
protected CloudDeploymentRuntime doCreateDeploymentRuntime(ArtifactDeploymentSource artifactSource,
File artifactFile,
CloudMultiSourceServerRuntimeInstance serverRuntime,
DeploymentTask<? extends CloudDeploymentNameConfiguration> deploymentTask,
DeploymentLogManager logManager) throws ServerRuntimeException {
RepositoryDeploymentConfiguration config = (RepositoryDeploymentConfiguration)deploymentTask.getConfiguration();
String repositoryPath = config.getRepositoryPath();
File repositoryRootFile;
if (StringUtil.isEmpty(repositoryPath)) {
File repositoryParentFolder = new File(PathManager.getSystemPath(), "cloud-git-artifact-deploy");
repositoryRootFile = FileUtil.findSequentNonexistentFile(repositoryParentFolder, artifactFile.getName(), "");
}
else {
repositoryRootFile = new File(repositoryPath);
}
if (!FileUtil.createDirectory(repositoryRootFile)) {
throw new ServerRuntimeException("Unable to create deploy folder: " + repositoryRootFile);
}
config.setRepositoryPath(repositoryRootFile.getAbsolutePath());
return doCreateDeploymentRuntime(artifactSource, artifactFile, serverRuntime, deploymentTask, logManager, repositoryRootFile);
}
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:25,代碼來源:RepositoryArtifactDeploymentRuntimeProviderBase.java
示例7: setUp
import com.intellij.openapi.application.PathManager; //導入依賴的package包/類
@Override
protected void setUp() throws Exception {
super.setUp();
myNestedFormLoader = new MyNestedFormLoader();
final String swingPath = PathUtil.getJarPathForClass(AbstractButton.class);
java.util.List<URL> cp = new ArrayList<URL>();
appendPath(cp, JBTabbedPane.class);
appendPath(cp, TIntObjectHashMap.class);
appendPath(cp, UIUtil.class);
appendPath(cp, SystemInfoRt.class);
appendPath(cp, ApplicationManager.class);
appendPath(cp, PathManager.getResourceRoot(this.getClass(), "/messages/UIBundle.properties"));
appendPath(cp, PathManager.getResourceRoot(this.getClass(), "/RuntimeBundle.properties"));
appendPath(cp, GridLayoutManager.class); // forms_rt
appendPath(cp, DataProvider.class);
myClassFinder = new MyClassFinder(
new URL[] {new File(swingPath).toURI().toURL()},
cp.toArray(new URL[cp.size()])
);
}
示例8: attachJdkAnnotations
import com.intellij.openapi.application.PathManager; //導入依賴的package包/類
public static void attachJdkAnnotations(@NotNull SdkModificator modificator) {
LocalFileSystem lfs = LocalFileSystem.getInstance();
// community idea under idea
VirtualFile root = lfs.findFileByPath(FileUtil.toSystemIndependentName(PathManager.getHomePath()) + "/java/jdkAnnotations");
if (root == null) { // idea under idea
root = lfs.findFileByPath(FileUtil.toSystemIndependentName(PathManager.getHomePath()) + "/community/java/jdkAnnotations");
}
if (root == null) { // build
root = VirtualFileManager.getInstance().findFileByUrl("jar://"+ FileUtil.toSystemIndependentName(PathManager.getHomePath()) + "/lib/jdkAnnotations.jar!/");
}
if (root == null) {
LOG.error("jdk annotations not found in: "+ FileUtil.toSystemIndependentName(PathManager.getHomePath()) + "/lib/jdkAnnotations.jar!/");
return;
}
OrderRootType annoType = AnnotationOrderRootType.getInstance();
modificator.removeRoot(root, annoType);
modificator.addRoot(root, annoType);
}
示例9: saveActionScript
import com.intellij.openapi.application.PathManager; //導入依賴的package包/類
private static void saveActionScript(List<ActionCommand> commands) throws IOException {
File temp = new File(PathManager.getPluginTempPath());
boolean exists = true;
if (!temp.exists()) {
exists = temp.mkdirs();
}
if (exists) {
File file = new File(getActionScriptPath());
ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(file, false));
try {
oos.writeObject(commands);
}
finally {
oos.close();
}
}
}
示例10: loadPlatformLibrary
import com.intellij.openapi.application.PathManager; //導入依賴的package包/類
public static void loadPlatformLibrary(@NotNull String libName) {
String libFileName = mapLibraryName(libName);
String libPath = PathManager.getBinPath() + "/" + libFileName;
if (!new File(libPath).exists()) {
String platform = getPlatformName();
if (!new File(libPath = PathManager.getHomePath() + "/community/bin/" + platform + libFileName).exists()) {
if (!new File(libPath = PathManager.getHomePath() + "/bin/" + platform + libFileName).exists()) {
if (!new File(libPath = PathManager.getHomePathFor(IdeaWin32.class) + "/bin/" + libFileName).exists()) {
File libDir = new File(PathManager.getBinPath());
throw new UnsatisfiedLinkError("'" + libFileName + "' not found in '" + libDir + "' among " + Arrays.toString(libDir.list()));
}
}
}
}
System.load(libPath);
}
示例11: getFileText
import com.intellij.openapi.application.PathManager; //導入依賴的package包/類
private static String getFileText(@NotNull final String fileName) throws IOException {
String fullPath = PathManager.getHomePath() + "/community/python/ipnb/" + fileName;
final BufferedReader br = new BufferedReader(new FileReader(fullPath));
try {
final StringBuilder sb = new StringBuilder();
String line = br.readLine();
while (line != null) {
sb.append(line);
sb.append("\n");
line = br.readLine();
}
return sb.toString();
}
finally {
br.close();
}
}
示例12: collectAllowedRoots
import com.intellij.openapi.application.PathManager; //導入依賴的package包/類
@Override
protected void collectAllowedRoots(final List<String> roots) throws IOException {
roots.add(myJdkHome);
FileUtil.processFilesRecursively(new File(myJdkHome), new Processor<File>() {
@Override
public boolean process(File file) {
try {
String path = file.getCanonicalPath();
if (!FileUtil.isAncestor(myJdkHome, path, false)) {
roots.add(path);
}
}
catch (IOException ignore) { }
return true;
}
});
roots.add(PathManager.getConfigPath());
}
示例13: getToolingExtensionsJarPaths
import com.intellij.openapi.application.PathManager; //導入依賴的package包/類
@NotNull
private static String getToolingExtensionsJarPaths(@NotNull Set<Class> toolingExtensionClasses) {
final Set<String> jarPaths = ContainerUtil.map2SetNotNull(toolingExtensionClasses, new Function<Class, String>() {
@Override
public String fun(Class aClass) {
String path = PathManager.getJarPathForClass(aClass);
return path == null ? null : PathUtil.getCanonicalPath(path);
}
});
StringBuilder buf = new StringBuilder();
buf.append('[');
for (Iterator<String> it = jarPaths.iterator(); it.hasNext(); ) {
String jarPath = it.next();
buf.append('\"').append(jarPath).append('\"');
if (it.hasNext()) {
buf.append(',');
}
}
buf.append(']');
return buf.toString();
}
示例14: writeExternal
import com.intellij.openapi.application.PathManager; //導入依賴的package包/類
public void writeExternal(final Element element) throws WriteExternalException {
final String fileName =
FileUtil.getRelativePath(new File(PathManager.getSystemPath()), new File(myCoverageDataFileProvider.getCoverageDataFilePath()));
element.setAttribute(FILE_PATH, fileName != null ? FileUtil.toSystemIndependentName(fileName) : myCoverageDataFileProvider.getCoverageDataFilePath());
element.setAttribute(NAME_ATTRIBUTE, myName);
element.setAttribute(MODIFIED_STAMP, String.valueOf(myLastCoverageTimeStamp));
element.setAttribute(SOURCE_PROVIDER, myCoverageDataFileProvider instanceof DefaultCoverageFileProvider
? ((DefaultCoverageFileProvider)myCoverageDataFileProvider).getSourceProvider()
: myCoverageDataFileProvider.getClass().getName());
// runner
if (getRunner() != null) {
element.setAttribute(COVERAGE_RUNNER, myRunner.getId());
}
// cover by test
element.setAttribute(COVERAGE_BY_TEST_ENABLED_ATTRIBUTE_NAME, String.valueOf(myCoverageByTestEnabled));
// tracing
element.setAttribute(TRACING_ENABLED_ATTRIBUTE_NAME, String.valueOf(myTracingEnabled));
}
示例15: nativeCopy
import com.intellij.openapi.application.PathManager; //導入依賴的package包/類
static boolean nativeCopy(File fromFile, File toFile, boolean syncTimestamp) {
File launcherFile = new File(PathManager.getBinPath(), "vistalauncher.exe");
try {
// todo vistalauncher should be replaced with generic "elevate" process
// todo so the second java process will be unnecessary: plain 'elevate cmd /C copy' will work
return execExternalProcess(new String[]{launcherFile.getPath(),
//"cmd", "/C", "move", fromFile.getPath(),
//toFile.getPath()
System.getProperty("java.home") + "/bin/java",
"-classpath",
PathManager.getLibPath() + "/util.jar",
WinUACTemporaryFix.class.getName(),
"copy",
fromFile.getPath(),
toFile.getPath(),
String.valueOf(syncTimestamp),
// vistalauncher hack
"install",
toFile.getParent()
});
}
catch (Exception ex) {
return false;
}
}