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


Java RunConfigurationProducer类代码示例

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


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

示例1: createRunConfigurationFromContext

import com.intellij.execution.actions.RunConfigurationProducer; //导入依赖的package包/类
/**
 * Creates run configuration from right click menu
 *
 * @param fixture       test fixture
 * @param expectedClass expected class of run configuration
 * @param <C>           expected class of run configuration
 * @return configuration (if created) or null (otherwise)
 */
@Nullable
public static <C extends RunConfiguration> C createRunConfigurationFromContext(
  @NotNull final CodeInsightTestFixture fixture,
  @NotNull final Class<C> expectedClass) {
  final DataContext context = DataManager.getInstance().getDataContext(fixture.getEditor().getComponent());
  for (final RunConfigurationProducer<?> producer : RunConfigurationProducer.EP_NAME.getExtensions()) {
    final ConfigurationFromContext fromContext = producer.createConfigurationFromContext(ConfigurationContext.getFromContext(context));
    if (fromContext == null) {
      continue;
    }
    final C result = PyUtil.as(fromContext.getConfiguration(), expectedClass);
    if (result != null) {
      return result;
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:PyTestCase.java

示例2: bePatternConfiguration

import com.intellij.execution.actions.RunConfigurationProducer; //导入依赖的package包/类
public void bePatternConfiguration(List<PsiClass> classes, PsiMethod method) {
  data.TEST_OBJECT = TestType.PATTERN.getType();
  final String suffix;
  if (method != null) {
    data.METHOD_NAME = method.getName();
    suffix = "," + data.METHOD_NAME;
  } else {
    suffix = "";
  }
  LinkedHashSet<String> patterns = new LinkedHashSet<String>();
  for (PsiClass pattern : classes) {
    patterns.add(JavaExecutionUtil.getRuntimeQualifiedName(pattern) + suffix);
  }
  data.setPatterns(patterns);
  final Module module = RunConfigurationProducer.getInstance(AbstractTestNGPatternConfigurationProducer.class)
    .findModule(this, getConfigurationModule().getModule(), patterns);
  if (module == null) {
    data.setScope(TestSearchScope.WHOLE_PROJECT);
    setModule(null);
  }
  else {
    setModule(module);
  }
  setGeneratedName();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:TestNGConfiguration.java

示例3: bePatternConfiguration

import com.intellij.execution.actions.RunConfigurationProducer; //导入依赖的package包/类
public void bePatternConfiguration(List<PsiClass> classes, PsiMethod method) {
  myData.TEST_OBJECT = TEST_PATTERN;
  final LinkedHashSet<String> patterns = new LinkedHashSet<String>();
  final String methodSufiix;
  if (method != null) {
    myData.METHOD_NAME = method.getName();
    methodSufiix = "," + myData.METHOD_NAME;
  } else {
    methodSufiix = "";
  }
  for (PsiClass pattern : classes) {
    patterns.add(JavaExecutionUtil.getRuntimeQualifiedName(pattern) + methodSufiix);
  }
  myData.setPatterns(patterns);
  final Module module = RunConfigurationProducer.getInstance(PatternConfigurationProducer.class).findModule(this, getConfigurationModule()
    .getModule(), patterns);
  if (module == null) {
    myData.setScope(TestSearchScope.WHOLE_PROJECT);
    setModule(null);
  } else {
    setModule(module);
  }
  setGeneratedName();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:JUnitConfiguration.java

示例4: executeDebugRunner

import com.intellij.execution.actions.RunConfigurationProducer; //导入依赖的package包/类
/**
 * Run tests for given element
 *
 * @param psiElement Elements are PhpClass or Method possible context
 */
public static void executeDebugRunner(@NotNull PsiElement psiElement) {
    ConfigurationFromContext context = RunConfigurationProducer.getInstance(BehatRuntimeConfigurationProducer.class)
        .createConfigurationFromContext(new ConfigurationContext(psiElement));

    if(context != null) {
        ProgramRunnerUtil.executeConfiguration(
            psiElement.getProject(),
            context.getConfigurationSettings(),
            DefaultDebugExecutor.getDebugExecutorInstance()
        );
    }
}
 
开发者ID:Haehnchen,项目名称:idea-php-behat-plugin,代码行数:18,代码来源:BehatPluginUtil.java

示例5: isConfigurationFromContext

import com.intellij.execution.actions.RunConfigurationProducer; //导入依赖的package包/类
@Override
public boolean isConfigurationFromContext(TestNGConfiguration testNGConfiguration, ConfigurationContext context) {
  if (RunConfigurationProducer.getInstance(AbstractTestNGPatternConfigurationProducer.class).isMultipleElementsSelected(context)) {
    return false;
  }
  final RunConfiguration predefinedConfiguration = context.getOriginalConfiguration(TestNGConfigurationType.getInstance());
  final Location contextLocation = context.getLocation();
  if (contextLocation == null) {
    return false;
  }
  Location location = JavaExecutionUtil.stepIntoSingleClass(contextLocation);
  if (location == null) {
    return false;
  }
  final PsiElement element = location.getPsiElement();
  RunnerAndConfigurationSettings template = RunManager.getInstance(location.getProject()).getConfigurationTemplate(getConfigurationFactory());
  final Module predefinedModule = ((TestNGConfiguration)template.getConfiguration()).getConfigurationModule().getModule();
  final String vmParameters =
    predefinedConfiguration instanceof TestNGConfiguration ? ((TestNGConfiguration)predefinedConfiguration).getVMParameters() : null;
  if (vmParameters != null && !Comparing.strEqual(vmParameters, testNGConfiguration.getVMParameters())) return false;
  String paramSetName = contextLocation instanceof PsiMemberParameterizedLocation
                        ? getInvocationNumber(((PsiMemberParameterizedLocation)contextLocation).getParamSetName()) : null;
  if (paramSetName != null && !Comparing.strEqual(paramSetName, testNGConfiguration.getProgramParameters())) return false;
  TestNGTestObject testobject = TestNGTestObject.fromConfig(testNGConfiguration);
  if (testobject != null) {
    if (testobject.isConfiguredByElement(element)) {
      final Module configurationModule = testNGConfiguration.getConfigurationModule().getModule();
      if (Comparing.equal(location.getModule(), configurationModule)) return true;
      if (Comparing.equal(predefinedModule, configurationModule)) return true;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:TestNGConfigurationProducer.java

示例6: getProducers

import com.intellij.execution.actions.RunConfigurationProducer; //导入依赖的package包/类
private static Collection<Class<? extends RunConfigurationProducer<?>>> getProducers(
    String pluginId, Collection<String> qualifiedClassNames) {
  // rather than compiling against additional plugins, and including a switch in the our
  // plugin.xml, just get the classes manually via the plugin class loader.
  IdeaPluginDescriptor plugin = PluginManager.getPlugin(PluginId.getId(pluginId));
  if (plugin == null || !plugin.isEnabled()) {
    return ImmutableList.of();
  }
  ClassLoader loader = plugin.getPluginClassLoader();
  return qualifiedClassNames
      .stream()
      .map((qualifiedName) -> loadClass(loader, qualifiedName))
      .filter(Objects::nonNull)
      .collect(Collectors.toList());
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:16,代码来源:NonBlazeProducerSuppressor.java

示例7: loadClass

import com.intellij.execution.actions.RunConfigurationProducer; //导入依赖的package包/类
@Nullable
private static Class<RunConfigurationProducer<?>> loadClass(
    ClassLoader loader, String qualifiedName) {
  try {
    Class<?> clazz = loader.loadClass(qualifiedName);
    if (RunConfigurationProducer.class.isAssignableFrom(clazz)) {
      return (Class<RunConfigurationProducer<?>>) clazz;
    }
    return null;
  } catch (ClassNotFoundException | NoClassDefFoundError ignored) {
    return null;
  }
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:14,代码来源:NonBlazeProducerSuppressor.java

示例8: suppressProducers

import com.intellij.execution.actions.RunConfigurationProducer; //导入依赖的package包/类
private static void suppressProducers(Project project) {
  RunConfigurationProducerService producerService =
      RunConfigurationProducerService.getInstance(project);
  ImmutableList.<Class<? extends RunConfigurationProducer<?>>>builder()
      .addAll(JavaConfigurationProducerList.PRODUCERS_TO_SUPPRESS)
      .addAll(getProducers(KOTLIN_PLUGIN_ID, KOTLIN_PRODUCERS))
      .addAll(getProducers(ANDROID_PLUGIN_ID, ANDROID_PRODUCERS))
      .build()
      .forEach(producerService::addIgnoredProducer);
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:11,代码来源:NonBlazeProducerSuppressor.java

示例9: suppressProducers

import com.intellij.execution.actions.RunConfigurationProducer; //导入依赖的package包/类
@VisibleForTesting
@SuppressWarnings("unchecked")
static void suppressProducers(Project project) {
  RunConfigurationProducerService producerService =
      RunConfigurationProducerService.getInstance(project);
  PyConfigurationProducersList.PRODUCERS_TO_SUPPRESS.forEach(
      (klass) -> {
        if (RunConfigurationProducer.class.isAssignableFrom(klass)) {
          producerService.addIgnoredProducer((Class<RunConfigurationProducer<?>>) klass);
        }
      });
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:13,代码来源:NonBlazeProducerSuppressor.java

示例10: getPantsJunitConfigurationFromContext

import com.intellij.execution.actions.RunConfigurationProducer; //导入依赖的package包/类
private ConfigurationFromContext getPantsJunitConfigurationFromContext(ConfigurationContext context) {
  assertNotNull(context);
  List<RunConfigurationProducer<?>> producers = RunConfigurationProducer.getProducers(myProject);
  assertTrue(producers.size() > 0);
  for (RunConfigurationProducer producer : producers) {
    if (producer instanceof PantsJUnitTestRunConfigurationProducer) {
      return producer.createConfigurationFromContext(context);
    }
  }
  return null;
}
 
开发者ID:pantsbuild,项目名称:intellij-pants-plugin,代码行数:12,代码来源:OSSPantsJvmRunConfigurationIntegrationTest.java

示例11: getPantsPytestConfigurationFromContext

import com.intellij.execution.actions.RunConfigurationProducer; //导入依赖的package包/类
private ConfigurationFromContext getPantsPytestConfigurationFromContext(ConfigurationContext context) {
  for (RunConfigurationProducer producer : RunConfigurationProducer.getProducers(myProject)) {
    if (producer instanceof PantsPythonTestRunConfigurationProducer) {
      return producer.createConfigurationFromContext(context);
    }
  }
  return null;
}
 
开发者ID:pantsbuild,项目名称:intellij-pants-plugin,代码行数:9,代码来源:OSSPantsPythonRunConfigurationIntegrationTest.java

示例12: addIgnoredProducer

import com.intellij.execution.actions.RunConfigurationProducer; //导入依赖的package包/类
public void addIgnoredProducer(@NotNull Class<? extends RunConfigurationProducer<?>> ignoredProducer) {
  myState.ignoredProducers.add(ignoredProducer.getName());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:RunConfigurationProducerService.java

示例13: isIgnored

import com.intellij.execution.actions.RunConfigurationProducer; //导入依赖的package包/类
public boolean isIgnored(RunConfigurationProducer<?> producer) {
  return myState.ignoredProducers.contains(producer.getClass().getName());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:RunConfigurationProducerService.java

示例14: getPatternBasedProducer

import com.intellij.execution.actions.RunConfigurationProducer; //导入依赖的package包/类
@Override
@NotNull
protected AbstractTestNGPatternConfigurationProducer getPatternBasedProducer() {
  return RunConfigurationProducer.getInstance(AbstractTestNGPatternConfigurationProducer.class);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:TestNGAddToTestsPatternAction.java

示例15: setupConfigurationFromContext

import com.intellij.execution.actions.RunConfigurationProducer; //导入依赖的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.RunConfigurationProducer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。