当前位置: 首页>>代码示例>>Java>>正文


Java Location.getVirtualFile方法代码示例

本文整理汇总了Java中com.intellij.execution.Location.getVirtualFile方法的典型用法代码示例。如果您正苦于以下问题:Java Location.getVirtualFile方法的具体用法?Java Location.getVirtualFile怎么用?Java Location.getVirtualFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.execution.Location的用法示例。


在下文中一共展示了Location.getVirtualFile方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTestSpec

import com.intellij.execution.Location; //导入方法依赖的package包/类
public String getTestSpec(Location location) {
  PsiElement element = location.getPsiElement();
  PyClass pyClass = PsiTreeUtil.getParentOfType(element, PyClass.class, false);
  PyFunction pyFunction = PsiTreeUtil.getParentOfType(element, PyFunction.class, false);
  final VirtualFile virtualFile = location.getVirtualFile();
  if (virtualFile != null) {
    String path = virtualFile.getCanonicalPath();
    if (pyClass != null) {
      path += "::" + pyClass.getName();
    }
    if (pyFunction != null) {
      path += "::" + pyFunction.getName();
    }
    return path;
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:AbstractPythonRunConfiguration.java

示例2: getTestPath

import com.intellij.execution.Location; //导入方法依赖的package包/类
@Nullable
private static String getTestPath(@NotNull ConfigurationContext context) {
  Location location = context.getLocation();
  if (location == null) {
    return null;
  }
  VirtualFile file = location.getVirtualFile();
  if (file == null) {
    return null;
  }
  VirtualFile taskDir = StudyUtils.getTaskDir(file);
  if (taskDir == null) {
    return null;
  }

  Task task = StudyUtils.getTask(location.getProject(), taskDir);
  if (task == null) {
    return null;
  }
  String testsFileName = PyEduPluginConfigurator.getSubtaskTestsFileName(task instanceof TaskWithSubtasks ?
                                                                     ((TaskWithSubtasks)task).getActiveSubtaskIndex() : 0);
  String taskDirPath = FileUtil.toSystemDependentName(taskDir.getPath());
  String testsPath = taskDir.findChild(EduNames.SRC) != null ?
                     FileUtil.join(taskDirPath, EduNames.SRC, testsFileName) :
                     FileUtil.join(taskDirPath, testsFileName);
  String filePath = FileUtil.toSystemDependentName(file.getPath());
  return filePath.equals(testsPath) ? testsPath : null;
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:29,代码来源:PyCCRunTestsConfigurationProducer.java

示例3: generateScriptParameters

import com.intellij.execution.Location; //导入方法依赖的package包/类
/**
 * Generate the script parameters to pass into a PythonRunConfiguration.
 *
 * @param context The context for which to generate parameters.
 * @return The calculated script parameters or null.
 */
@Nullable
public static String generateScriptParameters(ConfigurationContext context) {
    Location location = context.getLocation();
    if (location == null) return null;

    VirtualFile migrationFile = location.getVirtualFile();
    if (migrationFile == null || !canPerformAction(migrationFile)) return null;

    String appName = getAppName(migrationFile);
    String migrationName = getMigrationName(migrationFile);

    return "migrate " + appName + " " + migrationName;
}
 
开发者ID:chornsby,项目名称:django-migrations-pycharm-plugin,代码行数:20,代码来源:MigrationUtils.java

示例4: getJarFileFromContext

import com.intellij.execution.Location; //导入方法依赖的package包/类
@Nullable
private static VirtualFile getJarFileFromContext(ConfigurationContext context) {
  Location location = context.getLocation();
  if (location == null) return null;

  VirtualFile file = location.getVirtualFile();
  return file != null && FileUtilRt.extensionEquals(file.getName(), "jar") ? file : null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:JarApplicationConfigurationProducer.java

示例5: setupConfigurationFromContext

import com.intellij.execution.Location; //导入方法依赖的package包/类
@Override
protected boolean setupConfigurationFromContext(JavaScratchConfiguration configuration, ConfigurationContext context, Ref<PsiElement> sourceElement) {
  final Location location = context.getLocation();
  if (location != null) {
    final VirtualFile vFile = location.getVirtualFile();
    if (vFile instanceof VirtualFileWithId && vFile.getFileType() == ScratchFileType.INSTANCE) {
      final PsiFile psiFile = location.getPsiElement().getContainingFile();
      if (psiFile != null && psiFile.getLanguage() == JavaLanguage.INSTANCE) {
        configuration.SCRATCH_FILE_ID = ((VirtualFileWithId)vFile).getId();
        return super.setupConfigurationFromContext(configuration, context, sourceElement);
      }
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:JavaScratchConfigurationProducer.java


注:本文中的com.intellij.execution.Location.getVirtualFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。