com.intellij.execution.configurations.ModuleBasedConfiguration Java Examples

The following examples show how to use com.intellij.execution.configurations.ModuleBasedConfiguration. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProjectExecutor.java    From tmc-intellij with MIT License 6 votes vote down vote up
public void executeConfiguration(Project project, ModuleBasedConfiguration appCon) {
    if (noProjectsAreOpen()) {
        logger.warn("No open projects found, can't execute the project.");
        return;
    }
    logger.info("Starting to build execution environment.");
    RunManager runManager = RunManager.getInstance(project);
    Executor executor = DefaultRunExecutor.getRunExecutorInstance();
    RunnerAndConfigurationSettingsImpl selectedConfiguration =
            getApplicationRunnerAndConfigurationSettings(runManager, appCon);
    ProgramRunner runner = getRunner(executor, selectedConfiguration);
    logger.info("Creating ExecutionEnvironment.");
    ExecutionEnvironment environment =
            new ExecutionEnvironment(
                    new DefaultRunExecutor(), runner, selectedConfiguration, project);
    try {
        logger.info("Executing project.");
        runner.execute(environment);
    } catch (ExecutionException e1) {
        JavaExecutionUtil.showExecutionErrorMessage(e1, "Error", project);
    }
}
 
Example #2
Source File: HaxeCompiler.java    From intellij-haxe with Apache License 2.0 6 votes vote down vote up
private static ProcessingItem[] run(CompileContext context,
                                    ProcessingItem[] items,
                                    ModuleBasedConfiguration configuration) {
  final Module module = configuration.getConfigurationModule().getModule();
  if (module == null) {
    context.addMessage(CompilerMessageCategory.ERROR,
                       HaxeBundle.message("no.module.for.run.configuration", configuration.getName()), null, -1, -1);
    return ProcessingItem.EMPTY_ARRAY;
  }
  HaxeCommonCompilerUtil.CompilationContext compilationContext = createCompilationContext(context, module, configuration);

  if (compileModule(context, module, compilationContext)) {
    final int index = findProcessingItemIndexByModule(items, configuration.getConfigurationModule());
    if (index != -1) {
      return new ProcessingItem[]{items[index]};
    }
  }
  return ProcessingItem.EMPTY_ARRAY;
}
 
Example #3
Source File: TrackCoverageAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nullable
private CoverageSuitesBundle getCurrentCoverageSuite() {
  if (myModel == null) {
    return null;
  }

  final RunProfile runConf = myModel.getProperties().getConfiguration();
  if (runConf instanceof ModuleBasedConfiguration) {

    // if coverage supported for run configuration
    if (CoverageEnabledConfiguration.isApplicableTo((ModuleBasedConfiguration) runConf)) {

      // Get coverage settings
      Executor executor = myProperties.getExecutor();
      if (executor != null && executor.getId().equals(CoverageExecutor.EXECUTOR_ID)) {
        return CoverageDataManager.getInstance(myProperties.getProject()).getCurrentSuitesBundle();
      }
    }
  }
  return null;
}
 
Example #4
Source File: ProjectExecutor.java    From tmc-intellij with MIT License 5 votes vote down vote up
@NotNull
private RunnerAndConfigurationSettingsImpl getApplicationRunnerAndConfigurationSettings(
        RunManager runManager, ModuleBasedConfiguration appCon) {
    logger.info("Getting RunnerAndConfigurationSettings implementation.");
    return new RunnerAndConfigurationSettingsImpl(
            (RunManagerImpl) runManager,
            appCon,
            runManager.getSelectedConfiguration().isTemplate());
}
 
Example #5
Source File: ProgramParametersConfigurator.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
protected Module getModule(CommonProgramRunConfigurationParameters configuration) {
  if (configuration instanceof ModuleBasedConfiguration) {
    return ((ModuleBasedConfiguration)configuration).getConfigurationModule().getModule();
  }
  return null;
}
 
Example #6
Source File: CoverageSuitesBundle.java    From consulo with Apache License 2.0 5 votes vote down vote up
private GlobalSearchScope getSearchScopeInner(Project project) {
  final RunConfigurationBase configuration = getRunConfiguration();
  if (configuration instanceof ModuleBasedConfiguration) {
    final Module module = ((ModuleBasedConfiguration)configuration).getConfigurationModule().getModule();
    if (module != null) {
      return GlobalSearchScope.moduleRuntimeScope(module, isTrackTestFolders());
    }
  }
  return isTrackTestFolders() ? GlobalSearchScope.projectScope(project) : GlobalSearchScopesCore.projectProductionScope(project);
}
 
Example #7
Source File: XQueryRunConfigurationProducer.java    From intellij-xquery with Apache License 2.0 5 votes vote down vote up
private void setupConfigurationModule(@Nullable ConfigurationContext context,
                                      ModuleBasedConfiguration configuration) {
    if (context != null) {
        Module module = getModule(context, configuration);
        if (module != null) {
            configuration.setModule(module);
        }
    }
}
 
Example #8
Source File: ConfigurationModuleSelector.java    From intellij-xquery with Apache License 2.0 5 votes vote down vote up
public void reset(final ModuleBasedConfiguration configuration) {
    final Module[] modules = ModuleManager.getInstance(getProject()).getModules();
    final List<Module> list = new ArrayList<>();
    for (final Module module : modules) {
        if (isModuleAccepted(module)) list.add(module);
    }
    setModules(list);
    myModulesList.setSelectedItem(configuration.getConfigurationModule().getModule());
}
 
Example #9
Source File: HaxeCompiler.java    From intellij-haxe with Apache License 2.0 5 votes vote down vote up
@Override
public ProcessingItem[] process(CompileContext context, ProcessingItem[] items) {
  final RunConfiguration runConfiguration = CompileStepBeforeRun.getRunConfiguration(context.getCompileScope());
  if (runConfiguration instanceof ModuleBasedConfiguration) {
    return run(context, items, (ModuleBasedConfiguration)runConfiguration);
  }
  return make(context, items);
}
 
Example #10
Source File: PantsClasspathRunConfigurationExtension.java    From intellij-pants-plugin with Apache License 2.0 5 votes vote down vote up
@Nullable
private <T extends RunConfigurationBase> Module findPantsModule(T configuration) {
  if (!(configuration instanceof ModuleBasedConfiguration)) {
    return null;
  }
  final RunConfigurationModule runConfigurationModule = ((ModuleBasedConfiguration) configuration).getConfigurationModule();
  final Module module = runConfigurationModule.getModule();
  if (module == null || !PantsUtil.isPantsModule(module)) {
    return null;
  }
  return module;
}
 
Example #11
Source File: ConfigurationModuleSelector.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
public void applyTo(final ModuleBasedConfiguration configurationModule) {
    configurationModule.setModule((Module) myModulesList.getSelectedItem());
}
 
Example #12
Source File: XQueryRunConfiguration.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
@Override
protected ModuleBasedConfiguration createInstance() {
    return new XQueryRunConfiguration(getName(), new XQueryRunConfigurationModule(getProject()),
            XQueryRunConfigurationType.getInstance().getConfigurationFactories()[0]);
}
 
Example #13
Source File: XQueryRunConfigurationProducer.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
private Module getModule(ConfigurationContext context, ModuleBasedConfiguration configuration) {
    Module module = getPredefinedModule(context);
    if (module == null)
        module = getModuleForLocation(context, configuration);
    return module;
}
 
Example #14
Source File: XQueryRunConfigurationProducer.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
private Module getModuleForLocation(ConfigurationContext context, ModuleBasedConfiguration configuration) {
    final Module contextModule = context.getModule();
    return findModule(configuration, contextModule);
}
 
Example #15
Source File: XQueryRunConfigurationProducer.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
private Module findModule(ModuleBasedConfiguration configuration, Module contextModule) {
    if (configuration.getConfigurationModule().getModule() == null && contextModule != null) {
        return contextModule;
    }
    return null;
}
 
Example #16
Source File: XQueryRunConfigurationProducer.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
private Module getPredefinedModule(RunnerAndConfigurationSettings template) {
    return ((ModuleBasedConfiguration) template.getConfiguration()).getConfigurationModule().getModule();
}
 
Example #17
Source File: XQueryRunProfileState.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
private Module getModule(CommonProgramRunConfigurationParameters configuration) {
    return configuration instanceof ModuleBasedConfiguration ? ((ModuleBasedConfiguration) configuration).getConfigurationModule().getModule() : null;
}
 
Example #18
Source File: TestSearchScope.java    From consulo with Apache License 2.0 4 votes vote down vote up
public SourceScope getSourceScope(final ModuleBasedConfiguration configuration) {
  return SourceScope.wholeProject(configuration.getProject());
}
 
Example #19
Source File: TestSearchScope.java    From consulo with Apache License 2.0 4 votes vote down vote up
public SourceScope getSourceScope(final ModuleBasedConfiguration configuration) {
  return SourceScope.modules(configuration.getModules());
}
 
Example #20
Source File: TestSearchScope.java    From consulo with Apache License 2.0 4 votes vote down vote up
public SourceScope getSourceScope(final ModuleBasedConfiguration configuration) {
  return SourceScope.modulesWithDependencies(configuration.getModules());
}
 
Example #21
Source File: HaxeApplicationConfiguration.java    From intellij-haxe with Apache License 2.0 4 votes vote down vote up
@Override
protected ModuleBasedConfiguration createInstance() {
  return new HaxeApplicationConfiguration(getName(), getProject(), HaxeRunConfigurationType.getInstance());
}
 
Example #22
Source File: TestSearchScope.java    From consulo with Apache License 2.0 votes vote down vote up
SourceScope getSourceScope(ModuleBasedConfiguration configuration);