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


Java ConfigurationContext.getProject方法代码示例

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


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

示例1: setupConfigurationFromContext

import com.intellij.execution.actions.ConfigurationContext; //导入方法依赖的package包/类
@Override
protected boolean setupConfigurationFromContext(PyCCRunTestConfiguration configuration,
                                                ConfigurationContext context,
                                                Ref<PsiElement> sourceElement) {
  Project project = context.getProject();
  if (!CCUtils.isCourseCreator(project)) {
    return false;
  }

  String testsPath = getTestPath(context);
  if (testsPath == null) {
    return false;
  }
  VirtualFile testsFile = LocalFileSystem.getInstance().findFileByPath(testsPath);
  if (testsFile == null) {
    return false;
  }

  String generatedName = generateName(testsFile, project);
  if (generatedName == null) {
    return false;
  }

  configuration.setPathToTest(testsPath);
  configuration.setName(generatedName);
  return true;
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:28,代码来源:PyCCRunTestsConfigurationProducer.java

示例2: getSelectedSmRunnerTreeElements

import com.intellij.execution.actions.ConfigurationContext; //导入方法依赖的package包/类
public static List<Location<?>> getSelectedSmRunnerTreeElements(ConfigurationContext context) {
  Project project = context.getProject();
  List<SMTestProxy> tests = getSelectedTestProxies(context);
  return tests
      .stream()
      .map(test -> (Location<?>) test.getLocation(project, GlobalSearchScope.allScope(project)))
      .filter(Objects::nonNull)
      .collect(Collectors.toList());
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:10,代码来源:SmRunnerUtils.java

示例3: setupConfigurationFromContext

import com.intellij.execution.actions.ConfigurationContext; //导入方法依赖的package包/类
@Override
protected boolean setupConfigurationFromContext(TestNGConfiguration configuration,
                                                ConfigurationContext context,
                                                Ref<PsiElement> sourceElement) {
  if (RunConfigurationProducer.getInstance(AbstractTestNGPatternConfigurationProducer.class).isMultipleElementsSelected(context)) {
    return false;
  }

  final Location contextLocation = context.getLocation();
  setupConfigurationParamName(configuration, contextLocation);

  PsiClass psiClass = null;
  PsiElement element = context.getPsiLocation();
  while (element != null) {
    if (element instanceof PsiClass && isTestNGClass((PsiClass)element)) {
      psiClass = (PsiClass)element;
      break;
    }
    else if (element instanceof PsiMember) {
      psiClass = ((PsiMember)element).getContainingClass();
      if (isTestNGClass(psiClass)) {
        break;
      }
    }
    else if (element instanceof PsiClassOwner) {
      final PsiClass[] classes = ((PsiClassOwner)element).getClasses();
      if (classes.length == 1) {
        psiClass = classes[0];
        break;
      }
    }
    element = element.getParent();
  }
  if (!isTestNGClass(psiClass)) return false;

  myPsiElement = psiClass;
  final Project project = context.getProject();
  RunnerAndConfigurationSettings settings = cloneTemplateConfiguration(context);
  setupConfigurationModule(context, configuration);
  final Module originalModule = configuration.getConfigurationModule().getModule();
  configuration.setClassConfiguration(psiClass);

  PsiMethod method = PsiTreeUtil.getParentOfType(context.getPsiLocation(), PsiMethod.class, false);
  while (method != null) {
    if (TestNGUtil.hasTest(method)) {
      configuration.setMethodConfiguration(PsiLocation.fromPsiElement(project, method));
      myPsiElement = method;
    }
    method = PsiTreeUtil.getParentOfType(method, PsiMethod.class);
  }

  configuration.restoreOriginalModule(originalModule);
  settings.setName(configuration.getName());
  sourceElement.set(myPsiElement);
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:57,代码来源:AbstractTestNGInClassConfigurationProducer.java


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