use of org.eclipse.debug.core.ILaunchConfigurationType in project linuxtools by eclipse.
the class ProfileLaunchShortcut method createConfiguration.
/**
* Create a launch configuration based on a binary, and optionally
* save it to the underlying resource.
*
* @param bin a representation of a binary
* @param save true if the configuration should be saved to the
* underlying resource, and false if it should not be saved.
* @return a launch configuration generated for the binary.
* @since 1.2
*/
protected ILaunchConfiguration createConfiguration(IBinary bin, boolean save) {
ILaunchConfiguration config = null;
try {
String projectName = bin.getResource().getProjectRelativePath().toString();
ILaunchConfigurationType configType = getLaunchConfigType();
ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, getLaunchManager().generateLaunchConfigurationName(bin.getElementName()));
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, projectName);
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, bin.getCProject().getElementName());
wc.setMappedResources(new IResource[] { bin.getResource(), bin.getResource().getProject() });
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, (String) null);
setDefaultProfileAttributes(wc);
if (save) {
config = wc.doSave();
} else {
config = wc;
}
} catch (CoreException e) {
e.printStackTrace();
}
return config;
}
use of org.eclipse.debug.core.ILaunchConfigurationType in project erlide_eclipse by erlang.
the class ErlangLaunchDelegate method isErlangInternalLaunch.
public static boolean isErlangInternalLaunch(final ILaunch aLaunch) {
try {
final ILaunchConfiguration cfg = aLaunch.getLaunchConfiguration();
final ILaunchConfigurationType type = cfg.getType();
final String id = type.getIdentifier();
return IErlangLaunchDelegateConstants.CONFIGURATION_TYPE_INTERNAL.equals(id);
} catch (final CoreException e) {
ErlLogger.warn(e);
return false;
}
}
use of org.eclipse.debug.core.ILaunchConfigurationType in project liferay-ide by liferay.
the class PortalSourcePathComputerDelegate method addSourceContainers.
private void addSourceContainers(ILaunchConfiguration configuration, IProgressMonitor monitor, final List<ISourceContainer> sourceContainers, IProject project) {
String projectName = project.getName();
try {
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType launchConfigurationType = manager.getLaunchConfigurationType("org.eclipse.jdt.launching.localJavaApplication");
ILaunchConfigurationWorkingCopy sourceLookupConfig = launchConfigurationType.newInstance(null, configuration.getName());
sourceLookupConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, projectName);
ISourceContainer[] computedSourceContainers = super.computeSourceContainers(sourceLookupConfig, monitor);
Stream.of(computedSourceContainers).filter(computedSourceContainer -> !sourceContainers.contains(computedSourceContainer)).forEach(sourceContainers::add);
} catch (CoreException e) {
LiferayServerCore.logError("Unable to add source container for project " + projectName, e);
}
}
use of org.eclipse.debug.core.ILaunchConfigurationType in project liferay-ide by liferay.
the class MavenUIProjectBuilder method runMavenGoal.
public IStatus runMavenGoal(IMavenProjectFacade projectFacade, String goal, String mode, IProgressMonitor monitor) throws CoreException {
IStatus retval = Status.OK_STATUS;
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType launchConfigurationType = launchManager.getLaunchConfigurationType(MavenLaunchConstants.LAUNCH_CONFIGURATION_TYPE_ID);
IPath basedirLocation = getProject().getLocation();
String newName = launchManager.generateLaunchConfigurationName(basedirLocation.lastSegment());
ILaunchConfigurationWorkingCopy workingCopy = launchConfigurationType.newInstance(null, newName);
workingCopy.setAttribute(MavenLaunchConstants.ATTR_POM_DIR, basedirLocation.toString());
workingCopy.setAttribute(MavenLaunchConstants.ATTR_GOALS, goal);
workingCopy.setAttribute(MavenLaunchConstants.ATTR_UPDATE_SNAPSHOTS, Boolean.TRUE);
workingCopy.setAttribute(MavenLaunchConstants.ATTR_WORKSPACE_RESOLUTION, Boolean.TRUE);
workingCopy.setAttribute(MavenLaunchConstants.ATTR_SKIP_TESTS, Boolean.TRUE);
if (projectFacade != null) {
ResolverConfiguration configuration = projectFacade.getResolverConfiguration();
String selectedProfiles = configuration.getSelectedProfiles();
if ((selectedProfiles != null) && (selectedProfiles.length() > 0)) {
workingCopy.setAttribute(MavenLaunchConstants.ATTR_PROFILES, selectedProfiles);
}
/*
* <?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration
* type="org.eclipse.m2e.Maven2LaunchConfigurationType"> <booleanAttribute
* key="M2_DEBUG_OUTPUT" value="false"/> <booleanAttribute
* key="M2_NON_RECURSIVE" value="false"/> <booleanAttribute key="M2_OFFLINE"
* value="false"/> <stringAttribute key="M2_PROFILES" value="v6.2.0"/>
* <listAttribute key="M2_PROPERTIES"/> <stringAttribute key="M2_RUNTIME"
* value="EMBEDDED"/> <intAttribute key="M2_THREADS" value="1"/>
* <stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY"
* value="D:/dev java/workspaces/runtime-eclipse-ide-juno-sr2/WorldDatabase/WorldDatabase-portlet"
* /> </launchConfiguration>
*/
UIJob launchJob = new UIJob("maven launch") {
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
DebugUITools.launch(workingCopy, mode);
return Status.OK_STATUS;
}
};
boolean[] launchTerminated = new boolean[1];
ILaunchListener[] listener = new ILaunchListener[1];
listener[0] = new LaunchAdapter() {
public void launchChanged(ILaunch launch) {
if (launch.getLaunchConfiguration().equals(workingCopy)) {
Thread t = new Thread() {
@Override
public void run() {
while ((launch.getProcesses().length > 0) && !launch.getProcesses()[0].isTerminated()) {
try {
sleep(100);
} catch (InterruptedException ie) {
}
}
launchTerminated[0] = true;
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
launchManager.removeLaunchListener(listener[0]);
}
};
t.start();
}
}
};
launchManager = DebugPlugin.getDefault().getLaunchManager();
launchManager.addLaunchListener(listener[0]);
launchJob.schedule();
while ((Display.getCurrent() == null) && !launchTerminated[0]) {
try {
Thread.sleep(100);
} catch (InterruptedException ie) {
}
}
}
return retval;
}
use of org.eclipse.debug.core.ILaunchConfigurationType in project liferay-ide by liferay.
the class ServerManagerTests method getLaunchConfig.
private ILaunchConfigurationWorkingCopy getLaunchConfig(IPath workingDir, String execFileName, String command) throws CoreException {
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType configType = launchManager.getLaunchConfigurationType("org.eclipse.ui.externaltools.ProgramLaunchConfigurationType");
ILaunchConfigurationWorkingCopy config = configType.newInstance(null, launchManager.generateLaunchConfigurationName("tomcat-server"));
config.setAttribute("org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND", true);
config.setAttribute("org.eclipse.debug.ui.ATTR_CAPTURE_IN_CONSOLE", true);
config.setAttribute("org.eclipse.debug.ui.ATTR_PRIVATE", true);
String execPath = workingDir.append(execFileName).toOSString();
new File(execPath).setExecutable(true);
config.setAttribute("org.eclipse.ui.externaltools.ATTR_LOCATION", execPath);
config.setAttribute("org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY", workingDir.toOSString());
config.setAttribute("org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS", command);
return config;
}
Aggregations