public void setRunConfVmArgs(final ILaunchConfiguration conf, final String vmargs) throws CoreException { ILaunchConfigurationWorkingCopy confWc = conf.getWorkingCopy(); confWc.setAttribute(JunitLaunchListener.VM_ARGS, vmargs); confWc.doSave(); }
@Override public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException { ILaunchConfigurationWorkingCopy wc = configuration.getWorkingCopy(); JsonObject param = new JsonObject(); param.addProperty("request", "attach"); //$NON-NLS-1$ //$NON-NLS-2$ param.addProperty("processId", wc.getAttribute(AttachMainTab.ATTR_PID, Integer.toString(-1))); //$NON-NLS-1$ wc.setAttribute(DSPPlugin.ATTR_DSP_PARAM, new Gson().toJson(param)); wc.setAttribute(DSPPlugin.ATTR_DSP_MODE, DSPPlugin.DSP_MODE_LAUNCH); wc.setAttribute(DSPPlugin.ATTR_DSP_MONITOR_DEBUG_ADAPTER, true); if (wc.getAttribute(DebuggerTab.ATTR_DEFAULT_DEBUGGER, true)) { DebuggerInfo debuggerInfo = DebuggersRegistry.getDefaultDebugger(); wc.setAttribute(DSPPlugin.ATTR_DSP_CMD, debuggerInfo.debugger.getAbsolutePath()); wc.setAttribute(DSPPlugin.ATTR_DSP_ARGS, debuggerInfo.args); } configuration = wc.doSave(); super.launch(configuration, mode, launch, monitor); }
public void setMappedResources(IResource[] resources) { delegate.setMappedResources(resources); }
/** * Sets attributes on the configuration based on the current state of the UI elements * @param configuration configuration to modify */ public void performApply(ILaunchConfigurationWorkingCopy configuration) { if (fGenerateProfileButton.getSelection()) { configuration.setAttribute(IPDELauncherConstants.GENERATE_PROFILE, true); } else { configuration.removeAttribute(IPDELauncherConstants.GENERATE_PROFILE); } }
ILaunchConfigurationWorkingCopy workingCopy = launchConfig.getWorkingCopy(); workingCopy.delete(); ILaunchConfigurationType launchType = launchConfig.getType(); IContainer container = launchConfig.getFile() == null ? null : launchConfig.getFile().getParent(); ILaunchConfigurationWorkingCopy newLaunchConfig = launchType.newInstance( container, workingCopy.getName() ); // copy all attributes from 'launchConfig' to 'newLaunchConfig' newLaunchConfig.doSave();
public void setDefaults(ILaunchConfigurationWorkingCopy configuration, boolean isJUnit) { configuration.setAttribute(IPDELauncherConstants.CONFIG_CLEAR_AREA, isJUnit); boolean useDefaultArea = !isJUnit || LaunchArgumentsHelper.getDefaultJUnitWorkspaceIsContainer(); configuration.setAttribute(IPDELauncherConstants.CONFIG_USE_DEFAULT_AREA, useDefaultArea); String location; if (isJUnit && !useDefaultArea) { location = LaunchArgumentsHelper.getDefaultJUnitConfigurationLocation(); } else { location = DEFAULT_DIR + configuration.getName(); } configuration.setAttribute(IPDELauncherConstants.CONFIG_LOCATION, location); }
public void setDefaults(ILaunchConfigurationWorkingCopy config) { config.setAttribute(IPDELauncherConstants.INCLUDE_OPTIONAL, true); config.setAttribute(IPDELauncherConstants.AUTOMATIC_ADD, true); config.setAttribute(IPDELauncherConstants.AUTOMATIC_VALIDATE, true); config.setAttribute(IPDELauncherConstants.SHOW_SELECTED_ONLY, false); }
public ILaunchConfiguration doSave() throws CoreException { return delegate.doSave(); }
protected ILaunchConfiguration createConfiguration(IType type) { ILaunchConfiguration config = null; try { ILaunchConfigurationType configType = getConfigurationType(); ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, DebugPlugin.getDefault().getLaunchManager().generateUniqueLaunchConfigurationNameFrom(type.getElementName())); wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, type.getFullyQualifiedName()); wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, type.getJavaProject().getElementName()); wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_APPLET_WIDTH, AppletParametersTab.DEFAULT_APPLET_WIDTH); wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_APPLET_HEIGHT, AppletParametersTab.DEFAULT_APPLET_HEIGHT); wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_APPLET_NAME, ""); //$NON-NLS-1$ //CONTEXTLAUNCHING wc.setMappedResources(new IResource[] {type.getUnderlyingResource()}); config = wc.doSave(); } catch (CoreException ce) { reportErorr(ce); } return config; }
public void migrate(ILaunchConfigurationWorkingCopy wc) throws CoreException { if (!wc.getAttribute(IPDEConstants.LAUNCHER_PDE_VERSION, "").equals("3.3")) { //$NON-NLS-1$ //$NON-NLS-2$ wc.setAttribute(IPDEConstants.LAUNCHER_PDE_VERSION, "3.3"); //$NON-NLS-1$ StringBuffer vmArgs = new StringBuffer(wc.getAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, "")); //$NON-NLS-1$ if (vmArgs.indexOf("-Declipse.ignoreApp") == -1) { //$NON-NLS-1$ if (vmArgs.length() > 0) vmArgs.append(" "); //$NON-NLS-1$ vmArgs.append("-Declipse.ignoreApp=true"); //$NON-NLS-1$ } if (vmArgs.indexOf("-Dosgi.noShutdown") == -1) { //$NON-NLS-1$ vmArgs.append(" -Dosgi.noShutdown=true"); //$NON-NLS-1$ } wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, vmArgs.toString()); } super.migrate(wc); }
public void migrate(ILaunchConfigurationWorkingCopy candidate) throws CoreException { if (!candidate.getAttribute(IPDEConstants.APPEND_ARGS_EXPLICITLY, false)) { candidate.setAttribute(IPDEConstants.APPEND_ARGS_EXPLICITLY, true); String args = candidate.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, ""); //$NON-NLS-1$ StringBuffer buffer = new StringBuffer(LaunchArgumentsHelper.getInitialProgramArguments()); if (args.length() > 0) { buffer.append(" "); //$NON-NLS-1$ buffer.append(args); } candidate.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, buffer.toString()); } if (candidate.hasAttribute(IPDELauncherConstants.VMINSTALL)) { String name = candidate.getAttribute(IPDELauncherConstants.VMINSTALL, (String) null); if (name != null) { IVMInstall vm = VMHelper.getVMInstall(name); if (vm != null) { IPath path = JavaRuntime.newJREContainerPath(vm); candidate.setAttribute(IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, path.toPortableString()); } } candidate.removeAttribute(IPDELauncherConstants.VMINSTALL); } }
@Override public void performApply(ILaunchConfigurationWorkingCopy configuration) { super.performApply(configuration); try { // if the configuration has the GENERATED_CONFIG flag, we need to see if we should remove the flag if (!(configuration.getAttribute(IPDEUIConstants.GENERATED_CONFIG, false))) return; ILaunchConfiguration original = configuration.getOriginal(); // peformApply is called when opening the launch dialog the first time. In this case the user has not modified the configuration so we should // keep the GENERATED_CONFIG flag. To check to see if this is the case, we need to see if an attribute used to initialize the launch config // is present in the original copy. We do this by querying the config twice, with different default values. If the values == eachother, we // we know the value is present. Since generated configs don't contain DOCLEARLOG, we know if DOCLEARLOG is present in the original copy the // perform apply so save the initialization values has already been run and this is a user modification. if (original != null) { boolean firstQuery = original.getAttribute(IPDEConstants.DOCLEARLOG, false); boolean secondQuery = original.getAttribute(IPDEConstants.DOCLEARLOG, true); if (firstQuery == secondQuery) configuration.setAttribute(IPDEUIConstants.GENERATED_CONFIG, false); } } catch (CoreException e) { } }
protected void setupLaunchConfiguration(ILaunchConfigurationWorkingCopy config, IServer server, ModuleArtifactDelegate moduleArtifact, ILaunchableAdapter launchableAdapter, IClient client) { String launchName = NLS.bind(Messages.runOnServerLaunchConfigName, moduleArtifact.getName()); launchName = getValidLaunchConfigurationName(launchName); if (!launchName.equals(config.getName())) { ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); launchName = launchManager.generateUniqueLaunchConfigurationNameFrom(launchName); config.rename(launchName); } config.setAttribute(RunOnServerLaunchConfigurationDelegate.ATTR_SERVER_ID, server.getId()); config.setAttribute(RunOnServerLaunchConfigurationDelegate.ATTR_MODULE_ARTIFACT, moduleArtifact.serialize()); config.setAttribute(RunOnServerLaunchConfigurationDelegate.ATTR_MODULE_ARTIFACT_CLASS, moduleArtifact.getClass().getName()); config.setAttribute(RunOnServerLaunchConfigurationDelegate.ATTR_LAUNCHABLE_ADAPTER_ID, launchableAdapter.getId()); config.setAttribute(RunOnServerLaunchConfigurationDelegate.ATTR_CLIENT_ID, client.getId()); }
@Override public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { // set default name for script IResource resource = DebugUITools.getSelectedResource(); if (resource != null && resource instanceof IFile) { IFile file = (IFile) resource; if (AntUtil.isKnownAntFile(file)) { String projectName = file.getProject().getName(); StringBuffer buffer = new StringBuffer(projectName); buffer.append(' '); buffer.append(file.getName()); String name = buffer.toString().trim(); name = DebugPlugin.getDefault().getLaunchManager().generateLaunchConfigurationName(name); configuration.rename(name); // set the project name so that the correct default VM install can be determined configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, projectName); configuration.setAttribute(IExternalToolConstants.ATTR_LOCATION, VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression("workspace_loc", file.getFullPath().toString())); //$NON-NLS-1$ } } configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH_PROVIDER, "org.eclipse.ant.ui.AntClasspathProvider"); //$NON-NLS-1$ super.setDefaults(configuration); } }
public ILaunchConfiguration createConfiguration(IResource type){ if( type == null ) return null; ILaunchConfiguration config = null; ILaunchConfigurationWorkingCopy wc = null; try { ILaunchConfigurationType configType = getConfigurationType(); if(RunJettyRunTab.isWebappProject(type.getProject())){ String launchConfigName = getLaunchManager(). generateLaunchConfigurationName(type.getProject().getName()); wc = configType.newInstance(null, launchConfigName); IProject proj = type.getProject(); RunJettyRunTab.initDefaultConfiguration(wc, proj == null ? null : proj.getName(), launchConfigName); //set mapped resource , let next time we could execute this directly from menuitem. wc.setMappedResources(new IResource[] {type}); config = wc.doSave(); }else{ showError("Project is not a regular webapp project (missing WEB-INF)"); } } catch (CoreException exception) { showError( exception.getStatus().getMessage()); } return config; }
public boolean performOk() { fWorkingDirBlock.performApply(fWorkingCopy); fJRETab.performApply(fWorkingCopy); fVMArgumentsBlock.performApply(fWorkingCopy); try { if (!fWorkingCopy.contentsEqual(fConfig)) { fConfig = fWorkingCopy.doSave(); fWorkingCopy = fConfig.getWorkingCopy(); } } catch (CoreException e) { JDIDebugUIPlugin.statusDialog(e.getStatus()); } return super.performOk(); } }
protected String getTargetsSelected() { String defaultValue = null; if (!fTargetsTab.isTargetSelected()) { defaultValue = IAntCoreConstants.EMPTY_STRING; } try { return fConfiguration.getAttribute(IAntLaunchConstants.ATTR_ANT_TARGETS, defaultValue); } catch (CoreException e) { return defaultValue; } }
/** * Sets the configuration context holders. * * @param entries the entries * @throws CoreException on occasion */ public void setConfigs(List<JettyConfig> entries) throws CoreException { int index = 0; for (JettyConfig entry : entries) { setAttribute(false, ATTR_JETTY_CONFIG_PATH + index, entry.getPath()); setAttribute(false, ATTR_JETTY_CONFIG_TYPE + index, entry.getType().name()); setAttribute(false, ATTR_JETTY_CONFIG_ACTIVE + index, entry.isActive()); index += 1; } ILaunchConfigurationWorkingCopy configuration = getConfigurationWorkingCopy(); while (configuration.getAttribute(ATTR_JETTY_CONFIG_PATH + index, (String) null) != null) { configuration.removeAttribute(ATTR_JETTY_CONFIG_PATH + index); configuration.removeAttribute(ATTR_JETTY_CONFIG_TYPE + index); configuration.removeAttribute(ATTR_JETTY_CONFIG_ACTIVE + index); index += 1; } }
@Override public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { configuration.removeAttribute(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES); }
public void rename(String name) { delegate.rename(name); }