quickLocalInstallButton.addSelectionListener(listener);
bundleLocalInstallButton.addSelectionListener(listener);
Version serverVersion = launchpadServer.getBundleVersion(EmbeddedArtifactLocator.SUPPORT_BUNDLE_SYMBOLIC_NAME);
final EmbeddedArtifact supportBundle = artifactLocator.loadToolingSupportBundle();
final Version embeddedVersion = new Version(supportBundle.getVersion());
updateActionArea(serverVersion, embeddedVersion);
installOrUpdateSupportBundleLink.addHyperlinkListener(new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent e) {
ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
dialog.setCancelable(true);
try {
dialog.run(true, false, new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException,
InterruptedException {
final Version remoteVersion;
monitor.beginTask("Installing support bundle", 3);
// double-check, just in case
monitor.setTaskName("Getting remote bundle version");
Version deployedVersion;
final String message;
try {
RepositoryInfo repositoryInfo = ServerUtil.getRepositoryInfo(server.getOriginal(),
monitor);
OsgiClient client = osgiClientFactory.createOsgiClient(repositoryInfo);
remoteVersion = client
.getBundleVersion(EmbeddedArtifactLocator.SUPPORT_BUNDLE_SYMBOLIC_NAME);
deployedVersion = remoteVersion;
monitor.worked(1);
if (remoteVersion != null && remoteVersion.compareTo(embeddedVersion) >= 0) {
// version already up-to-date, due to bundle version
// changing between startup check and now
message = "Bundle is already installed and up to date";
} else {
monitor.setTaskName("Installing bundle");
InputStream contents = null;
try {
contents = supportBundle.openInputStream();
client.installBundle(contents, supportBundle.getName());
} finally {
IOUtils.closeQuietly(contents);
}
deployedVersion = embeddedVersion;
message = "Bundle version " + embeddedVersion + " installed";