本文整理汇总了Java中com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl类的典型用法代码示例。如果您正苦于以下问题:Java RunnerAndConfigurationSettingsImpl类的具体用法?Java RunnerAndConfigurationSettingsImpl怎么用?Java RunnerAndConfigurationSettingsImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RunnerAndConfigurationSettingsImpl类属于com.intellij.execution.impl包,在下文中一共展示了RunnerAndConfigurationSettingsImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: executeConfiguration
import com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl; //导入依赖的package包/类
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);
}
}
示例2: testRenameBadTestClass
import com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl; //导入依赖的package包/类
public void testRenameBadTestClass() throws IOException {
PsiClass psiClass = mySource.createClass("NotATest", NOT_A_TEST);
assertNotNull(psiClass);
JUnitConfigurationType instance = JUnitConfigurationType.getInstance();
assertNotNull(instance);
JUnitConfiguration configuration = new JUnitConfiguration("notATest", myProject, instance.getConfigurationFactories()[0]);
configuration.setMainClass(psiClass);
configuration.setModule(configuration.getValidModules().iterator().next());
checkConfigurationException("NotATest isn't test class", configuration);
RunManagerEx.getInstanceEx(myProject).setTemporaryConfiguration(new RunnerAndConfigurationSettingsImpl(null, configuration, false));
rename(psiClass, "NotATest2");
JUnitConfiguration.Data data = configuration.getPersistentData();
assertEquals("NotATest2", data.getMainClassName());
data.METHOD_NAME = "test";
data.TEST_OBJECT = JUnitConfiguration.TEST_METHOD;
checkConfigurationException("Test method 'test' doesn't exist", configuration);
rename(psiClass.findMethodsByName("test", false)[0], "test2");
assertEquals("NotATest2", data.getMainClassName());
assertEquals("test2", data.getMethodName());
}
示例3: getTarget
import com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl; //导入依赖的package包/类
public ExecutionTarget getTarget() {
if (myTargetId != null) {
if (DefaultExecutionTarget.INSTANCE.getId().equals(myTargetId)) {
return DefaultExecutionTarget.INSTANCE;
}
final RunnerAndConfigurationSettingsImpl settings =
new RunnerAndConfigurationSettingsImpl(RunManagerImpl.getInstanceImpl(myProject), myConfiguration, false);
for (ExecutionTargetProvider provider : Extensions.getExtensions(ExecutionTargetProvider.EXTENSION_NAME)) {
for (ExecutionTarget target : provider.getTargets(myProject, settings)) {
if (myTargetId.equals(target.getId())) {
return target;
}
}
}
return null;
}
return DefaultExecutionTarget.INSTANCE;
}
示例4: testRenameBadTestClass
import com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl; //导入依赖的package包/类
public void testRenameBadTestClass() throws IOException {
PsiClass psiClass = mySource.createClass("NotATest", NOT_A_TEST);
JUnitConfiguration configuration = new JUnitConfiguration("notATest", myProject, JUnitConfigurationType.getInstance().getConfigurationFactories()[0]);
configuration.setMainClass(psiClass);
configuration.setModule(configuration.getValidModules().iterator().next());
checkConfigurationException("NotATest isn't test class", configuration);
RunManagerEx.getInstanceEx(myProject).setTemporaryConfiguration(new RunnerAndConfigurationSettingsImpl(null, configuration, false));
rename(psiClass, "NotATest2");
JUnitConfiguration.Data data = configuration.getPersistentData();
assertEquals("NotATest2", data.getMainClassName());
data.METHOD_NAME = "test";
data.TEST_OBJECT = JUnitConfiguration.TEST_METHOD;
checkConfigurationException("Test method 'test' doesn't exist", configuration);
rename(psiClass.findMethodsByName("test", false)[0], "test2");
assertEquals("NotATest2", data.getMainClassName());
assertEquals("test2", data.getMethodName());
}
示例5: getTarget
import com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl; //导入依赖的package包/类
public ExecutionTarget getTarget() {
if (myTargetId != null) {
if (DefaultExecutionTarget.INSTANCE.getId().equals(myTargetId)) {
return DefaultExecutionTarget.INSTANCE;
}
final RunnerAndConfigurationSettingsImpl settings =
new RunnerAndConfigurationSettingsImpl(RunManagerImpl.getInstanceImpl(myProject), myConfiguration, false);
for (ExecutionTargetProvider provider : Extensions.getExtensions(ExecutionTargetProvider.EXTENSION_NAME)) {
for (ExecutionTarget target : provider.getTargets(myProject, settings)) {
if (myTargetId.equals(target.getId())) {
return target;
}
}
}
return null;
}
return DefaultExecutionTarget.INSTANCE;
}
示例6: getApplicationRunnerAndConfigurationSettings
import com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl; //导入依赖的package包/类
@NotNull
private RunnerAndConfigurationSettingsImpl getApplicationRunnerAndConfigurationSettings(
RunManager runManager, ModuleBasedConfiguration appCon) {
logger.info("Getting RunnerAndConfigurationSettings implementation.");
return new RunnerAndConfigurationSettingsImpl(
(RunManagerImpl) runManager,
appCon,
runManager.getSelectedConfiguration().isTemplate());
}
示例7: createJUnitConfiguration
import com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl; //导入依赖的package包/类
@Override
protected JUnitConfiguration createJUnitConfiguration(@NotNull PsiElement psiElement,
@NotNull Class<? extends JUnitConfigurationProducer> producerClass,
@NotNull MapDataContext dataContext) {
final JUnitConfiguration configuration = super.createJUnitConfiguration(psiElement, producerClass, dataContext);
RunManagerEx.getInstanceEx(myProject).setTemporaryConfiguration(new RunnerAndConfigurationSettingsImpl(null, configuration, false));
return configuration;
}
示例8: createConfiguration
import com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl; //导入依赖的package包/类
@Nullable
private static ConfigurationFromContext createConfiguration(RunConfigurationProducer<?> producer,
ConfigurationContext context) {
RunConfiguration configuration = producer.createLightConfiguration(context);
if (configuration == null) return null;
RunnerAndConfigurationSettingsImpl
settings = new RunnerAndConfigurationSettingsImpl(RunManagerImpl.getInstanceImpl(context.getProject()), configuration, false);
return new ConfigurationFromContextImpl(producer, settings, context.getPsiLocation());
}
示例9: getDefaultOptionIndex
import com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl; //导入依赖的package包/类
@Override
public int getDefaultOptionIndex() {
final RunnerAndConfigurationSettings currentConfiguration = RunManager.getInstance(myProject).getSelectedConfiguration();
if (currentConfiguration == null && myDefaultConfiguration != -1) {
return myDefaultConfiguration;
}
return currentConfiguration instanceof RunnerAndConfigurationSettingsImpl ? getValues()
.indexOf(ItemWrapper.wrap(myProject, currentConfiguration)) : -1;
}
示例10: onChosen
import com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl; //导入依赖的package包/类
@Override
public PopupStep onChosen(final ItemWrapper wrapper, boolean finalChoice) {
if (myAction.myEditConfiguration) {
final Object o = wrapper.getValue();
if (o instanceof RunnerAndConfigurationSettingsImpl) {
return doFinalStep(new Runnable() {
@Override
public void run() {
myAction.editConfiguration(myProject, (RunnerAndConfigurationSettings)o);
}
});
}
}
if (finalChoice && wrapper.available(myAction.getExecutor())) {
return doFinalStep(new Runnable() {
@Override
public void run() {
if (myAction.getExecutor() == myAction.myAlternativeExecutor) {
PropertiesComponent.getInstance().setValue(myAction.myAddKey, Boolean.toString(true));
}
wrapper.perform(myProject, myAction.getExecutor(), DataManager.getInstance().getDataContext());
}
});
}
else {
return wrapper.getNextStep(myProject, myAction);
}
}
示例11: writeToXml
import com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl; //导入依赖的package包/类
public static Element writeToXml(RunConfiguration configuration) {
RunnerAndConfigurationSettings settings =
RunManagerImpl.getInstanceImpl(configuration.getProject()).getSettings(configuration);
Element element = new Element("configuration");
try {
((RunnerAndConfigurationSettingsImpl) settings).writeExternal(element);
} catch (WriteExternalException e) {
logger.warn("Error serializing run configuration to XML", e);
}
return element;
}
示例12: findExisting
import com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl; //导入依赖的package包/类
/**
* Deserializes the configuration represented by the given XML element, then searches for an
* existing run configuration in the project with the same name and type.
*/
@Nullable
@VisibleForTesting
static RunnerAndConfigurationSettings findExisting(Project project, Element element)
throws InvalidDataException {
RunManagerImpl manager = RunManagerImpl.getInstanceImpl(project);
RunnerAndConfigurationSettingsImpl settings = new RunnerAndConfigurationSettingsImpl(manager);
RunnerAndConfigurationSettingsCompatUtils.readConfiguration(settings, element);
RunConfiguration config = settings.getConfiguration();
if (config == null) {
return null;
}
return manager.findConfigurationByTypeAndName(config.getType().getId(), config.getName());
}
示例13: connectInDebugMode
import com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl; //导入依赖的package包/类
public void connectInDebugMode(RunManagerEx runManager) {
ServerConfiguration serverConfiguration = selectionHandler.getCurrentConfiguration();
// Create Remote Connection to Server using the IntelliJ Run / Debug Connection
//AS TODO: It is working but the configuration is listed and made persistent. That is not too bad because
//AS TODO: after changes a reconnect will update the configuration.
RemoteConfigurationType remoteConfigurationType = new RemoteConfigurationType();
RunConfiguration runConfiguration = remoteConfigurationType.getFactory().createTemplateConfiguration(myProject);
RemoteConfiguration remoteConfiguration = (RemoteConfiguration) runConfiguration;
// Server means if you are listening. If not you are attaching.
remoteConfiguration.SERVER_MODE = false;
remoteConfiguration.USE_SOCKET_TRANSPORT = true;
remoteConfiguration.HOST = serverConfiguration.getHost();
remoteConfiguration.PORT = serverConfiguration.getConnectionDebugPort() + "";
// Set a Name of the Configuration so that it is properly listed.
remoteConfiguration.setName(serverConfiguration.getName());
RunnerAndConfigurationSettings configuration = new RunnerAndConfigurationSettingsImpl(
(RunManagerImpl) runManager,
runConfiguration,
false
);
runManager.setTemporaryConfiguration(configuration);
//AS TODO: Make sure that this is the proper way to obtain the DEBUG Executor
Executor executor = ExecutorRegistry.getInstance().getExecutorById(ToolWindowId.DEBUG);
ExecutionUtil.runConfiguration(configuration, executor);
// Update the Modules with the Remote Sling Server
OsgiClient osgiClient = obtainOSGiClient();
if(osgiClient != null) {
BundleStatus status = checkAndUpdateSupportBundle(false);
if(status != BundleStatus.failed) {
checkModules(osgiClient);
}
}
}
示例14: createConfigurationByElement
import com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl; //导入依赖的package包/类
@Nullable
protected RunnerAndConfigurationSettingsImpl createConfigurationByElement(@NotNull final Location location,
@NotNull final ConfigurationContext context) {
final PsiFile psiFile = location.getPsiElement().getContainingFile();
if (psiFile == null || !OCamlFileUtil.isImplementationFile(psiFile)) {
return null;
}
final Project project = psiFile.getProject();
final VirtualFile virtualFile = psiFile.getVirtualFile();
if (virtualFile == null) {
return null;
}
final OCamlModule ocamlModule = OCamlModule.getBySourceFile(virtualFile, project);
if (ocamlModule == null) {
return null;
}
mySourceFile = psiFile;
final RunnerAndConfigurationSettingsImpl settings = cloneTemplateConfiguration(project, context);
final OCamlRunConfiguration configuration = (OCamlRunConfiguration) settings.getConfiguration();
configuration.setMainOCamlModule(ocamlModule);
configuration.setWorkingDirectory(FileUtil.toSystemDependentName(ocamlModule.getSourcesDir().getPath()));
configuration.setName(configuration.suggestedName());
final Module module = ModuleUtil.findModuleForPsiElement(psiFile);
configuration.setUsedModuleSdk(module != null);
configuration.setModule(module);
copyStepsBeforeRun(project, configuration);
return settings;
}
示例15: getBeforeRunTask
import com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl; //导入依赖的package包/类
private List<BeforeRunTask<?>> getBeforeRunTask(RunConfiguration configuration) {
RunManagerImpl runManager = (RunManagerImpl) RunManager.getInstance(myProject);
RunnerAndConfigurationSettingsImpl configurationSettings = new RunnerAndConfigurationSettingsImpl(runManager, configuration, true);
runManager.addConfiguration(configurationSettings, true);
List<BeforeRunTask<?>> tasks = runManager.getBeforeRunTasks(configuration);
runManager.removeConfiguration(configurationSettings);
return tasks;
}