use of org.eclipse.debug.core.model.IDebugTarget in project webtools.sourceediting by eclipse.
the class JAXPJavaLaunchConfigurationDelegate method launch.
@Override
public synchronized void launch(ILaunchConfiguration configuration, final String mode, final ILaunch launch, IProgressMonitor monitor) throws CoreException {
this.mode = mode;
launchHelper.save(getLaunchConfigFile());
// set the launch name
IProcessorInstall install = getProcessorInstall(configuration, mode);
String tfactory = getTransformerFactory(install);
String name = install.getName();
if (tfactory != null)
// $NON-NLS-1$//$NON-NLS-2$
name += "[" + tfactory + "]";
// $NON-NLS-1$
launch.setAttribute("launchName", name);
// the super.launch will add a Java source director if we set it to null
// here
final ISourceLocator configuredLocator = launch.getSourceLocator();
launch.setSourceLocator(null);
super.launch(configuration, mode, launch, monitor);
// now get the java source locator
final ISourceLocator javaSourceLookupDirector = launch.getSourceLocator();
// now add our own participant to the java director
launch.setSourceLocator(new ISourceLocator() {
public Object getSourceElement(IStackFrame stackFrame) {
// simply look at one and then the other
Object sourceElement = javaSourceLookupDirector.getSourceElement(stackFrame);
if (sourceElement == null)
sourceElement = configuredLocator.getSourceElement(stackFrame);
return sourceElement;
}
});
// IJavaDebugTarget javaTarget =
// (IJavaDebugTarget)launch.getDebugTarget();
// launch.removeDebugTarget(javaTarget);
IDebugTarget javaTarget = launch.getDebugTarget();
IDebugTarget xslTarget = new JAXPDebugTarget(launch, launch.getProcesses()[0], launchHelper);
// remove java as the primary target and make xsl the primary target
launch.removeDebugTarget(javaTarget);
launch.addDebugTarget(xslTarget);
// add this here to make java the non-primary target
// launch.addDebugTarget(javaTarget);
// launch.addDebugTarget(new JavaXSLDebugTarget(launch,
// launch.getProcesses()[0], launchHelper, javaTarget));
}
use of org.eclipse.debug.core.model.IDebugTarget in project webtools.servertools by eclipse.
the class ExternalDebugLaunchConfigurationDelegate method launch.
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
*/
@SuppressWarnings({ "unchecked", "null" })
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
if (monitor == null) {
monitor = new NullProgressMonitor();
}
monitor.beginTask(NLS.bind(GenericServerCoreMessages.attachingToExternalGenericServer, new String[] { configuration.getName() }), 3);
// check for cancellation
if (monitor.isCanceled()) {
return;
}
monitor.subTask(GenericServerCoreMessages.verifyingExternalServerDebuggingLaunchAttributes);
String connectorId = getVMConnectorId(configuration);
IVMConnector connector = null;
if (connectorId == null) {
connector = JavaRuntime.getDefaultVMConnector();
} else {
connector = JavaRuntime.getVMConnector(connectorId);
}
if (connector == null) {
abort(GenericServerCoreMessages.externalServerDebugConnectorNotSpecified, null, IJavaLaunchConfigurationConstants.ERR_CONNECTOR_NOT_AVAILABLE);
}
Map argMap = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_CONNECT_MAP, (Map) null);
int connectTimeout = JavaRuntime.getPreferences().getInt(JavaRuntime.PREF_CONNECT_TIMEOUT);
// $NON-NLS-1$//$NON-NLS-2$
argMap.put("timeout", "" + connectTimeout);
// check for cancellation
if (monitor.isCanceled()) {
return;
}
monitor.worked(1);
monitor.subTask(GenericServerCoreMessages.creatingExternalServerDebuggingSourceLocator);
// set the default source locator if required
setDefaultSourceLocator(launch, configuration);
monitor.worked(1);
// connect to remote VM
connector.connect(argMap, monitor, launch);
// check for cancellation
if (monitor.isCanceled()) {
IDebugTarget[] debugTargets = launch.getDebugTargets();
for (int i = 0; i < debugTargets.length; i++) {
IDebugTarget target = debugTargets[i];
if (target.canDisconnect()) {
target.disconnect();
}
}
return;
}
monitor.done();
}
use of org.eclipse.debug.core.model.IDebugTarget in project liferay-ide by liferay.
the class FMDebugTarget method suspendRelatedJavaThread.
boolean suspendRelatedJavaThread(final long remoteThreadId) throws DebugException {
boolean retval = false;
for (IDebugTarget target : this.launch.getDebugTargets()) {
if (target instanceof IJavaDebugTarget) {
IJavaDebugTarget javaTarget = (IJavaDebugTarget) target;
IThread[] threads = javaTarget.getThreads();
for (final IThread thread : threads) {
if (thread instanceof JDIThread) {
JDIThread jdiThread = (JDIThread) thread;
ThreadReference underlyingThread = jdiThread.getUnderlyingThread();
Field tidField = underlyingThread.referenceType().fieldByName("tid");
Value tidValue = underlyingThread.getValue(tidField);
long threadId = Long.parseLong(tidValue.toString());
if (threadId == remoteThreadId) {
thread.suspend();
break;
}
}
}
}
}
return retval;
}
use of org.eclipse.debug.core.model.IDebugTarget in project jbosstools-openshift by jbosstools.
the class OpenShiftLaunchController method overrideHotcodeReplace.
protected boolean overrideHotcodeReplace(IServer server, ILaunch launch) throws CoreException {
IJavaHotCodeReplaceListener l = getHotCodeReplaceListener(server, launch);
IDebugTarget[] targets = launch.getDebugTargets();
if (targets != null && l != null) {
for (int i = 0; i < targets.length; i++) {
if (targets[i] instanceof IJavaDebugTarget) {
((IJavaDebugTarget) targets[i]).addHotCodeReplaceListener(l);
}
}
}
return true;
}
use of org.eclipse.debug.core.model.IDebugTarget in project statecharts by Yakindu.
the class SCTHotModelReplacementManager method getAffectedTargets.
private List<IDebugTarget> getAffectedTargets() {
List<IDebugTarget> targets = new ArrayList<IDebugTarget>();
synchronized (activeTargets) {
for (IDebugTarget debugTarget : activeTargets) {
if (debugTarget instanceof SCTDebugTarget) {
String resourceString = ((SCTDebugElement) debugTarget).getResourceString();
IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(resourceString);
if (changedFiles.contains(resource)) {
targets.add(debugTarget);
}
}
}
}
return targets;
}
Aggregations