Search in sources :

Example 1 with GoApplicationConfiguration

use of com.goide.runconfig.application.GoApplicationConfiguration in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoRunConfigurationProducerTest method testSameRunApplicationConfigurationOnPackage.

public void testSameRunApplicationConfigurationOnPackage() {
    PsiFile file = myFixture.configureByText("a.go", "package main; <caret>\nfunc main() {}");
    PsiElement at = file.findElementAt(myFixture.getCaretOffset());
    assertNotNull(at);
    ConfigurationContext configurationContext = new ConfigurationContext(at);
    GoApplicationRunConfigurationProducer producer = new GoApplicationRunConfigurationProducer();
    GoApplicationConfiguration runConfiguration = createRunAppFileConfiguration(file.getVirtualFile().getPath());
    assertTrue(producer.isConfigurationFromContext(runConfiguration, configurationContext));
    runConfiguration = createRunAppFileConfiguration(file.getVirtualFile().getPath() + "_vl");
    assertFalse(producer.isConfigurationFromContext(runConfiguration, configurationContext));
}
Also used : ConfigurationContext(com.intellij.execution.actions.ConfigurationContext) GoApplicationRunConfigurationProducer(com.goide.runconfig.application.GoApplicationRunConfigurationProducer) PsiFile(com.intellij.psi.PsiFile) GoApplicationConfiguration(com.goide.runconfig.application.GoApplicationConfiguration) PsiElement(com.intellij.psi.PsiElement)

Example 2 with GoApplicationConfiguration

use of com.goide.runconfig.application.GoApplicationConfiguration in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoRunConfigurationProducerTest method testSameRunApplicationConfigurationOnDirectory.

public void testSameRunApplicationConfigurationOnDirectory() {
    PsiFile file = myFixture.addFileToProject("import/path/a.go", "package main; func main(){}");
    PsiDirectory directory = file.getParent();
    assertNotNull(directory);
    ConfigurationContext configurationContext = new ConfigurationContext(directory);
    GoApplicationRunConfigurationProducer producer = new GoApplicationRunConfigurationProducer();
    GoApplicationConfiguration runConfiguration = createRunAppPackageConfiguration("import/path");
    assertTrue(producer.isConfigurationFromContext(runConfiguration, configurationContext));
    runConfiguration = createRunAppPackageConfiguration("import/path/other");
    assertFalse(producer.isConfigurationFromContext(runConfiguration, configurationContext));
}
Also used : ConfigurationContext(com.intellij.execution.actions.ConfigurationContext) GoApplicationRunConfigurationProducer(com.goide.runconfig.application.GoApplicationRunConfigurationProducer) PsiDirectory(com.intellij.psi.PsiDirectory) PsiFile(com.intellij.psi.PsiFile) GoApplicationConfiguration(com.goide.runconfig.application.GoApplicationConfiguration)

Example 3 with GoApplicationConfiguration

use of com.goide.runconfig.application.GoApplicationConfiguration in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoRunConfigurationProducerTest method createRunAppPackageConfiguration.

private GoApplicationConfiguration createRunAppPackageConfiguration(String importPath) {
    GoApplicationRunConfigurationType type = GoApplicationRunConfigurationType.getInstance();
    GoApplicationConfiguration result = new GoApplicationConfiguration(myFixture.getProject(), "run package", type);
    result.setKind(GoApplicationConfiguration.Kind.PACKAGE);
    result.setPackage(importPath);
    return result;
}
Also used : GoApplicationRunConfigurationType(com.goide.runconfig.application.GoApplicationRunConfigurationType) GoApplicationConfiguration(com.goide.runconfig.application.GoApplicationConfiguration)

Example 4 with GoApplicationConfiguration

use of com.goide.runconfig.application.GoApplicationConfiguration in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoRunConfigurationProducerTest method createRunAppFileConfiguration.

private GoApplicationConfiguration createRunAppFileConfiguration(String filePath) {
    GoRunFileConfigurationType type = GoRunFileConfigurationType.getInstance();
    GoApplicationConfiguration result = new GoApplicationConfiguration(myFixture.getProject(), "run file", type);
    result.setKind(GoApplicationConfiguration.Kind.FILE);
    result.setFilePath(filePath);
    return result;
}
Also used : GoRunFileConfigurationType(com.goide.runconfig.file.GoRunFileConfigurationType) GoApplicationConfiguration(com.goide.runconfig.application.GoApplicationConfiguration)

Aggregations

GoApplicationConfiguration (com.goide.runconfig.application.GoApplicationConfiguration)4 GoApplicationRunConfigurationProducer (com.goide.runconfig.application.GoApplicationRunConfigurationProducer)2 ConfigurationContext (com.intellij.execution.actions.ConfigurationContext)2 PsiFile (com.intellij.psi.PsiFile)2 GoApplicationRunConfigurationType (com.goide.runconfig.application.GoApplicationRunConfigurationType)1 GoRunFileConfigurationType (com.goide.runconfig.file.GoRunFileConfigurationType)1 PsiDirectory (com.intellij.psi.PsiDirectory)1 PsiElement (com.intellij.psi.PsiElement)1