Search in sources :

Example 1 with NewImportProjectWizard

use of org.talend.repository.ui.login.NewImportProjectWizard in project tdi-studio-se by Talend.

the class ImportDemoProjectPage method prefromFinish.

public boolean prefromFinish() {
    final DemoProjectBean selectPro = this.demoProjectList.get(selectedDemoProjectIndex);
    NewImportProjectWizard newPrjWiz = new NewImportProjectWizard();
    WizardDialog newProjectDialog = new WizardDialog(getShell(), newPrjWiz);
    //$NON-NLS-1$
    newProjectDialog.setTitle(Messages.getString("NewImportProjectWizard.windowTitle"));
    if (newProjectDialog.open() == Window.OK) {
        projectName = newPrjWiz.getName().trim().replace(' ', '_');
        // final String demoProjName = selectPro.getProjectName();
        //
        ProgressDialog progressDialog = new ProgressDialog(getShell()) {

            private IProgressMonitor monitorWrap;

            @Override
            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                monitorWrap = new EventLoopProgressMonitor(monitor);
                try {
                    // }
                    if (null == selectPro) {
                        //$NON-NLS-1$
                        throw new IOException("cannot find selected demo project");
                    }
                    ImportProjectsUtilities.importDemoProject(getShell(), projectName, selectPro, monitor);
                } catch (Exception e1) {
                    projectName = null;
                    throw new InvocationTargetException(e1);
                }
                monitorWrap.done();
            }
        };
        try {
            progressDialog.executeProcess();
        } catch (InvocationTargetException e1) {
            projectName = null;
            MessageBoxExceptionHandler.process(e1.getTargetException(), getShell());
        } catch (InterruptedException e1) {
            projectName = null;
        }
    }
    return true;
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) NewImportProjectWizard(org.talend.repository.ui.login.NewImportProjectWizard) EventLoopProgressMonitor(org.talend.commons.ui.swt.dialogs.EventLoopProgressMonitor) IOException(java.io.IOException) ProgressDialog(org.talend.commons.ui.swt.dialogs.ProgressDialog) WizardDialog(org.eclipse.jface.wizard.WizardDialog) IOException(java.io.IOException) InvocationTargetException(java.lang.reflect.InvocationTargetException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 EventLoopProgressMonitor (org.talend.commons.ui.swt.dialogs.EventLoopProgressMonitor)1 ProgressDialog (org.talend.commons.ui.swt.dialogs.ProgressDialog)1 NewImportProjectWizard (org.talend.repository.ui.login.NewImportProjectWizard)1