com.intellij.execution.configurations.ConfigurationFactory Java Examples
The following examples show how to use
com.intellij.execution.configurations.ConfigurationFactory.
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: XQueryRunConfiguration.java From intellij-xquery with Apache License 2.0 | 6 votes |
public XQueryRunConfiguration(String name, XQueryRunConfigurationModule configurationModule, ConfigurationFactory factory, VariablesValidator variablesValidator, ContextItemValidator contextItemValidator, DataSourceValidator dataSourceValidator, AlternativeJreValidator alternativeJreValidator, ModuleValidator moduleValidator, XmlConfigurationAccessor xmlConfigurationAccessor, VariablesAccessor variablesAccessor) { super(name, configurationModule, factory); this.variablesValidator = variablesValidator; this.contextItemValidator = contextItemValidator; this.dataSourceValidator = dataSourceValidator; this.alternativeJreValidator = alternativeJreValidator; this.moduleValidator = moduleValidator; this.xmlConfigurationAccessor = xmlConfigurationAccessor; this.variablesAccessor = variablesAccessor; setWorkingDirectory(getProject().getBasePath()); }
Example #2
Source File: TestConfigurationTest.java From buck with Apache License 2.0 | 6 votes |
public void testPersistency() throws Exception { final ConfigurationFactory factory = TestConfigurationType.getInstance().getConfigurationFactories()[0]; final TestConfiguration cfg = new TestConfiguration(getProject(), factory, "test serialization"); cfg.data.targets = "//src/com/facebook/buck:test"; cfg.data.testSelectors = "com.facebook.buck.Test"; cfg.data.additionalParams = "--num-threads 239"; final Element testElement = new Element("test_element"); cfg.writeExternal(testElement); final TestConfiguration cfg2 = new TestConfiguration(getProject(), factory, "test serialization"); cfg2.readExternal(testElement); Assert.assertEquals("//src/com/facebook/buck:test", cfg2.data.targets); Assert.assertEquals("com.facebook.buck.Test", cfg2.data.testSelectors); Assert.assertEquals("--num-threads 239", cfg2.data.additionalParams); }
Example #3
Source File: PantsIntegrationTestCase.java From intellij-pants-plugin with Apache License 2.0 | 6 votes |
/** * TODO: ScalaTestRunConfiguration setting may not be fully correct yet. Currently this can only be used to invoke scala runner, * but the run itself may not succeed. */ @NotNull protected ScalaTestRunConfiguration generateScalaRunConfiguration(String moduleName, String className) { ConfigurationFactory factory = Stream.of(ScalaTestConfigurationType.CONFIGURATION_TYPE_EP.getExtensions()) .filter(s -> s instanceof ScalaTestConfigurationType) .findFirst() .get() .getConfigurationFactories()[0]; final ScalaTestRunConfiguration runConfiguration = new ScalaTestRunConfiguration(myProject, factory, className); runConfiguration.setModule(getModule(moduleName)); runConfiguration.setName(className); runConfiguration.setupIntegrationTestClassPath(); SingleTestData data = new SingleTestData(runConfiguration); data.setTestClassPath(className); runConfiguration.testConfigurationData_$eq(data); runConfiguration.testConfigurationData().setWorkingDirectory(PantsUtil.findBuildRoot(getModule(moduleName)).get().getCanonicalPath()); return runConfiguration; }
Example #4
Source File: XQueryRunConfigurationTest.java From intellij-xquery with Apache License 2.0 | 6 votes |
@Override public void setUp() throws Exception { super.setUp(); XQueryRunConfigurationModule module = new XQueryRunConfigurationModule(getProject()); XQueryRunConfigurationType type = new XQueryRunConfigurationType(); ConfigurationFactory factory = new XQueryRunConfigurationFactory(XQUERY_MAIN_MODULE, type); variablesValidator = mock(VariablesValidator.class); contextItemValidator = mock(ContextItemValidator.class); dataSourceValidator = mock(DataSourceValidator.class); alternativeJreValidator = mock(AlternativeJreValidator.class); moduleValidator = mock(ModuleValidator.class); xmlConfigurationAccessor = mock(XmlConfigurationAccessor.class); variablesAccessor = mock(VariablesAccessor.class); configuration = new TestXQueryRunConfiguration(XQUERY_MAIN_MODULE, module, factory, variablesValidator, contextItemValidator, dataSourceValidator, alternativeJreValidator, moduleValidator, xmlConfigurationAccessor, variablesAccessor); configuration.setVariables(variables); configuration.setDataSourceName(DATA_SOURCE_NAME); }
Example #5
Source File: AbstractRunConfigurationTypeUsagesCollector.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull @Override public final Set<UsageDescriptor> getProjectUsages(@Nonnull final Project project) { final Set<String> runConfigurationTypes = new HashSet<String>(); UIUtil.invokeAndWaitIfNeeded(new Runnable() { @Override public void run() { if (project.isDisposed()) return; final RunManager runManager = RunManager.getInstance(project); for (RunConfiguration runConfiguration : runManager.getAllConfigurationsList()) { if (runConfiguration != null && isApplicable(runManager, runConfiguration)) { final ConfigurationFactory configurationFactory = runConfiguration.getFactory(); final ConfigurationType configurationType = configurationFactory.getType(); final StringBuilder keyBuilder = new StringBuilder(); keyBuilder.append(configurationType.getId()); if (configurationType.getConfigurationFactories().length > 1) { keyBuilder.append(".").append(configurationFactory.getName()); } runConfigurationTypes.add(keyBuilder.toString()); } } } }); return ContainerUtil.map2Set(runConfigurationTypes, runConfigurationType -> new UsageDescriptor(runConfigurationType, 1)); }
Example #6
Source File: BaseExecuteBeforeRunDialog.java From consulo with Apache License 2.0 | 6 votes |
@Override protected void doOKAction() { final RunManagerImpl runManager = (RunManagerImpl)RunManagerEx.getInstanceEx(myProject); for (Enumeration nodes = myRoot.depthFirstEnumeration(); nodes.hasMoreElements(); ) { final DefaultMutableTreeNode node = (DefaultMutableTreeNode)nodes.nextElement(); final Descriptor descriptor = (Descriptor)node.getUserObject(); final boolean isChecked = descriptor.isChecked(); if (descriptor instanceof ConfigurationTypeDescriptor) { ConfigurationTypeDescriptor typeDesc = (ConfigurationTypeDescriptor)descriptor; for (ConfigurationFactory factory : typeDesc.getConfigurationType().getConfigurationFactories()) { RunnerAndConfigurationSettings settings = runManager.getConfigurationTemplate(factory); update(settings.getConfiguration(), isChecked, runManager); } } else if (descriptor instanceof ConfigurationDescriptor) { ConfigurationDescriptor configDesc = (ConfigurationDescriptor)descriptor; update(configDesc.getConfiguration(), isChecked, runManager); } } RunManagerImpl.getInstanceImpl(myProject).fireBeforeRunTasksUpdated(); close(OK_EXIT_CODE); }
Example #7
Source File: HaxeProjectConfigurationUpdater.java From intellij-haxe with Apache License 2.0 | 6 votes |
private void setupHxmlRunConfigurations(Module module) { RunManager manager = RunManager.getInstance(module.getProject()); HaxeRunConfigurationType configType = HaxeRunConfigurationType.getInstance(); ConfigurationFactory factory = configType.getConfigurationFactories()[0]; HaxeModuleSettings settings = HaxeModuleSettings.getInstance(module); String hxmlPath = settings.getHxmlPath(); if(hxmlPath != null && !hxmlPath.isEmpty()) { HaxeApplicationConfiguration config = (HaxeApplicationConfiguration)factory.createTemplateConfiguration(module.getProject()); config.setName(module.getName() + " " + new File(hxmlPath).getName()); config.setModule(module); RunnerAndConfigurationSettings runSettings = manager.createConfiguration(config, factory); manager.addConfiguration(runSettings, false); manager.setSelectedConfiguration(runSettings); } }
Example #8
Source File: HaxeModuleBuilder.java From intellij-haxe with Apache License 2.0 | 6 votes |
private void createDefaultRunConfiguration(Module module, String buildHxmlPath) { HaxeModuleSettings settings = HaxeModuleSettings.getInstance(module); settings.setHaxeTarget(HaxeTarget.INTERP); settings.setBuildConfig(HaxeConfiguration.HXML.asBuildConfigValue()); settings.setHxmlPath(buildHxmlPath); RunManager manager = RunManager.getInstance(module.getProject()); HaxeRunConfigurationType configType = HaxeRunConfigurationType.getInstance(); if(manager.getConfigurationsList(configType).isEmpty()) { ConfigurationFactory factory = configType.getConfigurationFactories()[0]; HaxeApplicationConfiguration config = (HaxeApplicationConfiguration)factory.createTemplateConfiguration(module.getProject()); config.setName("Execute"); config.setModule(module); RunnerAndConfigurationSettings runSettings = manager.createConfiguration(config, factory); manager.addConfiguration(runSettings, false); manager.setSelectedConfiguration(runSettings); } }
Example #9
Source File: AbstractExternalSystemTaskConfigurationType.java From consulo with Apache License 2.0 | 5 votes |
protected AbstractExternalSystemTaskConfigurationType(@Nonnull final ProjectSystemId externalSystemId) { myExternalSystemId = externalSystemId; myFactories[0] = new ConfigurationFactory(this) { @Override public RunConfiguration createTemplateConfiguration(Project project) { return doCreateConfiguration(myExternalSystemId, project, this, ""); } }; }
Example #10
Source File: BaseExecuteBeforeRunDialog.java From consulo with Apache License 2.0 | 5 votes |
private boolean isConfigurationAssigned(ConfigurationType type) { final RunManagerEx runManager = RunManagerEx.getInstanceEx(myProject); for (ConfigurationFactory factory : type.getConfigurationFactories()) { final RunnerAndConfigurationSettings settings = ((RunManagerImpl)runManager).getConfigurationTemplate(factory); if (isConfigurationAssigned(settings.getConfiguration())) return true; } return false; }
Example #11
Source File: AbstractExternalSystemTaskConfigurationType.java From consulo with Apache License 2.0 | 5 votes |
@SuppressWarnings("MethodMayBeStatic") @Nonnull protected ExternalSystemRunConfiguration doCreateConfiguration(@Nonnull ProjectSystemId externalSystemId, @Nonnull Project project, @Nonnull ConfigurationFactory factory, @Nonnull String name) { return new ExternalSystemRunConfiguration(externalSystemId, project, factory, name); }
Example #12
Source File: TaskConfiguration.java From JHelper with GNU Lesser General Public License v3.0 | 5 votes |
public TaskConfiguration(Project project, ConfigurationFactory factory) { super(project, factory, ""); className = ""; cppPath = ""; input = new StreamConfiguration(StreamConfiguration.StreamType.STANDARD); output = new StreamConfiguration(StreamConfiguration.StreamType.STANDARD); testType = TestType.SINGLE; tests = new Test[0]; }
Example #13
Source File: BlazeCommandRunConfiguration.java From intellij with Apache License 2.0 | 5 votes |
public BlazeCommandRunConfiguration(Project project, ConfigurationFactory factory, String name) { super(project, factory, name); // start with whatever fallback is present handlerProvider = BlazeCommandRunConfigurationHandlerProvider.findHandlerProvider(TargetState.KNOWN, null); handler = handlerProvider.createHandler(this); try { handler.getState().readExternal(blazeElementState); } catch (InvalidDataException e) { logger.error(e); } }
Example #14
Source File: ReplRunConfiguration.java From reasonml-idea-plugin with MIT License | 5 votes |
ReplRunConfiguration(@NotNull Project project, @NotNull ConfigurationFactory factory, String name) { super(project, factory, name); ProjectSdksModel model = new ProjectSdksModel(); model.reset(getProject()); for (Sdk sdk : model.getSdks()) { if ("OCaml SDK".equals(sdk.getSdkType().getName())) { m_sdk = sdk; return; } } }
Example #15
Source File: BlazeRunConfigurationFactory.java From intellij with Apache License 2.0 | 5 votes |
/** Constructs and initializes {@link RunnerAndConfigurationSettings} for the given rule. */ public RunnerAndConfigurationSettings createForTarget( Project project, RunManager runManager, Label target) { ConfigurationFactory factory = getConfigurationFactory(); RunConfiguration configuration = factory.createTemplateConfiguration(project, runManager); setupConfiguration(configuration, target); return runManager.createConfiguration(configuration, factory); }
Example #16
Source File: BlazeIntellijPluginConfiguration.java From intellij with Apache License 2.0 | 5 votes |
public BlazeIntellijPluginConfiguration( Project project, ConfigurationFactory factory, String name, @Nullable Label initialTarget) { super(project, factory, name); this.buildSystem = Blaze.buildSystemName(project); Sdk projectSdk = ProjectRootManager.getInstance(project).getProjectSdk(); if (IdeaJdkHelper.isIdeaJdk(projectSdk)) { pluginSdk = projectSdk; } target = initialTarget; blazeFlags = new RunConfigurationFlagsState(USER_BLAZE_FLAG_TAG, buildSystem + " flags:"); exeFlags = new RunConfigurationFlagsState(USER_EXE_FLAG_TAG, "Executable flags:"); }
Example #17
Source File: LocalServerRunConfiguration.java From consulo with Apache License 2.0 | 5 votes |
public LocalServerRunConfiguration(Project project, ConfigurationFactory factory, String name, ServerType<S> serverType, DeploymentConfigurator<D> deploymentConfigurator, LocalRunner localRunner) { super(project, factory, name); myServerType = serverType; myDeploymentConfigurator = deploymentConfigurator; myLocalRunner = localRunner; }
Example #18
Source File: ProgramRunnerUtil.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull public static Image getRawIcon(RunnerAndConfigurationSettings settings) { RunConfiguration configuration = settings.getConfiguration(); ConfigurationFactory factory = settings.getFactory(); Image icon = factory != null ? factory.getIcon(configuration) : null; if (icon == null) icon = AllIcons.RunConfigurations.Unknown; return icon; }
Example #19
Source File: PantsIntegrationTestCase.java From intellij-pants-plugin with Apache License 2.0 | 5 votes |
@NotNull protected JUnitConfiguration generateJUnitConfiguration(String moduleName, String className, @Nullable String vmParams) { final ConfigurationFactory factory = JUnitConfigurationType.getInstance().getConfigurationFactories()[0]; final JUnitConfiguration runConfiguration = new JUnitConfiguration("Pants: " + className, myProject, factory); runConfiguration.setWorkingDirectory(PantsUtil.findBuildRoot(getModule(moduleName)).get().getCanonicalPath()); runConfiguration.setModule(getModule(moduleName)); runConfiguration.setName(className); if (StringUtil.isNotEmpty(vmParams)) { runConfiguration.setVMParameters(vmParams); } runConfiguration.setMainClass(findClassAndAssert(className)); return runConfiguration; }
Example #20
Source File: XQueryRunConfigurationTest.java From intellij-xquery with Apache License 2.0 | 5 votes |
public TestXQueryRunConfiguration(String name, XQueryRunConfigurationModule configurationModule, ConfigurationFactory factory, VariablesValidator variablesValidator, ContextItemValidator contextItemValidator, DataSourceValidator dataSourceValidator, AlternativeJreValidator alternativeJreValidator, ModuleValidator moduleValidator, XmlConfigurationAccessor xmlConfigurationAccessor, VariablesAccessor variablesAccessor) { super(name, configurationModule, factory, variablesValidator, contextItemValidator, dataSourceValidator, alternativeJreValidator, moduleValidator, xmlConfigurationAccessor, variablesAccessor); }
Example #21
Source File: IntelliJRunnerAddressInvocationTest.java From intellij-pants-plugin with Apache License 2.0 | 5 votes |
public void testJavaRunnerAddressInvoked() { ApplicationManager.getApplication().runWriteAction(() -> { HashSet<String> address1 = Sets.newHashSet("x:x"); HashSet<String> address2 = Sets.newHashSet("y:y"); HashSet<String> address3 = Sets.newHashSet("z:z"); Module module1 = createModuleWithSerializedAddresses("a", address1); Module module2 = createModuleWithSerializedAddresses("b", address2); Module module3 = createModuleWithSerializedAddresses("c", address3); // Make module1 depend on module2 and module3 ModifiableRootModel model = ModuleRootManager.getInstance(module1).getModifiableModel(); model.addModuleOrderEntry(module2); model.addModuleOrderEntry(module3); model.commit(); assertTrue(ModuleManager.getInstance(myProject).isModuleDependent(module1, module2)); assertTrue(ModuleManager.getInstance(myProject).isModuleDependent(module1, module3)); // Make JUnit configuration for that module. final ConfigurationFactory factory = JUnitConfigurationType.getInstance().getConfigurationFactories()[0]; final JUnitConfiguration configuration = new JUnitConfiguration("dummy", myProject, factory); configuration.setModule(module1); // Make sure there is only one and the only address that gets passed to Pants. PantsMakeBeforeRun run = new PantsMakeBeforeRun(myProject); Set<String> addressesToCompile = run.getTargetAddressesToCompile(configuration); assertEquals(address1, addressesToCompile); }); }
Example #22
Source File: CppRemoteDebugConfigurationType.java From CppTools with Apache License 2.0 | 5 votes |
public CppRemoteDebugConfigurationType() { myFactory = new ConfigurationFactory(this) { public RunConfiguration createTemplateConfiguration(Project project) { return new CppRemoteDebugConfiguration(project, this, ""); } }; }
Example #23
Source File: GaugeRunProcessHandler.java From Intellij-Plugin with Apache License 2.0 | 5 votes |
private static void launchDebugger(final Project project, final GaugeDebugInfo debugInfo) { Runnable runnable = () -> { final long startTime = System.currentTimeMillis(); GenericDebuggerRunner basicProgramRunner = new GenericDebuggerRunner(); RunManagerImpl manager = new RunManagerImpl(project); ConfigurationFactory configFactory = RemoteConfigurationType.getInstance().getConfigurationFactories()[0]; RemoteConfiguration remoteConfig = new RemoteConfiguration(project, configFactory); remoteConfig.PORT = debugInfo.getPort(); remoteConfig.HOST = debugInfo.getHost(); remoteConfig.USE_SOCKET_TRANSPORT = true; remoteConfig.SERVER_MODE = false; RunnerAndConfigurationSettingsImpl configuration = new RunnerAndConfigurationSettingsImpl(manager, remoteConfig, false); ExecutionEnvironment environment = new ExecutionEnvironment(new DefaultDebugExecutor(), basicProgramRunner, configuration, project); boolean debuggerConnected = false; // Trying to connect to gauge java for 25 secs. The sleep is because it may take a few seconds for gauge to launch the java process and the jvm to load after that while (!debuggerConnected && ((System.currentTimeMillis() - startTime) < 25000)) { try { Thread.sleep(5000); basicProgramRunner.execute(environment); debuggerConnected = true; } catch (Exception e) { System.err.println("Failed to connect debugger. Retrying... : " + e.getMessage()); LOG.debug(e); } } }; ApplicationManager.getApplication().invokeAndWait(runnable, ModalityState.any()); }
Example #24
Source File: XQueryRunConfiguration.java From intellij-xquery with Apache License 2.0 | 5 votes |
public XQueryRunConfiguration(String name, XQueryRunConfigurationModule configurationModule, ConfigurationFactory factory) { this(name, configurationModule, factory, new VariablesValidator(), new ContextItemValidator(), new DataSourceValidator(), new AlternativeJreValidator(), new ModuleValidator(), new XmlConfigurationAccessor(), new VariablesAccessor()); setWorkingDirectory(getProject().getBasePath()); }
Example #25
Source File: GaugeRunTaskConfigurationType.java From Intellij-Plugin with Apache License 2.0 | 5 votes |
public GaugeRunTaskConfigurationType() { super("executeSpecs", "Gauge Execution", "Execute the gauge tests", AllIcons.Actions.Execute); final ConfigurationFactory scenarioConfigFactory = new ConfigurationFactoryEx(this) { @Override public RunConfiguration createTemplateConfiguration(Project project) { return new GaugeRunConfiguration("Gauge Execution", project, this); } }; addFactory(scenarioConfigFactory); }
Example #26
Source File: RunConfigurationProducer.java From consulo with Apache License 2.0 | 4 votes |
protected RunConfigurationProducer(final ConfigurationFactory configurationFactory) { myConfigurationFactory = configurationFactory; }
Example #27
Source File: OCamlApplicationConfiguration.java From reasonml-idea-plugin with MIT License | 4 votes |
public OCamlApplicationConfiguration(String name, @NotNull OCamlModuleBasedConfiguration configurationModule, @NotNull ConfigurationFactory factory) { super(name, configurationModule, factory); }
Example #28
Source File: RunConfigurationProducer.java From consulo with Apache License 2.0 | 4 votes |
public ConfigurationFactory getConfigurationFactory() { return myConfigurationFactory; }
Example #29
Source File: XQueryRunConfigurationType.java From intellij-xquery with Apache License 2.0 | 4 votes |
@Override public ConfigurationFactory[] getConfigurationFactories() { return new ConfigurationFactory[]{new XQueryRunConfigurationFactory(XQUERY_MAIN_MODULE, getInstance())}; }
Example #30
Source File: SandConfigurationType.java From consulo with Apache License 2.0 | 4 votes |
@Override public ConfigurationFactory[] getConfigurationFactories() { return new ConfigurationFactory[] {myConfigurationFactory}; }