Search in sources :

Example 1 with ShowInstalledExtensionsJob

use of org.talend.designer.components.exchange.jobs.ShowInstalledExtensionsJob 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

ArrayList (java.util.ArrayList)1 List (java.util.List)1 IJobChangeEvent (org.eclipse.core.runtime.jobs.IJobChangeEvent)1 JobChangeAdapter (org.eclipse.core.runtime.jobs.JobChangeAdapter)1 RefreshJob (org.talend.designer.components.exchange.jobs.RefreshJob)1 ShowContributedExtensionsJob (org.talend.designer.components.exchange.jobs.ShowContributedExtensionsJob)1 ShowInstalledExtensionsJob (org.talend.designer.components.exchange.jobs.ShowInstalledExtensionsJob)1