use of org.eclipse.debug.core.ILaunchConfigurationType in project n4js by eclipse.
the class RunnerUiUtils method getRunnerId.
/**
* Read the N4JS runner ID from the given Eclipse launch configuration. Will throw exceptions if 'failFast' is
* <code>true</code>, otherwise will return <code>null</code> in case of error.
*/
public static String getRunnerId(ILaunchConfiguration launchConfig, boolean failFast) {
try {
// 1) simple case: runnerId already defined in launchConfig
final String id = launchConfig.getAttribute(RunConfiguration.RUNNER_ID, (String) null);
if (id != null)
return id;
// 2) tricky case: not set yet, so have to go via the ILaunchConfigurationType or the launchConfig
final ILaunchConfigurationType launchConfigType = launchConfig.getType();
return getRunnerId(launchConfigType, failFast);
} catch (CoreException e) {
if (failFast)
throw new WrappedException(e);
return null;
}
}
use of org.eclipse.debug.core.ILaunchConfigurationType in project liferay-ide by liferay.
the class LaunchHelper method createLaunchConfiguration.
public ILaunchConfigurationWorkingCopy createLaunchConfiguration() throws CoreException {
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType type = manager.getLaunchConfigurationType(launchConfigTypeId);
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
String name = launchManager.generateLaunchConfigurationName(getNewLaunchConfigurationName());
ILaunchConfigurationWorkingCopy launchConfig = type.newInstance(null, name);
launchConfig.setAttribute("org.eclipse.debug.ui.ATTR_CAPTURE_IN_CONSOLE", isLaunchCaptureInConsole());
launchConfig.setAttribute("org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND", isLaunchInBackground());
launchConfig.setAttribute("org.eclipse.debug.ui.ATTR_PRIVATE", isLaunchIsPrivate());
IRuntimeClasspathEntry[] classpath = getClasspath(launchConfig);
List<String> mementos = new ArrayList<>(classpath.length);
for (int i = 0; i < classpath.length; i++) {
IRuntimeClasspathEntry entry = classpath[i];
mementos.add(entry.getMemento());
}
launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, Boolean.FALSE);
launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, mementos);
if (getMainClass() != null) {
launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, getMainClass());
}
if (ListUtil.isNotEmpty(launchArgs)) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < launchArgs.length; i++) {
sb.append("\"");
sb.append(launchArgs[i]);
sb.append("\" ");
}
launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, sb.toString());
}
return launchConfig;
}
use of org.eclipse.debug.core.ILaunchConfigurationType in project liferay-ide by liferay.
the class MavenProjectBuilder method _execMavenLaunch.
private boolean _execMavenLaunch(IProject project, String goal, IMavenProjectFacade facade, IProgressMonitor monitor) throws CoreException {
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType launchConfigurationType = launchManager.getLaunchConfigurationType(_launchConfigurationTypeId);
IPath basedirLocation = project.getLocation();
String newName = launchManager.generateLaunchConfigurationName(basedirLocation.lastSegment());
ILaunchConfigurationWorkingCopy workingCopy = launchConfigurationType.newInstance(null, newName);
workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, "-Dmaven.multiModuleProjectDirectory");
workingCopy.setAttribute(_attrPomDir, basedirLocation.toString());
workingCopy.setAttribute(_attrGoals, goal);
// workingCopy.setAttribute( ATTR_UPDATE_SNAPSHOTS, Boolean.TRUE );
workingCopy.setAttribute(_attrWorkspaceResolution, Boolean.TRUE);
workingCopy.setAttribute(_attrSkipTests, Boolean.TRUE);
if (facade != null) {
ResolverConfiguration configuration = facade.getResolverConfiguration();
String selectedProfiles = configuration.getSelectedProfiles();
if ((selectedProfiles != null) && (selectedProfiles.length() > 0)) {
workingCopy.setAttribute(_attrProfiles, selectedProfiles);
}
new LaunchHelper().launch(workingCopy, "run", monitor);
return true;
} else {
return false;
}
}
use of org.eclipse.debug.core.ILaunchConfigurationType in project pivot by apache.
the class PivotApplicationLaunchShortcut method getExistingLaunchConfiguration.
private ILaunchConfiguration getExistingLaunchConfiguration(IType type) {
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType launchConfigurationType = launchManager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
ILaunchConfiguration existingLaunchConfiguration = null;
try {
String applicationProjectName = type.getJavaProject().getElementName();
String applicationTypeName = type.getFullyQualifiedName();
ILaunchConfiguration[] launchConfigurations = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(launchConfigurationType);
for (int i = 0; i < launchConfigurations.length; i++) {
ILaunchConfiguration launchConfiguration = launchConfigurations[i];
String mainTypeName = launchConfiguration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, "");
String projectName = launchConfiguration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, "");
String programArguments = launchConfiguration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, "");
if (mainTypeName.equals(PivotPlugin.MAIN_TYPE_NAME) && projectName.equals(applicationProjectName) && programArguments.equals(applicationTypeName)) {
existingLaunchConfiguration = launchConfiguration;
break;
}
}
} catch (CoreException exception) {
MessageDialog.openError(PivotPlugin.getActiveWorkbenchShell(), exception.getMessage(), exception.getStatus().getMessage());
}
return existingLaunchConfiguration;
}
use of org.eclipse.debug.core.ILaunchConfigurationType in project mdw-designer by CenturyLinkCloud.
the class WebLogicServerConfigurator method launchNewServerCreation.
@SuppressWarnings({ "deprecation", "rawtypes", "unchecked" })
public String launchNewServerCreation(Shell shell) {
String serverHome = getServerSettings().getHome();
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType programType = manager.getLaunchConfigurationType(IExternalToolConstants.ID_PROGRAM_LAUNCH_CONFIGURATION_TYPE);
try {
ILaunchConfiguration cfg = programType.newInstance(null, "WebLogic Domain Config Wizard");
ILaunchConfigurationWorkingCopy wc = cfg.getWorkingCopy();
wc.setAttribute(IExternalToolConstants.ATTR_LOCATION, serverHome + "/common/bin/config.cmd");
wc.setAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, serverHome + "/common/bin");
Map envVars = new HashMap();
envVars.put("MW_HOME", serverHome.substring(0, serverHome.lastIndexOf(System.getProperty("file.separator"))));
wc.setAttribute("org.eclipse.debug.core.environmentVariables", envVars);
cfg = wc.doSave();
ILaunch launch = cfg.launch(ILaunchManager.RUN_MODE, null, false, false);
StringBuilder errors = new StringBuilder("");
for (IProcess process : launch.getProcesses()) errors.append(process.getStreamsProxy().getErrorStreamMonitor().getContents() + "\n");
cfg.delete();
if (errors.toString().trim().length() > 0)
throw new IOException(errors.toString().trim());
return null;
} catch (Exception ex) {
PluginMessages.uiError(shell, ex, "Create Domain", getServerSettings().getProject());
return null;
}
}
Aggregations