本文整理汇总了Java中com.intellij.execution.application.ApplicationConfiguration类的典型用法代码示例。如果您正苦于以下问题:Java ApplicationConfiguration类的具体用法?Java ApplicationConfiguration怎么用?Java ApplicationConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ApplicationConfiguration类属于com.intellij.execution.application包,在下文中一共展示了ApplicationConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configApplicationConfiguration
import com.intellij.execution.application.ApplicationConfiguration; //导入依赖的package包/类
/**
* Modifies the run configuration by adding parameters to it, such as a Main class which the
* user selects.
*/
@NotNull
public ApplicationConfiguration configApplicationConfiguration(TreeClassChooser chooser) {
if (configurationType.equals("Application")) {
logger.info("Creating ApplicationConfiguration.");
ApplicationConfiguration appCon =
(ApplicationConfiguration)
runManager.getSelectedConfiguration().getConfiguration();
logger.info("Setting main class and module to " + configurationType);
appCon.setMainClass(chooser.getSelected());
appCon.setModule(module);
return appCon;
}
logger.info("No applicable configurationType was found.");
return null;
}
示例2: _initJavaSettings
import com.intellij.execution.application.ApplicationConfiguration; //导入依赖的package包/类
/**
* Initialisiert den Classpath, die MainRoutine und VMOptions f�r Java in Verbindung mit dem SwingExplorer
*
* @param pProfileState Profile-State
* @throws ExecutionException
*/
private void _initJavaSettings(RunProfileState pProfileState) throws ExecutionException
{
if (pProfileState instanceof ApplicationConfiguration.JavaApplicationCommandLineState)
{
ApplicationConfiguration.JavaApplicationCommandLineState profileState = (ApplicationConfiguration.JavaApplicationCommandLineState) pProfileState;
_initJarFiles();
_initPort();
_appendSwingExplorerJarsToClassPath(profileState);
// VMParameter hinzuf�gen
JavaParameters javaParameters = profileState.getJavaParameters();
ParametersList vmParametersList = javaParameters.getVMParametersList();
vmParametersList.add("-javaagent:" + swagJarFile.getPath());
vmParametersList.add("-Xbootclasspath/a:" + swagJarFile.getPath());
vmParametersList.add("-Dswex.mport=" + port);
vmParametersList.add("-Dcom.sun.management.jmxremote");
// Main-Klasse austauschen gegen die des SwingExplorers. Der SE zieht die andere Main-Klasse selbst hoch!
String mainClass = javaParameters.getMainClass();
javaParameters.setMainClass("org.swingexplorer.Launcher");
javaParameters.getProgramParametersList().addAt(0, mainClass);
}
}
示例3: testMoveApplication
import com.intellij.execution.application.ApplicationConfiguration; //导入依赖的package包/类
public void testMoveApplication() throws IOException {
PsiClass psiClass = mySource.createClass("Application", APPLICATION_CODE);
assertNotNull(psiClass);
ApplicationConfiguration configuration = createConfiguration(psiClass);
move(psiClass, "pkg");
try {
configuration.checkConfiguration();
}
catch (RuntimeConfigurationException e) {
assertTrue("Unexpected ConfigurationException: " + e ,false);
}
assertEquals("pkg.Application", configuration.MAIN_CLASS_NAME);
rename(JavaPsiFacade.getInstance(myProject).findPackage("pkg"), "pkg2");
assertEquals("pkg2.Application", configuration.MAIN_CLASS_NAME);
}
示例4: testRunApplicationName
import com.intellij.execution.application.ApplicationConfiguration; //导入依赖的package包/类
public void testRunApplicationName() {
ApplicationConfiguration configuration = new ApplicationConfiguration(null, getProject(), ApplicationConfigurationType.getInstance());
configuration.MAIN_CLASS_NAME = "com.comp.AClass";
configuration.setGeneratedName();
checkSuggestedName("AClass.main()", configuration);
configuration.setName("Other name");
configuration.setNameChangedByUser(true);
checkSuggestedName("Other name", configuration);
configuration.setName("1234567890123456789012345 other long name");
checkSuggestedName("12345678901234567890...", configuration);
configuration.MAIN_CLASS_NAME = "com.comp.A12345678901234567890123LongName";
configuration.setGeneratedName();
checkSuggestedName("A1234567890123....main()", configuration);
}
示例5: testCreatingApplicationConfiguration
import com.intellij.execution.application.ApplicationConfiguration; //导入依赖的package包/类
public void testCreatingApplicationConfiguration() throws ConfigurationException {
if (PlatformTestUtil.COVERAGE_ENABLED_BUILD) return;
ApplicationConfiguration configuration = new ApplicationConfiguration(null, myProject, ApplicationConfigurationType.getInstance());
ApplicationConfigurable editor = new ApplicationConfigurable(myProject);
try {
editor.getComponent(); // To get all the watchers installed.
Configurable configurable = new RunConfigurationConfigurableAdapter(editor, configuration);
configurable.reset();
CommonJavaParametersPanel javaParameters = editor.getCommonProgramParameters();
javaParameters.setProgramParameters("prg");
javaParameters.setVMParameters("vm");
javaParameters.setWorkingDirectory("dir");
assertTrue(configurable.isModified());
configurable.apply();
assertEquals("prg", configuration.getProgramParameters());
assertEquals("vm", configuration.getVMParameters());
assertEquals("dir", configuration.getWorkingDirectory());
}
finally {
Disposer.dispose(editor);
}
}
示例6: configurationPatchIfNecessary
import com.intellij.execution.application.ApplicationConfiguration; //导入依赖的package包/类
/**
* Aplikování patche na budoucí konfigurace
*
* @param project aktuální projekt
* @param jre cesta k JVM
*/
private void configurationPatchIfNecessary( final @NotNull Project project, final @NotNull String jre )
{
// Template configuration.
RunManager runManager = RunManagerImpl.getInstance(project) ;
//Modifikace akutální konfigurací
for ( RunConfiguration configuration : runManager.getAllConfigurationsList() )
{
if (configuration instanceof ApplicationConfiguration)
{
patchConfiguration((ApplicationConfiguration) configuration, jre);
}
else if (configuration instanceof MavenRunConfiguration )
{
patchConfiguration((MavenRunConfiguration) configuration, jre);
}
}
}
示例7: testCreatingApplicationConfiguration
import com.intellij.execution.application.ApplicationConfiguration; //导入依赖的package包/类
public void testCreatingApplicationConfiguration() throws ConfigurationException {
if (IdeaTestUtil.COVERAGE_ENABLED_BUILD) return;
ApplicationConfiguration configuration = new ApplicationConfiguration(null, myProject, ApplicationConfigurationType.getInstance());
ApplicationConfigurable editor = new ApplicationConfigurable(myProject);
try {
editor.getComponent(); // To get all the watchers installed.
Configurable configurable = new RunConfigurationConfigurableAdapter(editor, configuration);
configurable.reset();
CommonJavaParametersPanel javaParameters = editor.getCommonProgramParameters();
javaParameters.setProgramParameters("prg");
javaParameters.setVMParameters("vm");
javaParameters.setWorkingDirectory("dir");
assertTrue(configurable.isModified());
configurable.apply();
assertEquals("prg", configuration.getProgramParameters());
assertEquals("vm", configuration.getVMParameters());
assertEquals("dir", configuration.getWorkingDirectory());
}
finally {
Disposer.dispose(editor);
}
}
示例8: setProcessParameters
import com.intellij.execution.application.ApplicationConfiguration; //导入依赖的package包/类
@Override
protected void setProcessParameters(Project project, ApplicationConfiguration configuration, Module module, @NotNull VirtualFile testsFile) {
configuration.setMainClassName(EduIntelliJNames.TEST_RUNNER_CLASS);
configuration.setModule(module);
PsiFile psiFile = PsiManager.getInstance(project).findFile(testsFile);
Collection<KtClass> ktClasses = PsiTreeUtil.findChildrenOfType(psiFile, KtClass.class);
for (KtClass ktClass : ktClasses) {
String name = ktClass.getName();
configuration.setProgramParameters(name);
}
}
示例9: createRunner
import com.intellij.execution.application.ApplicationConfiguration; //导入依赖的package包/类
public void createRunner() {
if (configurationType.equals("Application")) {
logger.info("Creating runner for type " + configurationType);
ApplicationConfiguration appCon =
(ApplicationConfiguration)
runManager.getSelectedConfiguration().getConfiguration();
if (checkForMainClass(appCon)) {
logger.info("Main class found, starting to execute project.");
ProjectExecutor executor = new ProjectExecutor();
executor.executeConfiguration(new ObjectFinder().findCurrentProject(), appCon);
}
}
}
示例10: checkForMainClass
import com.intellij.execution.application.ApplicationConfiguration; //导入依赖的package包/类
/**
* Makes sure the configuration has a defined main class. This method only works for the
* Application type of configuration, For other types it may be necessary to create their own.
*
* @param appCon Current configuration
* @return Whether the class has a valid main class or not
*/
private boolean checkForMainClass(ApplicationConfiguration appCon) {
if (appCon.getMainClass() == null) {
logger.info("No main class was found, prompting user to choose one.");
TreeClassChooser chooser = chooseMainClassForProject();
if (chooser.getSelected() == null) {
return false;
}
configApplicationConfiguration(chooser);
}
return true;
}
示例11: _appendSwingExplorerJarsToClassPath
import com.intellij.execution.application.ApplicationConfiguration; //导入依赖的package包/类
/**
* F�gt die JAR-Dateien zum Classpath des auszuf�hrenden Programms hinzu
*
* @param profileState Profil, bei dem es hinzugef�gt werden soll
* @throws ExecutionException Wenn die JavaParameter nicht geladen werden konnten
*/
private void _appendSwingExplorerJarsToClassPath(ApplicationConfiguration.JavaApplicationCommandLineState profileState) throws ExecutionException
{
PathsList classPath = profileState.getJavaParameters().getClassPath();
classPath.add(swagJarFile);
classPath.add(swexplJarFile);
}
示例12: testRenameApplication
import com.intellij.execution.application.ApplicationConfiguration; //导入依赖的package包/类
public void testRenameApplication() throws IOException {
PsiClass psiClass = mySource.createClass("Application", APPLICATION_CODE);
assertNotNull(psiClass);
ApplicationConfiguration configuration = createConfiguration(psiClass);
assertNotNull(configuration);
rename(psiClass, "NewName");
try {
configuration.checkConfiguration();
}
catch (RuntimeConfigurationException e) {
assertTrue("Unexpected ConfigurationException: " + e ,false);
}
assertEquals("NewName", configuration.MAIN_CLASS_NAME);
}
示例13: testApplication
import com.intellij.execution.application.ApplicationConfiguration; //导入依赖的package包/类
public void testApplication() {
PsiClass psiClass = findClass(getModule1(), CLASS_NAME);
PsiMethod psiMethod = psiClass.findMethodsByName("main", false)[0];
ApplicationConfiguration configuration = createConfiguration(psiMethod);
assertEquals(CLASS_NAME, configuration.MAIN_CLASS_NAME);
assertEquals(configuration.suggestedName(), configuration.getName());
assertEquals(SHORT_CLASS_NAME, configuration.getName());
}
示例14: testCreateConfiguration
import com.intellij.execution.application.ApplicationConfiguration; //导入依赖的package包/类
public void testCreateConfiguration() throws IOException, ExecutionException {
Module module1 = getModule1();
PsiClass psiClass = findTestA(module1);
JUnitConfiguration configuration = createConfiguration(psiClass);
assertEquals(Collections.singleton(module1), ContainerUtilRt.newHashSet(configuration.getModules()));
checkClassName(psiClass.getQualifiedName(), configuration);
assertEquals(psiClass.getName(), configuration.getName());
checkTestObject(JUnitConfiguration.TEST_CLASS, configuration);
Module module2 = getModule2();
Assertion.compareUnordered(new Module[]{module1, module2}, configuration.getValidModules());
PsiClass innerTest = findClass(module1, INNER_TEST_NAME);
configuration = createJUnitConfiguration(innerTest, TestClassConfigurationProducer.class, new MapDataContext());
checkClassName(RT_INNER_TEST_NAME, configuration);
checkCanRun(configuration);
PsiMethod[] testMethod = innerTest.findMethodsByName("test", false);
assertEquals(1, testMethod.length);
configuration = createConfiguration(testMethod[0]);
checkClassName(RT_INNER_TEST_NAME, configuration);
checkMethodName("test", configuration);
checkTestObject(JUnitConfiguration.TEST_METHOD, configuration);
checkCanRun(configuration);
PsiMethod mainMethod = innerTest.findMethodsByName("main", false)[0];
ApplicationConfiguration appConfiguration = createConfiguration(mainMethod);
assertEquals(RT_INNER_TEST_NAME, appConfiguration.MAIN_CLASS_NAME);
checkCanRun(configuration);
}
示例15: testTestClassPathWhenRunningConfigurations
import com.intellij.execution.application.ApplicationConfiguration; //导入依赖的package包/类
public void testTestClassPathWhenRunningConfigurations() throws IOException, ExecutionException {
addModule("module4", false);
Module module4 = getModule4();
assignJdk(module4);
addSourcePath(module4, "testSrc", true);
addSourcePath(module4, "src", false);
String output = setCompilerOutput(module4, "classes", false);
String testOuput = setCompilerOutput(module4, "testClasses", true);
ApplicationConfiguration applicationConfiguration = createConfiguration(findClass(module4, "Application"));
JavaParameters parameters = checkCanRun(applicationConfiguration);
String classPath = parameters.getClassPath().getPathsString();
checkDoesNotContain(classPath, testOuput);
checkContains(classPath, output);
JUnitConfiguration junitConfiguration =
createJUnitConfiguration(findClass(module4, "TestApplication"), TestClassConfigurationProducer.class, new MapDataContext());
parameters = checkCanRun(junitConfiguration);
classPath = parameters.getClassPath().getPathsString();
checkContains(classPath, testOuput);
checkContains(classPath, output);
applicationConfiguration.MAIN_CLASS_NAME = junitConfiguration.getPersistentData().getMainClassName();
classPath = checkCanRun(applicationConfiguration).getClassPath().getPathsString();
checkContains(classPath, testOuput);
checkContains(classPath, output);
}