当前位置: 首页>>代码示例>>Java>>正文


Java ILaunchConfigurationWorkingCopy类代码示例

本文整理汇总了Java中org.eclipse.debug.core.ILaunchConfigurationWorkingCopy的典型用法代码示例。如果您正苦于以下问题:Java ILaunchConfigurationWorkingCopy类的具体用法?Java ILaunchConfigurationWorkingCopy怎么用?Java ILaunchConfigurationWorkingCopy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ILaunchConfigurationWorkingCopy类属于org.eclipse.debug.core包,在下文中一共展示了ILaunchConfigurationWorkingCopy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toLaunchConfiguration

import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; //导入依赖的package包/类
/**
 * Creates an {@link ILaunchConfiguration} containing the information of this instance, only available when run
 * within the Eclipse IDE. If an {@link ILaunchConfiguration} with the same name has been run before, the instance
 * from the launch manager is used. This is usually done in the {@code ILaunchShortcut}.
 *
 * @see #fromLaunchConfiguration(ILaunchConfiguration)
 */
public ILaunchConfiguration toLaunchConfiguration() throws CoreException {
	ILaunchConfiguration[] configs = DebugPlugin.getDefault().getLaunchManager()
			.getLaunchConfigurations(configurationType);
	boolean configurationHasChanged = false;
	for (ILaunchConfiguration config : configs) {
		if (configName.equals(config.getName())) {
			configurationHasChanged = hasConfigurationChanged(config);
			if (!configurationHasChanged) {
				return config;
			}
		}
	}

	IContainer container = null;
	ILaunchConfigurationWorkingCopy workingCopy = configurationType.newInstance(container, configName);

	workingCopy.setAttribute(XT_FILE_TO_RUN, xtFileToRun);
	workingCopy.setAttribute(WORKING_DIRECTORY, workingDirectory.getAbsolutePath());

	return workingCopy.doSave();
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:29,代码来源:XpectRunConfiguration.java

示例2: toLaunchConfiguration

import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; //导入依赖的package包/类
/**
 * Converts a {@link TestConfiguration} to an {@link ILaunchConfiguration}. Will throw a {@link WrappedException} in
 * case of error.
 *
 * @see TestConfiguration#readPersistentValues()
 */
public ILaunchConfiguration toLaunchConfiguration(ILaunchConfigurationType type, TestConfiguration testConfig) {
	try {
		final ILaunchConfiguration[] configs = DebugPlugin.getDefault().getLaunchManager()
				.getLaunchConfigurations(type);

		for (ILaunchConfiguration config : configs) {
			if (equals(testConfig, config))
				return config;
		}

		final IContainer container = null;
		final ILaunchConfigurationWorkingCopy workingCopy = type.newInstance(container, testConfig.getName());

		workingCopy.setAttributes(testConfig.readPersistentValues());

		return workingCopy.doSave();
	} catch (Exception e) {
		throw new WrappedException("could not convert N4JS TestConfiguration to Eclipse ILaunchConfiguration", e);
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:27,代码来源:TestConfigurationConverter.java

示例3: toLaunchConfiguration

import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; //导入依赖的package包/类
/**
 * Converts a {@link RunConfiguration} to an {@link ILaunchConfiguration}. Will throw a {@link WrappedException} in
 * case of error.
 *
 * @see RunConfiguration#readPersistentValues()
 */
public ILaunchConfiguration toLaunchConfiguration(ILaunchConfigurationType type, RunConfiguration runConfig) {
	try {
		final ILaunchConfiguration[] configs = DebugPlugin.getDefault().getLaunchManager()
				.getLaunchConfigurations(type);

		for (ILaunchConfiguration config : configs) {
			if (equals(runConfig, config))
				return config;
		}

		final IContainer container = null;
		final ILaunchConfigurationWorkingCopy workingCopy = type.newInstance(container, runConfig.getName());

		workingCopy.setAttributes(runConfig.readPersistentValues());

		return workingCopy.doSave();
	} catch (Exception e) {
		throw new WrappedException("could not convert N4JS RunConfiguration to Eclipse ILaunchConfiguration", e);
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:27,代码来源:RunConfigurationConverter.java

示例4: addJvmOptions

import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; //导入依赖的package包/类
private void addJvmOptions ( final ILaunchConfigurationWorkingCopy cfg, final Profile profile, final IContainer container ) throws CoreException
{
    final List<String> args = new LinkedList<> ();

    args.addAll ( profile.getJvmArguments () );

    for ( final SystemProperty p : profile.getProperty () )
    {
        addSystemProperty ( profile, args, p.getKey (), p.getValue (), p.isEval () );
    }

    for ( final Map.Entry<String, String> entry : getInitialProperties ().entrySet () )
    {
        addSystemProperty ( profile, args, entry.getKey (), entry.getValue (), false );
    }

    final IFile dataJson = container.getFile ( new Path ( "data.json" ) ); //$NON-NLS-1$
    if ( dataJson.exists () )
    {
        addJvmArg ( args, "org.eclipse.scada.ca.file.provisionJsonUrl", escapeArgValue ( dataJson.getLocation ().toFile ().toURI ().toString () ) ); //$NON-NLS-1$
    }

    cfg.setAttribute ( IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, StringHelper.join ( args, "\n" ) );
    cfg.setAttribute ( IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, StringHelper.join ( profile.getArguments (), "\n" ) );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:26,代码来源:LaunchShortcut.java

示例5: createConfiguration

import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; //导入依赖的package包/类
/**
 * Creates and returns a new configuration based on the specified type.
 * 
 * @param additionalScope additional scope which can be given
 * @param type
 *            type to create a launch configuration for
 * 
 * @return launch configuration configured to launch the specified type
 */
protected ILaunchConfiguration createConfiguration(IResource resource, Object additionalScope) {
	ILaunchConfiguration config = null;
	ILaunchConfigurationWorkingCopy wc = null;
	try {
		String projectName = createGradleProjectName(resource);
		String proposal = createLaunchConfigurationNameProposal(projectName, resource, additionalScope);

		ILaunchConfigurationType configType = getConfigurationType();
		wc = configType.newInstance(null, getLaunchManager().generateLaunchConfigurationName(proposal));
		createCustomConfiguration(resource, additionalScope, wc, projectName);

		config = wc.doSave();
	} catch (CoreException exception) {
		MessageDialog.openError(EclipseUtil.getActiveWorkbenchShell(), "EGradle create configuration failed",
				exception.getStatus().getMessage());
	}
	return config;
}
 
开发者ID:de-jcup,项目名称:egradle,代码行数:28,代码来源:EGradleLaunchShortCut.java

示例6: performApply

import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; //导入依赖的package包/类
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
	// Convert the table's items into a Map so that this can be saved in the
	// configuration's attributes.
	TableItem[] items = propertiesTable.getTable().getItems();
	Map<String,String> map = new HashMap<>(items.length);
	for (int i = 0; i < items.length; i++) {
		PropertyVariable var = (PropertyVariable) items[i].getData();
		map.put(var.getName(), var.getValue());
	}
	if (map.size() == 0) {
		configuration.setAttribute(launchConfigurationPropertyMapAttributeName, (Map<String,String>) null);
	} else {
		configuration.setAttribute(launchConfigurationPropertyMapAttributeName, map);
	}

}
 
开发者ID:de-jcup,项目名称:egradle,代码行数:17,代码来源:EGradleLaunchConfigurationPropertiesTab.java

示例7: performApply

import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; //导入依赖的package包/类
@Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
	super.performApply(configuration);
	configuration.setAttribute(
			"remoteWorkspace", 
			fRemoteAppDirPathText.getText());
	
	configuration.setAttribute(
			"hostName", 
			fHostText.getText());
	
	configuration.setAttribute(
			"userName", 
			fUserNameText.getText());
	
	configuration.setAttribute(
			"userPassword", 
			fUserPasswordText.getText());
}
 
开发者ID:ncleclipse,项目名称:ncl30-eclipse,代码行数:20,代码来源:GingaVMLaunchTabConfiguration.java

示例8: testProjectWithSourceFolders

import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; //导入依赖的package包/类
@Test
public void testProjectWithSourceFolders() throws Exception {
  IPackageFragmentRoot rootSrc1 = javaProject1.createSourceFolder("src");
  IPackageFragmentRoot rootSrc2 = javaProject1.createSourceFolder("test");
  JavaProjectKit.waitForBuild();

  ILaunchConfigurationWorkingCopy configuration = getJavaApplicationType()
      .newInstance(javaProject1.project, "test.launch");
  configuration.setAttribute(
      IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, "project1");

  final Collection<IPackageFragmentRoot> scope = launcher
      .getOverallScope(configuration);

  assertEquals(set(rootSrc1, rootSrc2), set(scope));
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:17,代码来源:JavaApplicationLauncherTest.java

示例9: testProjectWithProjectReference

import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; //导入依赖的package包/类
@Test
public void testProjectWithProjectReference() throws Exception {
  IPackageFragmentRoot rootSrc1 = javaProject1.createSourceFolder("src");
  IPackageFragmentRoot rootSrc2 = javaProject2.createSourceFolder("src");
  javaProject1.addProjectReference(javaProject2);
  JavaProjectKit.waitForBuild();

  ILaunchConfigurationWorkingCopy configuration = getJavaApplicationType()
      .newInstance(javaProject1.project, "test.launch");
  configuration.setAttribute(
      IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, "project1");

  final Collection<IPackageFragmentRoot> scope = launcher
      .getOverallScope(configuration);

  assertEquals(set(rootSrc1, rootSrc2), set(scope));
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:18,代码来源:JavaApplicationLauncherTest.java

示例10: testSetLoginCredential

import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; //导入依赖的package包/类
@Test
public void testSetLoginCredential() throws CoreException, IOException {
  Map<String, String> environmentVariables = new HashMap<>();
  ILaunchConfigurationWorkingCopy workingCopy =
      mockILaunchConfigurationWorkingCopy(environmentVariables);

  dataflowDelegate.setLoginCredential(workingCopy, "[email protected]");
  String jsonCredentialPath = environmentVariables.get("GOOGLE_APPLICATION_CREDENTIALS");
  assertNotNull(jsonCredentialPath);
  assertThat(jsonCredentialPath, containsString("google-ct4e-"));
  assertThat(jsonCredentialPath, endsWith(".json"));

  Path credentialFile = Paths.get(jsonCredentialPath);
  assertTrue(Files.exists(credentialFile));

  String contents = new String(Files.readAllBytes(credentialFile), StandardCharsets.UTF_8);
  assertThat(contents, containsString("fake-refresh-token"));
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:19,代码来源:DataflowPipelineLaunchDelegateTest.java

示例11: testLaunchWithValidLaunchConfigurationCreatesJsonCredential

import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; //导入依赖的package包/类
@Test
public void testLaunchWithValidLaunchConfigurationCreatesJsonCredential() throws CoreException {
  ILaunchConfiguration configuration = mockILaunchConfiguration();
  when(configuration.getAttribute(
      "com.google.cloud.dataflow.eclipse.ALL_ARGUMENT_VALUES", new HashMap<String, String>()))
      .thenReturn(ImmutableMap.of("accountEmail", "[email protected]"));

  Map<String, String> environmentVariables = new HashMap<>();
  ILaunchConfigurationWorkingCopy expectedConfiguration =
      mockILaunchConfigurationWorkingCopy(environmentVariables);
  when(configuration.copy("dataflow_tmp_config_working_copy-testConfiguration"))
      .thenReturn(expectedConfiguration);

  WritableDataflowPreferences globalPreferences = WritableDataflowPreferences.global();
  globalPreferences.setDefaultAccountEmail("[email protected]");
  globalPreferences.save();

  dataflowDelegate.launch(configuration, "run" /* mode */, mock(ILaunch.class), monitor);

  String jsonCredentialPath = environmentVariables.get("GOOGLE_APPLICATION_CREDENTIALS");
  assertNotNull(jsonCredentialPath);
  assertTrue(Files.exists(Paths.get(jsonCredentialPath)));
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:24,代码来源:DataflowPipelineLaunchDelegateTest.java

示例12: testToLaunchConfigurationWritesArgumentsToLaunchConfiguration

import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; //导入依赖的package包/类
@Test
public void testToLaunchConfigurationWritesArgumentsToLaunchConfiguration() {
  PipelineLaunchConfiguration pipelineLaunchConfig = PipelineLaunchConfiguration.createDefault();

  PipelineRunner runner = PipelineRunner.DATAFLOW_PIPELINE_RUNNER;
  pipelineLaunchConfig.setRunner(runner);

  Map<String, String> argValues = ImmutableMap.of(
      "Spam", "foo",
      "Ham", "bar",
      "Eggs", "baz");
  pipelineLaunchConfig.setArgumentValues(argValues);

  ILaunchConfigurationWorkingCopy workingCopy = mock(ILaunchConfigurationWorkingCopy.class);
  pipelineLaunchConfig.toLaunchConfiguration(workingCopy);

  verify(workingCopy).setAttribute(
      PipelineConfigurationAttr.ALL_ARGUMENT_VALUES.toString(), argValues);
  verify(workingCopy).setAttribute(
      PipelineConfigurationAttr.RUNNER_ARGUMENT.toString(), runner.getRunnerName());
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:22,代码来源:PipelineLaunchConfigurationTest.java

示例13: createMavenPackagingLaunchConfiguration

import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; //导入依赖的package包/类
@VisibleForTesting
static ILaunchConfiguration createMavenPackagingLaunchConfiguration(IProject project)
    throws CoreException {
  ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
  ILaunchConfigurationType launchConfigurationType = launchManager
      .getLaunchConfigurationType(MavenLaunchConstants.LAUNCH_CONFIGURATION_TYPE_ID);

  String launchConfigName = "CT4E App Engine flexible Maven deploy artifact packaging "
      + project.getLocation().toString().replaceAll("[^a-zA-Z0-9]", "_");

  ILaunchConfigurationWorkingCopy workingCopy = launchConfigurationType.newInstance(
      null /*container*/, launchConfigName);
  workingCopy.setAttribute(ILaunchManager.ATTR_PRIVATE, true);
  // IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND;
  workingCopy.setAttribute("org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND", true);
  workingCopy.setAttribute(MavenLaunchConstants.ATTR_POM_DIR, project.getLocation().toString());
  workingCopy.setAttribute(MavenLaunchConstants.ATTR_GOALS, "package");
  workingCopy.setAttribute(RefreshUtil.ATTR_REFRESH_SCOPE, "${project}");
  workingCopy.setAttribute(RefreshUtil.ATTR_REFRESH_RECURSIVE, true);

  IPath jreContainerPath = getJreContainerPath(project);
  workingCopy.setAttribute(
      IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, jreContainerPath.toString());

  return workingCopy;
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:27,代码来源:FlexMavenPackagedProjectStagingDelegate.java

示例14: performApply

import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; //导入依赖的package包/类
@Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
  PipelineRunner runner = getSelectedRunner();
  launchConfiguration.setRunner(runner);

  launchConfiguration.setUseDefaultLaunchOptions(defaultOptionsComponent.isUseDefaultOptions());

  Map<String, String> overallArgValues = new HashMap<>(launchConfiguration.getArgumentValues());
  if (!defaultOptionsComponent.isUseDefaultOptions()) {
    overallArgValues.putAll(defaultOptionsComponent.getValues());
  }
  overallArgValues.putAll(getNonDefaultOptions());
  launchConfiguration.setArgumentValues(overallArgValues);

  launchConfiguration.setUserOptionsName(userOptionsSelector.getText());

  launchConfiguration.toLaunchConfiguration(configuration);
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:19,代码来源:PipelineArgumentsTab.java

示例15: toLaunchConfiguration

import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; //导入依赖的package包/类
/**
 * Stores the Dataflow Pipeline-specific options of this LaunchConfiguration inside the provided
 * {@link ILaunchConfigurationWorkingCopy}.
 */
public void toLaunchConfiguration(ILaunchConfigurationWorkingCopy configuration) {
  configuration.setAttribute(
      PipelineConfigurationAttr.RUNNER_ARGUMENT.toString(), runner.getRunnerName());
  configuration.setAttribute(
      PipelineConfigurationAttr.USE_DEFAULT_LAUNCH_OPTIONS.toString(), useDefaultLaunchOptions);
  configuration.setAttribute(
      PipelineConfigurationAttr.ALL_ARGUMENT_VALUES.toString(), argumentValues);
  configuration.setAttribute(
      PipelineConfigurationAttr.USER_OPTIONS_NAME.toString(), userOptionsName.orNull());

  try {
    setEclipseProjectName(configuration);
  } catch (CoreException e) {
    DataflowCorePlugin.logWarning("CoreException while trying to retrieve"
        + " project name from Configuration Working Copy");
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:22,代码来源:PipelineLaunchConfiguration.java


注:本文中的org.eclipse.debug.core.ILaunchConfigurationWorkingCopy类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。