本文整理匯總了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();
}
示例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);
}
}
示例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);
}
}
示例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" ) );
}
示例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;
}
示例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);
}
}
示例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());
}
示例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));
}
示例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));
}
示例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);
}
示例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");
}
}