Search in sources :

Example 11 with JobChangeAdapter

use of org.eclipse.core.runtime.jobs.JobChangeAdapter in project tdi-studio-se by Talend.

the class DeleteExtensionAction method run.

public void run() {
    if (extension == null) {
        return;
    }
    try {
        final DeleteExtensionJob job = new DeleteExtensionJob(extension);
        job.addJobChangeListener(new JobChangeAdapter() {

            @Override
            public void done(final IJobChangeEvent event) {
                Display.getDefault().asyncExec(new Runnable() {

                    public void run() {
                        updateUI(job, event);
                    }
                });
            }
        });
        ExchangeUtils.scheduleUserJob(job);
    } catch (Throwable e) {
        ExceptionHandler.process(e);
    }
}
Also used : JobChangeAdapter(org.eclipse.core.runtime.jobs.JobChangeAdapter) IJobChangeEvent(org.eclipse.core.runtime.jobs.IJobChangeEvent) DeleteExtensionJob(org.talend.designer.components.exchange.jobs.DeleteExtensionJob)

Example 12 with JobChangeAdapter

use of org.eclipse.core.runtime.jobs.JobChangeAdapter in project tdi-studio-se by Talend.

the class DownloadComponenentsAction method updateUI.

/**
     * Update ui after job finished.
     * 
     * @param action
     * @param event
     */
private void updateUI(final IJobChangeEvent event) {
    // activate aection again after job finished
    if (fExtensionDownloaded > 0) {
        // refresh palette
        ExchangeUtils.reloadComponents();
        // update needed modules.
        CorePlugin.getDefault().getLibrariesService().resetModulesNeeded();
        // see feature 0005050: confirmation popup once the component is installed
        confirmInstallation();
        // Start Code Generation Init
        ICodeGeneratorService codeGenService = (ICodeGeneratorService) GlobalServiceRegister.getDefault().getService(ICodeGeneratorService.class);
        Job job = codeGenService.refreshTemplates();
        job.addJobChangeListener(new JobChangeAdapter() {

            @Override
            public void done(IJobChangeEvent event) {
                ComponentPaletteUtilities.setSkipUpdatePalette(false);
            }
        });
        RefreshComponenentsAction action = new RefreshComponenentsAction();
        action.run(new String[] { RefreshComponenentsAction.REFRESH_INSTALLED }, ContentConstants.UL_DOWNLOADED_EXTENSIONS);
    }
}
Also used : JobChangeAdapter(org.eclipse.core.runtime.jobs.JobChangeAdapter) IJobChangeEvent(org.eclipse.core.runtime.jobs.IJobChangeEvent) Job(org.eclipse.core.runtime.jobs.Job) ICodeGeneratorService(org.talend.designer.codegen.ICodeGeneratorService)

Example 13 with JobChangeAdapter

use of org.eclipse.core.runtime.jobs.JobChangeAdapter in project tdi-studio-se by Talend.

the class DownloadComponenentsAction method run.

@Override
public void run() {
    try {
        final ComponentExtension selectedExtension = ExchangeManager.getInstance().getSelectedExtension();
        Job job = new DownloadJob(selectedExtension);
        fExtensionDownloaded = 0;
        fDownloadedComponents = new ArrayList<ComponentExtension>();
        job.addJobChangeListener(new JobChangeAdapter() {

            @Override
            public void done(final IJobChangeEvent event) {
                Display.getDefault().asyncExec(new Runnable() {

                    @Override
                    public void run() {
                        updateUI(event);
                    }
                });
            }
        });
        ExchangeUtils.scheduleUserJob(job);
    } catch (Throwable e) {
        ExceptionHandler.process(e);
    }
}
Also used : JobChangeAdapter(org.eclipse.core.runtime.jobs.JobChangeAdapter) ComponentExtension(org.talend.designer.components.exchange.model.ComponentExtension) IJobChangeEvent(org.eclipse.core.runtime.jobs.IJobChangeEvent) Job(org.eclipse.core.runtime.jobs.Job)

Example 14 with JobChangeAdapter

use of org.eclipse.core.runtime.jobs.JobChangeAdapter in project tdi-studio-se by Talend.

the class InsertionExtensionAction method run.

public void run() {
    if (extension == null) {
        return;
    }
    try {
        final InsertionExtensionJob job = new InsertionExtensionJob(extension);
        job.addJobChangeListener(new JobChangeAdapter() {

            @Override
            public void done(final IJobChangeEvent event) {
                Display.getDefault().asyncExec(new Runnable() {

                    public void run() {
                        updateUI(job, event);
                    }
                });
            }
        });
        ExchangeUtils.scheduleUserJob(job);
    } catch (Throwable e) {
        ExceptionHandler.process(e);
    }
}
Also used : InsertionExtensionJob(org.talend.designer.components.exchange.jobs.InsertionExtensionJob) JobChangeAdapter(org.eclipse.core.runtime.jobs.JobChangeAdapter) IJobChangeEvent(org.eclipse.core.runtime.jobs.IJobChangeEvent)

Example 15 with JobChangeAdapter

use of org.eclipse.core.runtime.jobs.JobChangeAdapter in project tdi-studio-se by Talend.

the class RefreshComponenentsAction method run.

public void run(String[] refreshTypes, final String pageToDispaly) {
    List typesToRefresh = null;
    if (refreshTypes == null || refreshTypes.length == 0) {
        typesToRefresh = new ArrayList();
        typesToRefresh.add(REFRESH_ALL);
    } else {
        typesToRefresh = Arrays.asList(refreshTypes);
    }
    if (typesToRefresh.contains(REFRESH_ALL) || typesToRefresh.contains(REFRESH_AVAILABLES)) {
        try {
            final RefreshJob job = new RefreshJob();
            job.addJobChangeListener(new JobChangeAdapter() {

                @Override
                public void done(final IJobChangeEvent event) {
                    Display.getDefault().syncExec(new Runnable() {

                        @Override
                        public void run() {
                            updateUI(job, event);
                            String toDisplay = pageToDispaly == null ? ContentConstants.UL_LIST_AVAILABLE_EXTENSIONS : pageToDispaly;
                            ExchangeManager.getInstance().generateXHTMLPage(toDisplay, new String[] { ContentConstants.INSERT_EXTENSION_DATA });
                        }
                    });
                }
            });
            ExchangeUtils.scheduleUserJob(job);
        } catch (Exception e) {
            ExceptionHandler.process(e);
        }
    }
    // Show Installed Extensions
    if (typesToRefresh.contains(REFRESH_ALL) || typesToRefresh.contains(REFRESH_INSTALLED)) {
        try {
            final ShowInstalledExtensionsJob showInstalledJob = new ShowInstalledExtensionsJob();
            showInstalledJob.addJobChangeListener(new JobChangeAdapter() {

                @Override
                public void done(final IJobChangeEvent event) {
                    Display.getDefault().syncExec(new Runnable() {

                        @Override
                        public void run() {
                            updateInstalledUI(showInstalledJob, event);
                            ExchangeManager.getInstance().generateXHTMLPage(pageToDispaly, new String[] { ContentConstants.DOWNLOADEXTENSION_DATA });
                        }
                    });
                }
            });
            ExchangeUtils.scheduleUserJob(showInstalledJob);
        } catch (Exception e) {
            ExceptionHandler.process(e);
        }
    }
    // Show Contributed Extensions
    if (typesToRefresh.contains(REFRESH_ALL) || typesToRefresh.contains(REFRESH_MY_EXTENSIONS)) {
        try {
            final ShowContributedExtensionsJob showContributedJob = new ShowContributedExtensionsJob();
            showContributedJob.addJobChangeListener(new JobChangeAdapter() {

                @Override
                public void done(final IJobChangeEvent event) {
                    Display.getDefault().syncExec(new Runnable() {

                        @Override
                        public void run() {
                            updateContributedUI(showContributedJob, event);
                            ExchangeManager.getInstance().generateXHTMLPage(pageToDispaly, new String[] { ContentConstants.LIST_MY_EXTENSION });
                        }
                    });
                }
            });
            ExchangeUtils.scheduleUserJob(showContributedJob);
        } catch (Exception e) {
            ExceptionHandler.process(e);
        }
    }
    //
    getVersionRevisionsAndCategorys();
// refreshHTML();
}
Also used : RefreshJob(org.talend.designer.components.exchange.jobs.RefreshJob) ShowInstalledExtensionsJob(org.talend.designer.components.exchange.jobs.ShowInstalledExtensionsJob) JobChangeAdapter(org.eclipse.core.runtime.jobs.JobChangeAdapter) ShowContributedExtensionsJob(org.talend.designer.components.exchange.jobs.ShowContributedExtensionsJob) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) IJobChangeEvent(org.eclipse.core.runtime.jobs.IJobChangeEvent)

Aggregations

IJobChangeEvent (org.eclipse.core.runtime.jobs.IJobChangeEvent)44 JobChangeAdapter (org.eclipse.core.runtime.jobs.JobChangeAdapter)44 Job (org.eclipse.core.runtime.jobs.Job)17 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)16 IStatus (org.eclipse.core.runtime.IStatus)11 IFile (org.eclipse.core.resources.IFile)7 DBRProgressMonitor (org.jkiss.dbeaver.model.runtime.DBRProgressMonitor)6 SubProgressMonitor (org.eclipse.core.runtime.SubProgressMonitor)5 File (java.io.File)4 ArrayList (java.util.ArrayList)4 QAXmlHandler (net.heartsome.cat.ts.core.qa.QAXmlHandler)4 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)4 IOException (java.io.IOException)3 QATUDataBean (net.heartsome.cat.ts.core.qa.QATUDataBean)3 Status (org.eclipse.core.runtime.Status)3 DataSourceJob (org.jkiss.dbeaver.runtime.jobs.DataSourceJob)3 AnalyseBundleResolutionJob (bndtools.tasks.AnalyseBundleResolutionJob)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 ExportDatabaseBean (net.heartsome.cat.database.bean.ExportDatabaseBean)2 ExportFilterBean (net.heartsome.cat.database.bean.ExportFilterBean)2