Search in sources :

Example 11 with ProgressDialog

use of org.talend.commons.ui.swt.dialogs.ProgressDialog 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

InvocationTargetException (java.lang.reflect.InvocationTargetException)11 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)11 ProgressDialog (org.talend.commons.ui.swt.dialogs.ProgressDialog)11 EventLoopProgressMonitor (org.talend.commons.ui.swt.dialogs.EventLoopProgressMonitor)8 IOException (java.io.IOException)5 ArrayList (java.util.ArrayList)3 Item (org.talend.core.model.properties.Item)3 TreeItem (org.eclipse.swt.widgets.TreeItem)2 TarException (org.eclipse.ui.internal.wizards.datatransfer.TarException)2 PersistenceException (org.talend.commons.exception.PersistenceException)2 ConnectionItem (org.talend.core.model.properties.ConnectionItem)2 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)2 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 List (java.util.List)1 ZipException (java.util.zip.ZipException)1 IProject (org.eclipse.core.resources.IProject)1 CoreException (org.eclipse.core.runtime.CoreException)1 SubProgressMonitor (org.eclipse.core.runtime.SubProgressMonitor)1 EList (org.eclipse.emf.common.util.EList)1