本文整理匯總了Java中org.eclipse.debug.core.ILaunchConfigurationWorkingCopy.doSave方法的典型用法代碼示例。如果您正苦於以下問題:Java ILaunchConfigurationWorkingCopy.doSave方法的具體用法?Java ILaunchConfigurationWorkingCopy.doSave怎麽用?Java ILaunchConfigurationWorkingCopy.doSave使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.debug.core.ILaunchConfigurationWorkingCopy
的用法示例。
在下文中一共展示了ILaunchConfigurationWorkingCopy.doSave方法的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: 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;
}
示例5: createAntBuildConfig
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; //導入方法依賴的package包/類
/**
* Creates an ant build configuration {@link ILaunchConfiguration}
*
* @param configName
* name of the configuration to be created
* @param targets
* ant targets to be called
* @param buildPath
* path to build.xml file
* @param projectName
* name of the projects
* @return ant build configuration
*/
private static ILaunchConfiguration createAntBuildConfig(String configName, String targets, String buildPath,
String projectName) throws CoreException {
ILaunchConfiguration launchCfg;
ILaunchConfigurationType type = DebugPlugin.getDefault().getLaunchManager()
.getLaunchConfigurationType("org.eclipse.ant.AntLaunchConfigurationType");
ILaunchConfigurationWorkingCopy config = null;
config = type.newInstance(null, configName);
config.setAttribute("org.eclipse.ui.externaltools.ATTR_ANT_TARGETS", targets);
config.setAttribute("org.eclipse.ui.externaltools.ATTR_CAPTURE_OUTPUT", true);
config.setAttribute("org.eclipse.ui.externaltools.ATTR_LOCATION", buildPath);
config.setAttribute("org.eclipse.ui.externaltools.ATTR_SHOW_CONSOLE", true);
config.setAttribute("org.eclipse.ui.externaltools.ATTR_ANT_PROPERTIES", Collections.<String, String>emptyMap());
config.setAttribute("org.eclipse.ant.ui.DEFAULT_VM_INSTALL", true);
config.setAttribute("org.eclipse.jdt.launching.MAIN_TYPE",
"org.eclipse.ant.internal.launching.remote.InternalAntRunner");
config.setAttribute("org.eclipse.jdt.launching.PROJECT_ATTR", projectName);
config.setAttribute("org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER",
"org.eclipse.ant.ui.AntClasspathProvider");
config.setAttribute("process_factory_id", "org.eclipse.ant.ui.remoteAntProcessFactory");
if (configName.equals(PLATFORM_BUILD_CONFIG) || configName.equals(PLATFORM_CLEAN_BUILD_CONFIG)) {
config.setAttribute("org.eclipse.debug.core.ATTR_REFRESH_SCOPE", "${workspace}");
}
launchCfg = config.doSave();
return launchCfg;
}
示例6: renameLaunch
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; //導入方法依賴的package包/類
private void renameLaunch(final Spec newSpec, String newModelName) {
try {
// create the model with the new name
final ILaunchConfigurationWorkingCopy copy = this.launchConfig
.copy(newSpec.getName() + SPEC_MODEL_DELIM + newModelName);
copy.setAttribute(SPEC_NAME, newSpec.getName());
copy.setAttribute(ModelHelper.MODEL_NAME, newModelName);
copy.setContainer(newSpec.getProject());
final ILaunchConfiguration renamed = copy.doSave();
// delete the old model
this.launchConfig.delete();
this.launchConfig = renamed;
} catch (CoreException e) {
TLCActivator.logError("Error renaming model.", e);
}
}
示例7: createLaunchConfiguration
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; //導入方法依賴的package包/類
/**
* Creates a {@link ILaunchConfiguration}. If the <code>firstInstruction</code> is <code>null</code> the
* launch configuration dialog is opened.
*
* @param file
* the selected model {@link IFile}
* @param firstInstruction
* the first {@link EObject instruction} or <code>null</code> for interactive selection
* @param mode
* the {@link ILaunchConfiguration#getModes() mode}
* @return an array of possible {@link ILaunchConfiguration}, can be empty but not <code>null</code>
* @throws CoreException
* if {@link ILaunchConfiguration} initialization fails of models can't be loaded
*/
protected ILaunchConfiguration[] createLaunchConfiguration(final IResource file,
EObject firstInstruction, final String mode) throws CoreException {
final ILaunchConfiguration[] res;
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType type = manager.getLaunchConfigurationType(getLaunchConfigurationTypeID());
ILaunchConfigurationWorkingCopy configuration = type.newInstance(null, file.getName());
configuration.setMappedResources(new IResource[] {file, });
configuration.setAttribute(AbstractDSLLaunchConfigurationDelegate.RESOURCE_URI, file.getFullPath()
.toString());
if (firstInstruction == null) {
// open configuration for further editing
final ILaunchGroup group = DebugUITools.getLaunchGroup(configuration, mode);
if (group != null) {
configuration.doSave();
DebugUITools.openLaunchConfigurationDialog(PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getShell(), configuration, group.getIdentifier(), null);
}
res = new ILaunchConfiguration[] {};
} else {
configuration.setAttribute(AbstractDSLLaunchConfigurationDelegate.FIRST_INSTRUCTION_URI,
EcoreUtil.getURI(firstInstruction).toString());
// save and return new configuration
configuration.doSave();
res = new ILaunchConfiguration[] {configuration, };
}
return res;
}
開發者ID:eclipse,項目名稱:gemoc-studio-modeldebugging,代碼行數:44,代碼來源:AbstractDSLLaunchConfigurationDelegateUI.java
示例8: createLaunchConfiguration
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; //導入方法依賴的package包/類
@Override
protected final ILaunchConfiguration[] createLaunchConfiguration(IResource file, EObject firstInstruction, String mode)
throws CoreException {
ILaunchConfiguration[] launchConfigs = super.createLaunchConfiguration(file, firstInstruction, mode);
if (launchConfigs.length == 1) {
// open configuration for further editing
if (launchConfigs[0] instanceof ILaunchConfigurationWorkingCopy) {
ILaunchConfigurationWorkingCopy configuration = (ILaunchConfigurationWorkingCopy) launchConfigs[0];
String selectedLanguage = configuration.getAttribute(RunConfiguration.LAUNCH_SELECTED_LANGUAGE, "");
if (selectedLanguage.equals("")) {
// TODO try to infer possible language and other attribute
// from project content and environment
setDefaultsLaunchConfiguration(configuration);
final ILaunchGroup group = DebugUITools.getLaunchGroup(configuration, mode);
if (group != null) {
ILaunchConfiguration savedLaunchConfig = configuration.doSave();
// open configuration for user validation and inputs
DebugUITools.openLaunchConfigurationDialogOnGroup(PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getShell(), new StructuredSelection(savedLaunchConfig),
group.getIdentifier(), null);
// DebugUITools.openLaunchConfigurationDialog(PlatformUI.getWorkbench()
// .getActiveWorkbenchWindow().getShell(),
// savedLaunchConfig, group.getIdentifier(), null);
}
}
}
}
return launchConfigs;
}
示例9: createConfiguration
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; //導入方法依賴的package包/類
protected ILaunchConfiguration createConfiguration ( final IResource resource ) throws Exception
{
final ResourceSet rs = new ResourceSetImpl ();
final Resource r = rs.createResource ( URI.createURI ( resource.getLocationURI ().toURL ().toString () ) );
r.load ( null );
final Profile profile = (Profile)EcoreUtil.getObjectByType ( r.getContents (), ProfilePackage.Literals.PROFILE );
if ( profile == null )
{
return null;
}
String name = profile.getName ();
if ( name == null || name.isEmpty () )
{
name = String.format ( "Application profile: %s", resource.getFullPath () ); //$NON-NLS-1$
}
final ILaunchConfigurationWorkingCopy cfg = getConfigurationType ().newInstance ( resource.getParent (), name );
final Map<String, String> envs = new HashMap<> ();
envs.put ( "SCADA_PROFILE", String.format ( "${project_loc:/%s}/%s", resource.getProject ().getName (), resource.getProjectRelativePath () ) ); //$NON-NLS-1$ //$NON-NLS-2$
cfg.setAttribute ( ATTR_ENV_VARS, envs );
cfg.setAttribute ( IPDELauncherConstants.INCLUDE_OPTIONAL, false );
cfg.setAttribute ( IPDELauncherConstants.AUTOMATIC_ADD, false );
cfg.setAttribute ( IPDELauncherConstants.AUTOMATIC_VALIDATE, true );
cfg.setAttribute ( IPDELauncherConstants.DEFAULT_AUTO_START, false );
cfg.setAttribute ( IPDELauncherConstants.CONFIG_USE_DEFAULT_AREA, false );
cfg.setAttribute ( IPDELauncherConstants.CONFIG_LOCATION, getConfigurationArea ( profile ) );
addAllBundels ( cfg, profile );
addJvmOptions ( cfg, profile, resource.getParent () );
cfg.setAttribute ( IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, "-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog -console" ); //$NON-NLS-1$
return cfg.doSave ();
}
示例10: findExistingORCreateLaunchConfiguration
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; //導入方法依賴的package包/類
private ILaunchConfiguration findExistingORCreateLaunchConfiguration(ILaunchConfigurationWorkingCopy temp, String mode) throws InterruptedException, CoreException {
List candidateConfigs= findExistingLaunchConfigurations(temp);
int candidateCount= candidateConfigs.size();
if (candidateCount > 0) {
return (ILaunchConfiguration) candidateConfigs.get(0);
}
return temp.doSave();
}
示例11: launch
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; //導入方法依賴的package包/類
private void launch(IResource file, int line, IType type, String agentArgs, IMethod mainMethod)
throws CoreException {
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType confType = manager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
ILaunchConfigurationWorkingCopy wc = confType.newInstance(null, file.getName() + " (PandionJ)");
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, file.getProject().getName());
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, type.getFullyQualifiedName());
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_STOP_IN_MAIN, false);
// if(breakPoint != null)
// breakPoint.delete();
// if(line != -1)
// breakPoint = JDIDebugModel.createLineBreakpoint(file, firstType.getFullyQualifiedName(), line, -1, -1, 0, true, null);
try {
Bundle bundle = Platform.getBundle(LaunchCommand.class.getPackage().getName());
URL find = FileLocator.find(bundle, new Path("lib/agent.jar"), null);
URL resolve = FileLocator.resolve(find);
if(!mainMethod.exists()) {
String path = resolve.getPath();
if(Platform.getOS().compareTo(Platform.OS_WIN32) == 0)
path = path.substring(1);
String args = "-javaagent:\"" + path + "=" + agentArgs + "\" -Djava.awt.headless=true";
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, args);
}
} catch (IOException e1) {
e1.printStackTrace();
}
ILaunchConfiguration config = wc.doSave();
Activator.launch(config);
}
示例12: createLaunchConfiguration
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; //導入方法依賴的package包/類
/**
* Creates launch configuration for the type with given name.
*/
public ILaunchConfiguration createLaunchConfiguration(String mainTypeName)
throws Exception {
ILaunchConfigurationType type = DebugPlugin.getDefault().getLaunchManager()
.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
ILaunchConfigurationWorkingCopy config = type.newInstance(null, mainTypeName);
config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, javaProject.getElementName());
config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, mainTypeName);
Set<String> modes = new HashSet<String>();
modes.add(CoverageTools.LAUNCH_MODE);
config.setPreferredLaunchDelegate(modes, IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
return config.doSave();
}
示例13: launchNew
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; //導入方法依賴的package包/類
private void launchNew(LaunchableResource resource, String mode) {
try {
ILaunchManager launchManager = getLaunchManager();
String launchConfigurationName =
launchManager.generateLaunchConfigurationName(resource.getLaunchName());
ILaunchConfigurationType configurationType =
getDataflowLaunchConfigurationType(launchManager);
ILaunchConfigurationWorkingCopy configuration =
configurationType.newInstance(null, launchConfigurationName);
configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME,
resource.getProjectName());
IMethod mainMethod = resource.getMainMethod();
if (mainMethod != null && mainMethod.exists()) {
configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME,
mainMethod.getDeclaringType().getFullyQualifiedName());
}
String groupIdentifier =
mode.equals(ILaunchManager.RUN_MODE) ? IDebugUIConstants.ID_RUN_LAUNCH_GROUP
: IDebugUIConstants.ID_DEBUG_LAUNCH_GROUP;
int returnStatus =
DebugUITools.openLaunchConfigurationDialog(DataflowUiPlugin.getActiveWindowShell(),
configuration, groupIdentifier, null);
if (returnStatus == Window.OK) {
configuration.doSave();
}
} catch (CoreException e) {
// TODO: Handle
DataflowUiPlugin.logError(e, "Error while launching new Launch Configuration for project %s",
resource.getProjectName());
}
}
示例14: runVM
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; //導入方法依賴的package包/類
/**
* @param label
* @param classToLaunch
* @param classpath
* @param bootClasspath
* @param vmArgs
* @param prgArgs
* @param workDir
* @param sourceLocator
* @param debug
* @param showInDebugger
* @throws CoreException
*/
public void runVM(final String label, final String classToLaunch, final String[] classpath, final String[] bootClasspath, final String[] vmArgs,
final String[] prgArgs, final String workDir, final ISourceLocator sourceLocator, final boolean debug, final boolean showInDebugger)
throws CoreException {
final IVMInstall vmInstall = this.getVMInstall();
String mode = ILaunchManager.DEBUG_MODE;
if (debug && classToLaunch.equals(WEBLOGIC_MAIN_CLASS)) {
mode = ILaunchManager.DEBUG_MODE;
} else {
mode = ILaunchManager.RUN_MODE;
}
final IVMRunner vmRunner = vmInstall.getVMRunner(mode);
final ILaunchConfigurationType launchType = DebugPlugin.getDefault().getLaunchManager()
.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
final ILaunchConfigurationWorkingCopy config = launchType.newInstance(null, label);
config.setAttribute(IDebugUIConstants.ATTR_PRIVATE, true);
config.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, "org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector");
DebugUITools.setLaunchPerspective(launchType, mode, IDebugUIConstants.PERSPECTIVE_DEFAULT);
final Launch launch = new Launch(config, mode, sourceLocator);
config.doSave();
if (vmRunner != null) {
final VMRunnerConfiguration vmConfig = new VMRunnerConfiguration(classToLaunch, classpath);
vmConfig.setVMArguments(vmArgs);
vmConfig.setProgramArguments(prgArgs);
if (workDir != null) {
vmConfig.setWorkingDirectory(workDir);
}
if (bootClasspath.length == 0) {
vmConfig.setBootClassPath(null);
} else {
vmConfig.setBootClassPath(bootClasspath);
}
vmRunner.run(vmConfig, launch, null);
}
if (showInDebugger) {
DebugPlugin.getDefault().getLaunchManager().addLaunch(launch);
}
}
示例15: enable
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; //導入方法依賴的package包/類
public static void enable(ILaunchConfiguration config) throws CoreException {
if(config instanceof ILaunchConfigurationWorkingCopy) {
enable((ILaunchConfigurationWorkingCopy) config);
} else {
ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
enable(wc);
wc.doSave();
}
}