use of de.janrufmonitor.ui.jface.wizards.pages.UpdatesPage in project janrufmonitor by tbrandt77.
the class UpdateWizard method performFinish.
public boolean performFinish() {
final List l = ((UpdatesPage) this.m_pages[0]).getResult();
final boolean isMoreUpdates = ((UpdatesPage) this.m_pages[0]).isMoreUpdates();
if (l.size() > 0) {
try {
IRunnableWithProgress op = new IRunnableWithProgress() {
public void run(IProgressMonitor pm) throws InvocationTargetException, InterruptedException {
pm.setTaskName(m_i18n.getString(getNamespace(), "updates", "label", m_language));
Properties p = null;
String url, name = null;
StreamRequester sr = null;
for (int i = 0, n = l.size(); i < n; i++) {
p = (Properties) l.get(i);
url = p.getProperty(InstallerConst.DESCRIPTOR_UPDATE);
name = p.getProperty(InstallerConst.DESCRIPTOR_NAME) + "." + p.getProperty(InstallerConst.DESCRIPTOR_VERSION) + InstallerConst.EXTENSION_ARCHIVE;
if (url != null && url.length() > 6) {
pm.subTask(m_i18n.getString(getNamespace(), "install", "label", m_language) + name);
sr = new StreamRequester(url);
sr.go();
try {
InstallerEngine.getInstance().install(name, sr.getInputStream(), (i == (n - 1)));
} catch (InstallerException e) {
m_logger.severe(e.getMessage());
PropagationFactory.getInstance().fire(new Message(Message.ERROR, getNamespace(), "failed", new Exception("Installation failed for module " + url)));
}
}
}
DisplayManager.getDefaultDisplay().asyncExec(new Runnable() {
public void run() {
MessageDialog.openInformation(getShell(), m_i18n.getString(getNamespace(), "success", "label", m_language), m_i18n.getString(getNamespace(), "success", "description", m_language));
m_finished = true;
}
});
if (isMoreUpdates) {
DisplayManager.getDefaultDisplay().asyncExec(new Runnable() {
public void run() {
MessageDialog.openInformation(getShell(), m_i18n.getString(getNamespace(), "moreupdates", "label", m_language), m_i18n.getString(getNamespace(), "moreupdates", "description", m_language));
m_finished = true;
}
});
}
}
};
ProgressMonitorDialog pmd = new ProgressMonitorDialog(getShell());
pmd.run(true, true, op);
} catch (InvocationTargetException e) {
this.m_logger.log(Level.SEVERE, e.getMessage(), e);
m_finished = true;
} catch (InterruptedException e) {
this.m_logger.log(Level.SEVERE, e.getMessage(), e);
m_finished = true;
}
}
while (!m_finished) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
this.m_logger.log(Level.SEVERE, e.getMessage(), e);
m_finished = true;
}
}
return true;
}
Aggregations