use of org.talend.core.model.runprocess.IEclipseProcessor in project tdi-studio-se by Talend.
the class ProcessDebugDialog method okPressed.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.dialogs.Dialog#okPressed()
*/
@Override
protected void okPressed() {
if (contextComposite.promptConfirmLauch()) {
final IContext context = contextComposite.getSelectedContext();
super.okPressed();
IRunnableWithProgress worker = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) {
IProcessor processor = ProcessorUtilities.getProcessor(process, process.getProperty(), context);
//$NON-NLS-1$
monitor.beginTask("Launching debugger", IProgressMonitor.UNKNOWN);
try {
// use this function to generate childrens also.
ProcessorUtilities.generateCode(process, context, false, false, true, monitor);
ILaunchConfiguration config = ((IEclipseProcessor) processor).debug();
if (config != null) {
// PlatformUI.getWorkbench().getActiveWorkbenchWindow().addPerspectiveListener(new
// DebugInNewWindowListener());
DebugUITools.launch(config, ILaunchManager.DEBUG_MODE);
} else {
MessageDialog.openInformation(getShell(), Messages.getString("ProcessDebugDialog.debugBtn"), //$NON-NLS-1$
Messages.getString(//$NON-NLS-1$ //$NON-NLS-2$
"ProcessDebugDialog.errortext"));
}
} catch (ProcessorException e) {
IStatus status = new Status(IStatus.ERROR, RunProcessPlugin.PLUGIN_ID, IStatus.OK, "Debug launch failed.", //$NON-NLS-1$
e);
RunProcessPlugin.getDefault().getLog().log(status);
//$NON-NLS-1$
MessageDialog.openError(//$NON-NLS-1$
getShell(), //$NON-NLS-1$
Messages.getString("ProcessDebugDialog.debugBtn"), //$NON-NLS-1$
"");
} finally {
monitor.done();
}
}
};
IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
try {
progressService.runInUI(PlatformUI.getWorkbench().getProgressService(), worker, ResourcesPlugin.getWorkspace().getRoot());
} catch (InvocationTargetException e) {
// e.printStackTrace();
ExceptionHandler.process(e);
} catch (InterruptedException e) {
// e.printStackTrace();
ExceptionHandler.process(e);
}
}
}
Aggregations