• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ConfigurationFromContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: createRunConfigurationFromContext

import com.intellij.execution.actions.ConfigurationFromContext; //导入依赖的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: testProducedFromFuncallExpression

import com.intellij.execution.actions.ConfigurationFromContext; //导入依赖的package包/类
@Test
public void testProducedFromFuncallExpression() {
  PsiFile buildFile =
      workspace.createPsiFile(
          new WorkspacePath("java/com/google/test/BUILD"), "java_test(name='unit_tests'");

  FuncallExpression target =
      PsiUtils.findFirstChildOfClassRecursive(buildFile, FuncallExpression.class);
  assertThat(target).isNotNull();

  ConfigurationContext context = createContextFromPsi(target);
  List<ConfigurationFromContext> configurations = context.getConfigurationsFromContext();
  assertThat(configurations).hasSize(1);

  ConfigurationFromContext fromContext = configurations.get(0);
  assertThat(fromContext.isProducedBy(BlazeBuildFileRunConfigurationProducer.class)).isTrue();
  assertThat(fromContext.getConfiguration()).isInstanceOf(BlazeCommandRunConfiguration.class);

  BlazeCommandRunConfiguration config =
      (BlazeCommandRunConfiguration) fromContext.getConfiguration();
  assertThat(config.getTarget())
      .isEqualTo(TargetExpression.fromStringSafe("//java/com/google/test:unit_tests"));
  assertThat(getCommandType(config)).isEqualTo(BlazeCommandName.TEST);
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:25,代码来源:BlazeBuildFileRunConfigurationProducerTest.java


示例3: testProducedWhenInsideFuncallExpression

import com.intellij.execution.actions.ConfigurationFromContext; //导入依赖的package包/类
@Test
public void testProducedWhenInsideFuncallExpression() {
  PsiFile buildFile =
      workspace.createPsiFile(
          new WorkspacePath("java/com/google/test/BUILD"), "java_test(name='unit_tests'");

  StringLiteral nameString =
      PsiUtils.findFirstChildOfClassRecursive(buildFile, StringLiteral.class);
  assertThat(nameString).isNotNull();

  ConfigurationContext context = createContextFromPsi(nameString);
  List<ConfigurationFromContext> configurations = context.getConfigurationsFromContext();
  assertThat(configurations).hasSize(1);

  ConfigurationFromContext fromContext = configurations.get(0);
  assertThat(fromContext.isProducedBy(BlazeBuildFileRunConfigurationProducer.class)).isTrue();
  assertThat(fromContext.getConfiguration()).isInstanceOf(BlazeCommandRunConfiguration.class);

  BlazeCommandRunConfiguration config =
      (BlazeCommandRunConfiguration) fromContext.getConfiguration();
  assertThat(config.getTarget())
      .isEqualTo(TargetExpression.fromStringSafe("//java/com/google/test:unit_tests"));
  assertThat(getCommandType(config)).isEqualTo(BlazeCommandName.TEST);
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:25,代码来源:BlazeBuildFileRunConfigurationProducerTest.java


示例4: testProducedFromPsiDirectory

import com.intellij.execution.actions.ConfigurationFromContext; //导入依赖的package包/类
@Test
public void testProducedFromPsiDirectory() {
  PsiDirectory directory =
      workspace.createPsiDirectory(new WorkspacePath("java/com/google/test"));
  workspace.createPsiFile(
      new WorkspacePath("java/com/google/test/BUILD"), "java_test(name='unit_tests'");

  ConfigurationContext context = createContextFromPsi(directory);
  List<ConfigurationFromContext> configurations = context.getConfigurationsFromContext();
  assertThat(configurations).hasSize(1);

  ConfigurationFromContext fromContext = configurations.get(0);
  assertThat(fromContext.isProducedBy(AllInPackageBlazeConfigurationProducer.class)).isTrue();
  assertThat(fromContext.getConfiguration()).isInstanceOf(BlazeCommandRunConfiguration.class);

  BlazeCommandRunConfiguration config =
      (BlazeCommandRunConfiguration) fromContext.getConfiguration();
  assertThat(config.getTarget())
      .isEqualTo(TargetExpression.fromStringSafe("//java/com/google/test/...:all"));
  assertThat(getCommandType(config)).isEqualTo(BlazeCommandName.TEST);
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:22,代码来源:AllInPackageBlazeConfigurationProducerTest.java


示例5: chooseSubclass

import com.intellij.execution.actions.ConfigurationFromContext; //导入依赖的package包/类
@VisibleForTesting
static void chooseSubclass(
    ConfigurationFromContext configuration,
    ConfigurationContext context,
    Runnable startRunnable) {
  RunConfiguration config = configuration.getConfiguration();
  if (!(config instanceof BlazeCommandRunConfiguration)) {
    return;
  }
  AbstractTestLocation location = locationFromConfiguration(configuration);
  if (location == null) {
    return;
  }
  SubclassTestChooser.chooseSubclass(
      context,
      location.abstractClass,
      (psiClass) -> {
        if (psiClass != null) {
          setupContext((BlazeCommandRunConfiguration) config, psiClass, location.method);
        }
        startRunnable.run();
      });
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:24,代码来源:BlazeJavaAbstractTestCaseConfigurationProducer.java


示例6: testIgnoreTestClassWitNoTestSubclasses

import com.intellij.execution.actions.ConfigurationFromContext; //导入依赖的package包/类
@Test
public void testIgnoreTestClassWitNoTestSubclasses() {
  PsiFile javaFile =
      createAndIndexFile(
          new WorkspacePath("java/com/google/test/TestClass.java"),
          "package com.google.test;",
          "@org.junit.runner.RunWith(org.junit.runners.JUnit4.class)",
          "public class TestClass {",
          "  @org.junit.Test",
          "  public void testMethod1() {}",
          "  @org.junit.Test",
          "  public void testMethod2() {}",
          "}");

  PsiClass javaClass = ((PsiClassOwner) javaFile).getClasses()[0];
  assertThat(javaClass).isNotNull();

  ConfigurationContext context = createContextFromPsi(javaClass);
  ConfigurationFromContext fromContext =
      new BlazeJavaAbstractTestCaseConfigurationProducer()
          .createConfigurationFromContext(context);
  assertThat(fromContext).isNull();
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:24,代码来源:BlazeJavaAbstractTestCaseConfigurationProducerTest.java


示例7: executeDebugRunner

import com.intellij.execution.actions.ConfigurationFromContext; //导入依赖的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


示例8: createConfigurationFromContext

import com.intellij.execution.actions.ConfigurationFromContext; //导入依赖的package包/类
@Nullable
@Override
public ConfigurationFromContext createConfigurationFromContext(ConfigurationContext context) {
  ConfigurationFromContext fromContext = super.createConfigurationFromContext(context);
  if (fromContext != null) {
    JavaRunConfigurationExtensionManager.getInstance().extendCreatedConfiguration((RunConfigurationBase)fromContext.getConfiguration(),
                                                                                  context.getLocation());
  }
  return fromContext;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:JavaRunConfigurationProducerBase.java


示例9: isPreferredConfiguration

import com.intellij.execution.actions.ConfigurationFromContext; //导入依赖的package包/类
@Override
public boolean isPreferredConfiguration(ConfigurationFromContext self, ConfigurationFromContext other) {
  final RunConfiguration configuration = self.getConfiguration();
  if (configuration instanceof PythonUnitTestRunConfiguration &&
      ((PythonUnitTestRunConfiguration)configuration).getTestType() == AbstractPythonTestRunConfiguration.TestType.TEST_FOLDER) {
    return true;
  }
  return other.isProducedBy(PythonTestConfigurationProducer.class) || other.isProducedBy(PythonRunConfigurationProducer.class);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:PythonTestConfigurationProducer.java


示例10: onFirstRun

import com.intellij.execution.actions.ConfigurationFromContext; //导入依赖的package包/类
@Override
public void onFirstRun(
    ConfigurationFromContext configuration,
    ConfigurationContext context,
    Runnable startRunnable) {
  chooseSubclass(configuration, context, startRunnable);
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:8,代码来源:BlazeJavaAbstractTestCaseConfigurationProducer.java


示例11: testNoFilterIfDirectoryAtPackageRoot

import com.intellij.execution.actions.ConfigurationFromContext; //导入依赖的package包/类
@Test
public void testNoFilterIfDirectoryAtPackageRoot() {
  MockBlazeProjectDataBuilder builder = MockBlazeProjectDataBuilder.builder(workspaceRoot);
  builder.setTargetMap(
      TargetMapBuilder.builder()
          .addTarget(
              TargetIdeInfo.builder()
                  .setKind("java_test")
                  .setLabel("//java/com/google/test:TestClass")
                  .addSource(sourceRoot("java/com/google/test/TestClass.java"))
                  .build())
          .build());
  registerProjectService(
      BlazeProjectDataManager.class, new MockBlazeProjectDataManager(builder.build()));

  PsiDirectory directory = workspace.createPsiDirectory(new WorkspacePath("java"));
  createAndIndexFile(
      new WorkspacePath("java/com/google/test/TestClass.java"),
      "package com.google.test;",
      "@org.junit.runner.RunWith(org.junit.runners.JUnit4.class)",
      "public class TestClass {",
      "  @org.junit.Test",
      "  public void testMethod() {}",
      "}");

  ConfigurationContext context = createContextFromPsi(directory);
  List<ConfigurationFromContext> configurations = context.getConfigurationsFromContext();
  assertThat(configurations).hasSize(1);

  ConfigurationFromContext fromContext = configurations.get(0);
  assertThat(fromContext.isProducedBy(MultipleJavaClassesTestConfigurationProducer.class))
      .isTrue();
  assertThat(fromContext.getConfiguration()).isInstanceOf(BlazeCommandRunConfiguration.class);

  BlazeCommandRunConfiguration config =
      (BlazeCommandRunConfiguration) fromContext.getConfiguration();
  assertThat(getTestFilterContents(config)).isNull();
  assertThat(config.getName()).isEqualTo("Blaze test test:TestClass");
  assertThat(getCommandType(config)).isEqualTo(BlazeCommandName.TEST);
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:41,代码来源:MultipleJavaClassesTestConfigurationProducerTest.java


示例12: testNotProducedFromNonTestFiles

import com.intellij.execution.actions.ConfigurationFromContext; //导入依赖的package包/类
@Test
public void testNotProducedFromNonTestFiles() {
  MockBlazeProjectDataBuilder builder = MockBlazeProjectDataBuilder.builder(workspaceRoot);
  builder.setTargetMap(
      TargetMapBuilder.builder()
          .addTarget(
              TargetIdeInfo.builder()
                  .setKind("java_test")
                  .setLabel("//java/com/google/test:allTests")
                  .addSource(sourceRoot("java/com/google/test/NonTestClass1.java"))
                  .addSource(sourceRoot("java/com/google/test/NonTestClass2.java"))
                  .build())
          .build());
  registerProjectService(
      BlazeProjectDataManager.class, new MockBlazeProjectDataManager(builder.build()));

  workspace.createPsiDirectory(new WorkspacePath("java/com/google/test"));
  PsiFile testClass1 =
      createAndIndexFile(
          new WorkspacePath("java/com/google/test/NonTestClass1.java"),
          "package com.google.test;",
          "public class NonTestClass1 {");
  PsiFile testClass2 =
      createAndIndexFile(
          new WorkspacePath("java/com/google/test/NonTestClass2.java"),
          "package com.google.test;",
          "public class NonTestClass2 {}");

  ConfigurationContext context =
      createContextFromMultipleElements(new PsiElement[] {testClass1, testClass2});
  ConfigurationFromContext fromContext =
      new MultipleJavaClassesTestConfigurationProducer().createConfigurationFromContext(context);
  assertThat(fromContext).isNull();
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:35,代码来源:MultipleJavaClassesTestConfigurationProducerTest.java


示例13: testProducedFromPyFile

import com.intellij.execution.actions.ConfigurationFromContext; //导入依赖的package包/类
@Test
public void testProducedFromPyFile() {
  PsiFile pyFile =
      createAndIndexFile(
          new WorkspacePath("py/test/unittest.py"),
          "class UnitTest(googletest.TestCase):",
          "  def testSomething():",
          "    return");

  MockBlazeProjectDataBuilder builder = MockBlazeProjectDataBuilder.builder(workspaceRoot);
  builder.setTargetMap(
      TargetMapBuilder.builder()
          .addTarget(
              TargetIdeInfo.builder()
                  .setKind("py_test")
                  .setLabel("//py/test:unittests")
                  .addSource(sourceRoot("py/test/unittest.py"))
                  .build())
          .build());
  registerProjectService(
      BlazeProjectDataManager.class, new MockBlazeProjectDataManager(builder.build()));

  ConfigurationContext context = createContextFromPsi(pyFile);
  List<ConfigurationFromContext> configurations = context.getConfigurationsFromContext();
  assertThat(configurations).hasSize(1);

  ConfigurationFromContext fromContext = configurations.get(0);
  assertThat(fromContext.isProducedBy(BlazePyTestConfigurationProducer.class)).isTrue();
  assertThat(fromContext.getConfiguration()).isInstanceOf(BlazeCommandRunConfiguration.class);

  BlazeCommandRunConfiguration config =
      (BlazeCommandRunConfiguration) fromContext.getConfiguration();
  assertThat(config.getTarget())
      .isEqualTo(TargetExpression.fromStringSafe("//py/test:unittests"));
  assertThat(getTestFilterContents(config)).isNull();
  assertThat(getCommandType(config)).isEqualTo(BlazeCommandName.TEST);
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:38,代码来源:BlazePyTestConfigurationProducerTest.java


示例14: testProducedFromPyClass

import com.intellij.execution.actions.ConfigurationFromContext; //导入依赖的package包/类
@Test
public void testProducedFromPyClass() {
  PsiFile pyFile =
      createAndIndexFile(
          new WorkspacePath("py/test/unittest.py"),
          "class UnitTest(googletest.TestCase):",
          "  def testSomething():",
          "    return");

  MockBlazeProjectDataBuilder builder = MockBlazeProjectDataBuilder.builder(workspaceRoot);
  builder.setTargetMap(
      TargetMapBuilder.builder()
          .addTarget(
              TargetIdeInfo.builder()
                  .setKind("py_test")
                  .setLabel("//py/test:unittests")
                  .addSource(sourceRoot("py/test/unittest.py"))
                  .build())
          .build());
  registerProjectService(
      BlazeProjectDataManager.class, new MockBlazeProjectDataManager(builder.build()));

  PyClass pyClass = PsiUtils.findFirstChildOfClassRecursive(pyFile, PyClass.class);
  assertThat(pyClass).isNotNull();

  ConfigurationContext context = createContextFromPsi(pyClass);
  List<ConfigurationFromContext> configurations = context.getConfigurationsFromContext();
  assertThat(configurations).hasSize(1);

  ConfigurationFromContext fromContext = configurations.get(0);
  assertThat(fromContext.isProducedBy(BlazePyTestConfigurationProducer.class)).isTrue();
  assertThat(fromContext.getConfiguration()).isInstanceOf(BlazeCommandRunConfiguration.class);

  BlazeCommandRunConfiguration config =
      (BlazeCommandRunConfiguration) fromContext.getConfiguration();
  assertThat(config.getTarget())
      .isEqualTo(TargetExpression.fromStringSafe("//py/test:unittests"));
  assertThat(getTestFilterContents(config)).isEqualTo("--test_filter=UnitTest");
  assertThat(getCommandType(config)).isEqualTo(BlazeCommandName.TEST);
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:41,代码来源:BlazePyTestConfigurationProducerTest.java


示例15: testProducedFromTestCase

import com.intellij.execution.actions.ConfigurationFromContext; //导入依赖的package包/类
@Test
public void testProducedFromTestCase() {
  PsiFile pyFile =
      createAndIndexFile(
          new WorkspacePath("py/test/unittest.py"),
          "class UnitTest(googletest.TestCase):",
          "  def testSomething():",
          "    return");

  MockBlazeProjectDataBuilder builder = MockBlazeProjectDataBuilder.builder(workspaceRoot);
  builder.setTargetMap(
      TargetMapBuilder.builder()
          .addTarget(
              TargetIdeInfo.builder()
                  .setKind("py_test")
                  .setLabel("//py/test:unittests")
                  .addSource(sourceRoot("py/test/unittest.py"))
                  .build())
          .build());
  registerProjectService(
      BlazeProjectDataManager.class, new MockBlazeProjectDataManager(builder.build()));

  PyFunction function = PsiUtils.findFirstChildOfClassRecursive(pyFile, PyFunction.class);
  assertThat(function).isNotNull();

  ConfigurationContext context = createContextFromPsi(function);
  List<ConfigurationFromContext> configurations = context.getConfigurationsFromContext();
  assertThat(configurations).hasSize(1);

  ConfigurationFromContext fromContext = configurations.get(0);
  assertThat(fromContext.isProducedBy(BlazePyTestConfigurationProducer.class)).isTrue();
  assertThat(fromContext.getConfiguration()).isInstanceOf(BlazeCommandRunConfiguration.class);

  BlazeCommandRunConfiguration config =
      (BlazeCommandRunConfiguration) fromContext.getConfiguration();
  assertThat(config.getTarget())
      .isEqualTo(TargetExpression.fromStringSafe("//py/test:unittests"));
  assertThat(getTestFilterContents(config)).isEqualTo("--test_filter=UnitTest.testSomething");
  assertThat(getCommandType(config)).isEqualTo(BlazeCommandName.TEST);
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:41,代码来源:BlazePyTestConfigurationProducerTest.java


示例16: testProducedFromPyFile

import com.intellij.execution.actions.ConfigurationFromContext; //导入依赖的package包/类
@Test
public void testProducedFromPyFile() {
  PsiFile pyFile =
      createAndIndexFile(
          new WorkspacePath("py/bin/main.py"),
          "def main():",
          "  return",
          "if __name__ == '__main__':",
          "  main()");

  workspace.createFile(new WorkspacePath("py/bin/BUILD"), "py_binary(name = 'main')");

  MockBlazeProjectDataBuilder builder = MockBlazeProjectDataBuilder.builder(workspaceRoot);
  builder.setTargetMap(
      TargetMapBuilder.builder()
          .addTarget(
              TargetIdeInfo.builder()
                  .setKind("py_binary")
                  .setLabel("//py/bin:main")
                  .addSource(sourceRoot("py/bin/main.py"))
                  .build())
          .build());
  registerProjectService(
      BlazeProjectDataManager.class, new MockBlazeProjectDataManager(builder.build()));

  ConfigurationContext context = createContextFromPsi(pyFile);
  List<ConfigurationFromContext> configurations = context.getConfigurationsFromContext();
  assertThat(configurations).hasSize(1);

  ConfigurationFromContext fromContext = configurations.get(0);
  assertThat(fromContext.isProducedBy(BlazePyBinaryConfigurationProducer.class)).isTrue();
  assertThat(fromContext.getConfiguration()).isInstanceOf(BlazeCommandRunConfiguration.class);

  BlazeCommandRunConfiguration config =
      (BlazeCommandRunConfiguration) fromContext.getConfiguration();
  assertThat(config.getTarget()).isEqualTo(TargetExpression.fromStringSafe("//py/bin:main"));
  assertThat(getCommandType(config)).isEqualTo(BlazeCommandName.RUN);
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:39,代码来源:BlazePyBinaryConfigurationProducerTest.java


示例17: testProducedFromGoFile

import com.intellij.execution.actions.ConfigurationFromContext; //导入依赖的package包/类
@Test
public void testProducedFromGoFile() {
  PsiFile goFile =
      createAndIndexFile(
          new WorkspacePath("foo/bar/foo_test.go"),
          "package foo",
          "import \"testing\"",
          "func TestFoo(t *testing.T) {}");

  MockBlazeProjectDataBuilder builder = MockBlazeProjectDataBuilder.builder(workspaceRoot);
  builder.setTargetMap(
      TargetMapBuilder.builder()
          .addTarget(
              TargetIdeInfo.builder()
                  .setKind("go_test")
                  .setLabel("//foo/bar:foo_test")
                  .addSource(sourceRoot("foo/bar/foo_test.go"))
                  .build())
          .build());
  registerProjectService(
      BlazeProjectDataManager.class, new MockBlazeProjectDataManager(builder.build()));

  ConfigurationContext context = createContextFromPsi(goFile);
  List<ConfigurationFromContext> configurations = context.getConfigurationsFromContext();
  assertThat(configurations).isNotNull();
  assertThat(configurations).hasSize(1);

  ConfigurationFromContext fromContext = configurations.get(0);
  assertThat(fromContext.isProducedBy(BlazeGoTestConfigurationProducer.class)).isTrue();
  assertThat(fromContext.getConfiguration()).isInstanceOf(BlazeCommandRunConfiguration.class);

  BlazeCommandRunConfiguration config =
      (BlazeCommandRunConfiguration) fromContext.getConfiguration();
  assertThat(config.getTarget()).isEqualTo(TargetExpression.fromStringSafe("//foo/bar:foo_test"));
  assertThat(getTestFilterContents(config)).isNull();
  assertThat(getCommandType(config)).isEqualTo(BlazeCommandName.TEST);
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:38,代码来源:BlazeGoTestConfigurationProducerTest.java


示例18: testProducedFromGoFile

import com.intellij.execution.actions.ConfigurationFromContext; //导入依赖的package包/类
@Test
public void testProducedFromGoFile() {
  PsiFile goFile =
      createAndIndexFile(new WorkspacePath("foo/bar/main.go"), "package main", "func main() {}");

  MockBlazeProjectDataBuilder builder = MockBlazeProjectDataBuilder.builder(workspaceRoot);
  builder.setTargetMap(
      TargetMapBuilder.builder()
          .addTarget(
              TargetIdeInfo.builder()
                  .setKind("go_binary")
                  .setLabel("//foo/bar:main")
                  .addSource(sourceRoot("foo/bar/main.go"))
                  .build())
          .build());
  registerProjectService(
      BlazeProjectDataManager.class, new MockBlazeProjectDataManager(builder.build()));

  ConfigurationContext context = createContextFromPsi(goFile);
  List<ConfigurationFromContext> configurations = context.getConfigurationsFromContext();
  assertThat(configurations).isNotNull();
  assertThat(configurations).hasSize(1);

  ConfigurationFromContext fromContext = configurations.get(0);
  assertThat(fromContext.isProducedBy(BlazeGoBinaryConfigurationProducer.class)).isTrue();
  assertThat(fromContext.getConfiguration()).isInstanceOf(BlazeCommandRunConfiguration.class);

  BlazeCommandRunConfiguration config =
      (BlazeCommandRunConfiguration) fromContext.getConfiguration();
  assertThat(config.getTarget()).isEqualTo(TargetExpression.fromStringSafe("//foo/bar:main"));
  assertThat(getCommandType(config)).isEqualTo(BlazeCommandName.RUN);
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:33,代码来源:BlazeGoBinaryConfigurationProducerTest.java


示例19: actionPerformed

import com.intellij.execution.actions.ConfigurationFromContext; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
    final DataContext dataContext = e.getDataContext();
    final ConfigurationContext context = ConfigurationContext.getFromContext(dataContext);
    if (context.getLocation() == null) return;
    final RunManagerEx runManager = (RunManagerEx) context.getRunManager();
    RunnerAndConfigurationSettings setting = context.getConfiguration();
    if (setting == null || setting.getConfiguration() == null || !(setting.getConfiguration() instanceof PTestRunConfiguration)) {
        ConfigurationFromContext config = CONFIG_PRODUCER.createConfigurationFromContext(context);
        if (config == null) return;
        setting = config.getConfigurationSettings();
        runManager.setTemporaryConfiguration(setting);
    } else {
        boolean hasExistingSetting = false;
        for (RunnerAndConfigurationSettings existingSetting : runManager.getConfigurationSettingsList(new PTestConfigurationType())) {
            if (existingSetting.equals(setting)) {
                hasExistingSetting = true;
                break;
            }
        }
        if (!hasExistingSetting) {
            runManager.setTemporaryConfiguration(setting);
        }
    }
    runManager.setSelectedConfiguration(setting);

    ExecutionUtil.runConfiguration(setting, myExecutor);
}
 
开发者ID:KarlGong,项目名称:ptest-pycharm-plugin,代码行数:29,代码来源:PTestRunLineMarkerAction.java


示例20: getExternalSystemRunConfiguration

import com.intellij.execution.actions.ConfigurationFromContext; //导入依赖的package包/类
@NotNull
private ExternalSystemRunConfiguration getExternalSystemRunConfiguration(PsiElement psiElement) {
  assertNotNull(psiElement);
  ConfigurationContext context = createContext(psiElement, new MapDataContext());
  assertNotNull(context);
  ConfigurationFromContext myPantsConfigurationFromContext = getPantsJunitConfigurationFromContext(context);
  assertNotNull(myPantsConfigurationFromContext);
  return (ExternalSystemRunConfiguration) myPantsConfigurationFromContext.getConfiguration();
}
 
开发者ID:pantsbuild,项目名称:intellij-pants-plugin,代码行数:10,代码来源:OSSPantsJvmRunConfigurationIntegrationTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PipelineResult类代码示例发布时间:2022-05-22
下一篇:
Java PopulatorTallGrass类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap