Search in sources :

Example 1 with ILaunch

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);
}
Also used : IDebugEventSetListener(org.eclipse.debug.core.IDebugEventSetListener) DebugEvent(org.eclipse.debug.core.DebugEvent) ILaunch(org.eclipse.debug.core.ILaunch) ProjectLauncher(aQute.bnd.build.ProjectLauncher) IProcess(org.eclipse.debug.core.model.IProcess)

Example 2 with ILaunch

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);
}
Also used : IProcess2(org.talend.core.model.process.IProcess2) ILaunch(org.eclipse.debug.core.ILaunch) ILaunchManager(org.eclipse.debug.core.ILaunchManager) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) Point(org.eclipse.swt.graphics.Point)

Example 3 with ILaunch

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);
}
Also used : IProcess2(org.talend.core.model.process.IProcess2) ILaunch(org.eclipse.debug.core.ILaunch) ILaunchManager(org.eclipse.debug.core.ILaunchManager)

Example 4 with ILaunch

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);
}
Also used : SaveJobBeforeRunAction(org.talend.designer.runprocess.ui.actions.SaveJobBeforeRunAction) IProcess2(org.talend.core.model.process.IProcess2) ILaunch(org.eclipse.debug.core.ILaunch) ILaunchManager(org.eclipse.debug.core.ILaunchManager)

Example 5 with ILaunch

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;
}
Also used : ILaunch(org.eclipse.debug.core.ILaunch) IDebugTarget(org.eclipse.debug.core.model.IDebugTarget)

Aggregations

ILaunch (org.eclipse.debug.core.ILaunch)7 ILaunchManager (org.eclipse.debug.core.ILaunchManager)3 IProcess (org.eclipse.debug.core.model.IProcess)3 IProcess2 (org.talend.core.model.process.IProcess2)3 BndPreferences (bndtools.preferences.BndPreferences)2 IResource (org.eclipse.core.resources.IResource)2 IStatus (org.eclipse.core.runtime.IStatus)2 Status (org.eclipse.core.runtime.Status)2 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)2 IStatusHandler (org.eclipse.debug.core.IStatusHandler)2 ProjectLauncher (aQute.bnd.build.ProjectLauncher)1 CoreException (org.eclipse.core.runtime.CoreException)1 MultiStatus (org.eclipse.core.runtime.MultiStatus)1 DebugEvent (org.eclipse.debug.core.DebugEvent)1 IDebugEventSetListener (org.eclipse.debug.core.IDebugEventSetListener)1 IDebugTarget (org.eclipse.debug.core.model.IDebugTarget)1 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)1 Point (org.eclipse.swt.graphics.Point)1 SaveJobBeforeRunAction (org.talend.designer.runprocess.ui.actions.SaveJobBeforeRunAction)1