/** * Update ui after job finished. * * @param action * @param job * @param event */ private void updateInstalledUI( final ShowInstalledExtensionsJob showInstalledJob, final IJobChangeEvent event) { if (event.getResult().isOK()) { // update exchange view List<ComponentExtension> extensions = showInstalledJob.getfInstalledExtensions(); ExchangeManager.getInstance().updateInstalledExtensions(extensions); } }
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(); }