本文整理汇总了Java中com.intellij.util.PathUtil.getLocalPath方法的典型用法代码示例。如果您正苦于以下问题:Java PathUtil.getLocalPath方法的具体用法?Java PathUtil.getLocalPath怎么用?Java PathUtil.getLocalPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.PathUtil
的用法示例。
在下文中一共展示了PathUtil.getLocalPath方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toRelativePath
import com.intellij.util.PathUtil; //导入方法依赖的package包/类
/**
* Get relative file
*
* @param file a valid file (must be either belong to {@link com.intellij.openapi.vfs.LocalFileSystem} or to point to the root entry on
* {@link com.intellij.openapi.vfs.JarFileSystem}.
* @param baseDir base director for relative path calculation
* @param baseDirPropertyName property name for the base directory
* @param genOptions generation options
* @return a relative path
*/
@Nullable
public static String toRelativePath(final VirtualFile file,
final File baseDir,
final String baseDirPropertyName,
final GenerationOptions genOptions) {
final String localPath = PathUtil.getLocalPath(file);
if (localPath == null) {
return null;
}
return toRelativePath(localPath, baseDir, baseDirPropertyName, genOptions);
}
示例2: sdkPath
import com.intellij.util.PathUtil; //导入方法依赖的package包/类
@Nullable
static String sdkPath(@Nullable Sdk anyJdk) {
if (anyJdk == null) {
return null;
}
String jdkHomePath = PathUtil.getLocalPath(anyJdk.getHomeDirectory());
if (jdkHomePath != null) {
jdkHomePath = jdkHomePath.replace('/', File.separatorChar);
}
return jdkHomePath;
}
示例3: expand
import com.intellij.util.PathUtil; //导入方法依赖的package包/类
@Nullable
@Override
public String expand(DataContext dataContext) throws ExecutionCancelledException {
Module module = LangDataKeys.MODULE.getData(dataContext);
if (module == null) {
Project project = CommonDataKeys.PROJECT.getData(dataContext);
if (project == null) {
return null;
}
Module[] modules = ModuleManager.getInstance(project).getModules();
if (modules.length == 0) {
return null;
}
module = modules[0];
}
Sdk sdk = PythonSdkType.findPythonSdk(module);
if (sdk != null) {
VirtualFile homeDir = sdk.getHomeDirectory();
if (homeDir == null) {
return null;
}
String path = PathUtil.getLocalPath(homeDir.getParent());
if (path != null) {
return FileUtil.toSystemDependentName(path);
}
}
return null;
}
示例4: toAbsolutePath
import com.intellij.util.PathUtil; //导入方法依赖的package包/类
@Nullable
private String toAbsolutePath(String genRelativePath) {
if (genRelativePath == null) {
return null;
}
if (genRelativePath.length() == 0) {
return "";
}
String moduleDirPath = AndroidRootUtil.getModuleDirPath(myContext.getModule());
if (moduleDirPath == null) return null;
final String path = PathUtil.getCanonicalPath(new File(moduleDirPath, genRelativePath).getPath());
return path != null ? PathUtil.getLocalPath(path) : null;
}
示例5: AntHectorConfigurable
import com.intellij.util.PathUtil; //导入方法依赖的package包/类
public AntHectorConfigurable(XmlFile file) {
myFile = file;
myProject = file.getProject();
final VirtualFile selfVFile = myFile.getVirtualFile();
myLocalPath = PathUtil.getLocalPath(selfVFile);
myFileFilter = GlobalSearchScope.projectScope(myProject);
}
示例6: getGantLibraryHome
import com.intellij.util.PathUtil; //导入方法依赖的package包/类
public static String getGantLibraryHome(VirtualFile[] files) {
for (VirtualFile file : files) {
if (isGantJarFile(file.getName())) {
final VirtualFile parent = LibrariesUtil.getLocalFile(file).getParent();
if (parent != null) {
final VirtualFile gantHome = parent.getParent();
if (gantHome != null) {
return PathUtil.getLocalPath(gantHome);
}
}
}
}
return "";
}
示例7: getFSPath
import com.intellij.util.PathUtil; //导入方法依赖的package包/类
private static String getFSPath(VirtualFile output) {
return PathUtil.getLocalPath(output);
}
示例8: getDefaultWorkingDir
import com.intellij.util.PathUtil; //导入方法依赖的package包/类
@Nullable
protected String getDefaultWorkingDir(@NotNull Project project) {
return PathUtil.getLocalPath(project.getBaseDir());
}
示例9: GroovyScriptRunConfiguration
import com.intellij.util.PathUtil; //导入方法依赖的package包/类
public GroovyScriptRunConfiguration(final String name, final Project project, final ConfigurationFactory factory) {
super(name, new RunConfigurationModule(project), factory);
workDir = PathUtil.getLocalPath(project.getBaseDir());
}