Search in sources :

Example 1 with AccessingEmfJob

use of org.talend.core.model.utils.AccessingEmfJob in project tdi-studio-se by Talend.

the class AbstractMultiPageTalendEditor method generateCode.

/**
     * DOC bqian Comment method "generateCode".
     */
protected void generateCode() {
    final IProcess2 process = getProcess();
    if (!(process.getProperty().getItem() instanceof ProcessItem)) {
        // shouldn't work for joblet
        return;
    }
    if (process.getGeneratingNodes().size() != 0) {
        Job job = new //$NON-NLS-1$
        AccessingEmfJob(//$NON-NLS-1$
        "Generating code") {

            @Override
            protected IStatus doRun(IProgressMonitor monitor) {
                try {
                    ProcessorUtilities.generateCode(process, process.getContextManager().getDefaultContext(), false, false, true, ProcessorUtilities.GENERATE_WITH_FIRST_CHILD);
                } catch (ProcessorException e) {
                    ExceptionHandler.process(e);
                }
                return Status.OK_STATUS;
            }
        };
        job.setUser(true);
        job.setPriority(Job.BUILD);
        // start as soon as possible
        job.schedule();
    }
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ProcessorException(org.talend.designer.runprocess.ProcessorException) JobletProcessItem(org.talend.core.model.properties.JobletProcessItem) ProcessItem(org.talend.core.model.properties.ProcessItem) AccessingEmfJob(org.talend.core.model.utils.AccessingEmfJob) IProcess2(org.talend.core.model.process.IProcess2) AccessingEmfJob(org.talend.core.model.utils.AccessingEmfJob) Job(org.eclipse.core.runtime.jobs.Job)

Aggregations

IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 Job (org.eclipse.core.runtime.jobs.Job)1 IProcess2 (org.talend.core.model.process.IProcess2)1 JobletProcessItem (org.talend.core.model.properties.JobletProcessItem)1 ProcessItem (org.talend.core.model.properties.ProcessItem)1 AccessingEmfJob (org.talend.core.model.utils.AccessingEmfJob)1 ProcessorException (org.talend.designer.runprocess.ProcessorException)1