use of org.eclipse.debug.core.ILaunch in project bndtools by bndtools.
the class AbstractOSGiLaunchDelegate method launch.
@Override
public void launch(ILaunchConfiguration configuration, String mode, final ILaunch launch, IProgressMonitor monitor) throws CoreException {
// Register listener to clean up temp files on exit of launched JVM
final ProjectLauncher launcher = getProjectLauncher();
IDebugEventSetListener listener = new IDebugEventSetListener() {
@Override
public void handleDebugEvents(DebugEvent[] events) {
for (DebugEvent event : events) {
if (event.getKind() == DebugEvent.TERMINATE) {
Object source = event.getSource();
if (source instanceof IProcess) {
ILaunch processLaunch = ((IProcess) source).getLaunch();
if (processLaunch == launch) {
// Not interested in any further events =>
// unregister this listener
DebugPlugin.getDefault().removeDebugEventListener(this);
// *may* cause LinkageErrors.
try {
launcher.cleanup();
} catch (Throwable t) {
logger.logError("Error cleaning launcher temporary files", t);
}
LaunchUtils.endRun((Run) launcher.getProject());
}
}
}
}
}
};
DebugPlugin.getDefault().addDebugEventListener(listener);
// Now actually launch
super.launch(configuration, mode, launch, monitor);
}
use of org.eclipse.debug.core.ILaunch in project tdi-studio-se by Talend.
the class DebugProcessTosComposite method exec.
public void exec() {
setHideconsoleLine(false);
if (getProcessContext() == null) {
return;
}
if (getProcessContext().getProcess() instanceof IProcess2) {
ReplaceNodesInProcessProvider.beforeRunJobInGUI(getProcessContext().getProcess());
}
CorePlugin.getDefault().getRunProcessService().saveJobBeforeRun(getProcessContext().getProcess());
if (manager.getClearBeforeExec()) {
processContext.clearMessages();
}
if (manager.getExecTime()) {
processContext.switchTime();
}
processContext.setWatchAllowed(manager.getExecTime());
processContext.setMonitorPerf(manager.getStat());
// processContext.setMonitorTrace(traceBtn.getSelection());
processContext.setNextBreakPoint(false);
processContext.setSelectedContext(manager.getSelectContext());
processContext.exec(manager.getProcessShell());
checkSaveBeforeRunSelection();
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunch[] launches = manager.getLaunches();
manager.removeLaunches(launches);
// trace debug to collect when tos
IPreferenceStore preferenceStore = RunProcessPlugin.getDefault().getPreferenceStore();
int num = preferenceStore.getInt(RunProcessTokenCollector.TOS_COUNT_DEBUG_RUNS.getPrefKey());
preferenceStore.setValue(RunProcessTokenCollector.TOS_COUNT_DEBUG_RUNS.getPrefKey(), num + 1);
}
use of org.eclipse.debug.core.ILaunch in project tdi-studio-se by Talend.
the class ProcessComposite method exec.
public void exec() {
setHideconsoleLine(false);
if (getProcessContext() == null) {
return;
}
if (getProcessContext().getProcess() instanceof IProcess2) {
ReplaceNodesInProcessProvider.beforeRunJobInGUI(getProcessContext().getProcess());
}
CorePlugin.getDefault().getRunProcessService().saveJobBeforeRun(getProcessContext().getProcess());
if (processContext.isClearBeforeExec()) {
processContext.clearMessages();
}
// processContext.
// if (processContext.isWatchAllowed()) {
// processContext.switchTime();
// }
processContext.setMonitorTrace(false);
processContext.setWatchAllowed(processManager.getExecTime());
processContext.setMonitorPerf(processManager.getStat());
// processContext.setMonitorTrace(traceBtn.getSelection());
/* check and save should be execute before processContext.exec,or it will cause dirty problem,bug 16791 */
checkSaveBeforeRunSelection();
processContext.setSelectedContext(processManager.getSelectContext());
processContext.exec(processManager.getProcessShell());
processContext.cleanWorkingDirectory();
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunch[] launches = manager.getLaunches();
manager.removeLaunches(launches);
}
use of org.eclipse.debug.core.ILaunch in project tdi-studio-se by Talend.
the class MemoryRuntimeComposite method exec.
private void exec() {
if (processContext instanceof IProcess2) {
ReplaceNodesInProcessProvider.beforeRunJobInGUI(processContext.getProcess());
}
CorePlugin.getDefault().getRunProcessService().saveJobBeforeRun(processContext.getProcess());
if (processContext.isClearBeforeExec()) {
processContext.clearMessages();
}
processContext.setMonitorTrace(false);
processContext.setWatchAllowed(processManager.getExecTime());
processContext.setMonitorPerf(processManager.getStat());
if (processContext.isSaveBeforeRun()) {
SaveJobBeforeRunAction action = new SaveJobBeforeRunAction(processContext.getProcess());
action.run();
}
processContext.setSelectedContext(processManager.getSelectContext());
processContext.exec(processManager.getProcessShell());
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunch[] launches = manager.getLaunches();
manager.removeLaunches(launches);
}
use of org.eclipse.debug.core.ILaunch in project bndtools by bndtools.
the class LaunchThread method getAdapter.
@SuppressWarnings("rawtypes")
@Override
public Object getAdapter(Class adapter) {
if (adapter.equals(IProcess.class)) {
return this;
}
if (adapter.equals(IDebugTarget.class)) {
ILaunch launch = getLaunch();
IDebugTarget[] targets = launch.getDebugTargets();
for (int i = 0; i < targets.length; i++) {
if (this.equals(targets[i].getProcess())) {
return targets[i];
}
}
return null;
}
if (adapter.equals(ILaunch.class)) {
return getLaunch();
}
if (adapter.equals(ILaunchConfiguration.class)) {
return getLaunch().getLaunchConfiguration();
}
return null;
}
Aggregations