use of org.eclipse.core.runtime.jobs.IJobChangeEvent in project tdi-studio-se by Talend.
the class PaletteSettingPage method okPressed.
protected void okPressed() {
ProgressMonitorDialog pmd = new ProgressMonitorDialog(DisplayUtils.getDefaultShell());
IRunnableWithProgress rwp = new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
IProxyRepositoryFactory prf = CorePlugin.getDefault().getProxyRepositoryFactory();
try {
prf.saveProject(project);
ShowStandardAction.getInstance().doRun();
if (needCodeGen) {
Job refreshTemplates = CorePlugin.getDefault().getCodeGeneratorService().refreshTemplates();
refreshTemplates.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
CorePlugin.getDefault().getLibrariesService().resetModulesNeeded();
}
});
}
// ComponentUtilities.updatePalette();
} catch (Exception ex) {
ExceptionHandler.process(ex);
}
}
};
try {
pmd.run(true, false, rwp);
} catch (InvocationTargetException e) {
ExceptionHandler.process(e);
} catch (InterruptedException e) {
ExceptionHandler.process(e);
}
}
use of org.eclipse.core.runtime.jobs.IJobChangeEvent in project tdi-studio-se by Talend.
the class UploadRevisionAction method run.
public void run() {
if (extension == null) {
return;
}
try {
final UploadRevisionJob job = new UploadRevisionJob(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);
}
}
use of org.eclipse.core.runtime.jobs.IJobChangeEvent 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);
}
}
use of org.eclipse.core.runtime.jobs.IJobChangeEvent 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);
}
}
use of org.eclipse.core.runtime.jobs.IJobChangeEvent 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);
}
}
Aggregations