Example usage for org.eclipse.jface.dialogs ProgressMonitorDialog setCancelable

List of usage examples for org.eclipse.jface.dialogs ProgressMonitorDialog setCancelable

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs ProgressMonitorDialog setCancelable.

Prototype

public void setCancelable(boolean cancelable) 

Source Link

Document

Sets whether the progress dialog is cancelable or not.

Usage

From source file:com.quantcomponents.ui.marketdata.TimeChartDialog.java

License:Open Source License

private boolean executeChange() {
    final Date newStartDate = getStartDate();
    final Date newEndDate = getEndDate();
    try {//from ww w .  j  ava 2 s.  c  o  m
        ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
        dialog.setCancelable(true);
        dialog.run(true, true, new IRunnableWithProgress() {
            @Override
            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                try {
                    chartModel.setSuspendUpdates(true);
                    stockDatabase.getParent().fillHistoricalData(stockDatabase, newStartDate, newEndDate,
                            new TaskMonitorAdapter(monitor, "Retrieving historical data..."));
                    chartModel.setSuspendUpdates(false);
                } catch (Exception e) {
                    MessageDialog.openError(getShell(), "Error",
                            "Error while retrieving historical data: " + LangUtils.exceptionMessage(e));
                }
            }
        });
    } catch (InvocationTargetException e) {
        MessageDialog.openError(getShell(), "Error", "A problem occurred while retrieving historical data");
        return false;
    } catch (InterruptedException e) {
        MessageDialog.openError(getShell(), "Error",
                "Task interrupted while retrieving historical data: " + LangUtils.exceptionMessage(e));
        return false;
    }
    if (isMovingWindow()) {
        chartModel.setFixedDurationWindow(newStartDate, tradingCalendar);
    } else {
        chartModel.setFixedWindow(newStartDate, newEndDate, tradingCalendar);
    }
    return true;
}

From source file:de.topicmapslab.tmcledit.tmclimport.wizards.ImportWizard.java

License:Open Source License

public boolean performFinish() {

    ProgressMonitorDialog monitorDlg = new ProgressMonitorDialog(getShell());
    monitorDlg.setCancelable(false);

    try {//from  w w  w.  j a  va2s.c o  m
        monitorDlg.run(false, false, new LoaderRunnable());
    } catch (Exception e) {
        Activator.logException(e);
        MessageDialog.openError(getShell(), "Error while importing schema",
                "An error occurred:" + e.getMessage() + "[" + e.getClass().getName() + "]");
    }

    return true;
}

From source file:it.eng.spagobi.meta.editor.business.actions.CreateQueryAction.java

License:Mozilla Public License

/**
 * This executes the command.//from ww  w  .j  a  v a 2 s  .  c  o m
 */
@Override
public void run() {
    try {
        int returnCode = Window.CANCEL;
        BusinessModel businessModel = (BusinessModel) ((BusinessRootItemProvider) owner).getParentObject();

        // First, check if there are any physical model objects marked as deleted
        PhysicalModelInitializer physicalModelInitializer = new PhysicalModelInitializer();
        List<ModelObject> markedElements = physicalModelInitializer
                .getElementsMarkedAsDeleted(businessModel.getPhysicalModel());
        if (!markedElements.isEmpty()) {
            DeleteElementsWarningDialog warningDialog = new DeleteElementsWarningDialog(markedElements);
            warningDialog.create();
            warningDialog.setBlockOnOpen(true);
            returnCode = warningDialog.open();
            if (returnCode == Window.OK) {
                // execute a command for mass delete of elements marked as deleted
                DeletePhysicalModelObjectAction deletePhysicalModelObjectAction = new DeletePhysicalModelObjectAction();
                final Command deleteCommand = deletePhysicalModelObjectAction.createCommand(markedElements);
                // this guard is for extra security, but should not be necessary
                if (editingDomain != null && deleteCommand != null) {
                    // use up the command

                    ProgressMonitorDialog progressDialog = new ProgressMonitorDialog(new Shell());
                    progressDialog.setCancelable(false);
                    try {
                        progressDialog.run(false, false, new IRunnableWithProgress() {
                            @Override
                            public void run(IProgressMonitor monitor) {
                                // Note: this is a non-UI Thread
                                monitor.beginTask("Deleting marked elements, please wait...",
                                        IProgressMonitor.UNKNOWN);
                                // doing task...

                                editingDomain.getCommandStack().execute(deleteCommand);

                                monitor.done();
                            }
                        });
                    } catch (InvocationTargetException e1) {
                        e1.printStackTrace();
                    } catch (InterruptedException e1) {
                        e1.printStackTrace();
                    }
                }

            }
        }

        if (markedElements.isEmpty() || returnCode != Window.CANCEL) {
            // check the constraints for hibernate mappings
            BusinessModelInitializer businessModelInitializer = new BusinessModelInitializer();
            List<Pair<BusinessRelationship, Integer>> incorrectRelationships = businessModelInitializer
                    .checkRelationshipsConstraints(businessModel);
            int relationshipsWarningReturnCode = Window.CANCEL;
            if (!incorrectRelationships.isEmpty()) {
                BusinessModelRelationshipsCheckWarningDialog warningDialog = new BusinessModelRelationshipsCheckWarningDialog(
                        incorrectRelationships);
                warningDialog.create();
                warningDialog.setBlockOnOpen(true);
                relationshipsWarningReturnCode = warningDialog.open();
            }

            if (incorrectRelationships.isEmpty() || relationshipsWarningReturnCode == Window.OK) {
                // CreateQueryWizard wizard = new CreateQueryWizard(businessModel, editingDomain, (AbstractSpagoBIModelCommand)command );
                NewQueryFileWizard wizard = new NewQueryFileWizard(businessModel, editingDomain,
                        (ISpagoBIModelCommand) command, modelFileFullPath);
                wizard.init(PlatformUI.getWorkbench(), new StructuredSelection());
                WizardDialog dialog = new WizardDialog(wizard.getShell(), wizard);
                dialog.create();
                dialog.open();
            }

        }

    } catch (Throwable t) {
        t.printStackTrace();
    }
}

From source file:it.eng.spagobi.meta.editor.business.actions.GenerateJPAMappingAction.java

License:Mozilla Public License

/**
 * This executes the command.//from www. j a  va  2 s. c om
 */
@Override
public void run() {
    try {
        int returnCode = Window.CANCEL;

        BusinessModel businessModel = (BusinessModel) ((BusinessRootItemProvider) owner).getParentObject();

        // First, check if there are any physical model objects marked as deleted
        PhysicalModelInitializer physicalModelInitializer = new PhysicalModelInitializer();
        List<ModelObject> markedElements = physicalModelInitializer
                .getElementsMarkedAsDeleted(businessModel.getPhysicalModel());
        if (!markedElements.isEmpty()) {
            DeleteElementsWarningDialog warningDialog = new DeleteElementsWarningDialog(markedElements);
            warningDialog.create();
            warningDialog.setBlockOnOpen(true);
            returnCode = warningDialog.open();
            if (returnCode == Window.OK) {
                // execute a command for mass delete of elements marked as deleted
                DeletePhysicalModelObjectAction deletePhysicalModelObjectAction = new DeletePhysicalModelObjectAction();
                final Command deleteCommand = deletePhysicalModelObjectAction.createCommand(markedElements);
                // this guard is for extra security, but should not be necessary
                if (editingDomain != null && deleteCommand != null) {
                    // use up the command

                    ProgressMonitorDialog progressDialog = new ProgressMonitorDialog(new Shell());
                    progressDialog.setCancelable(false);
                    try {
                        progressDialog.run(false, false, new IRunnableWithProgress() {
                            @Override
                            public void run(IProgressMonitor monitor) {
                                // Note: this is a non-UI Thread
                                monitor.beginTask("Deleting marked elements, please wait...",
                                        IProgressMonitor.UNKNOWN);
                                // doing task...

                                editingDomain.getCommandStack().execute(deleteCommand);

                                monitor.done();
                            }
                        });
                    } catch (InvocationTargetException e1) {
                        e1.printStackTrace();
                    } catch (InterruptedException e1) {
                        e1.printStackTrace();
                    }
                }

            }
        }

        if (markedElements.isEmpty() || returnCode != Window.CANCEL) {
            // check the constraints for hibernate mappings
            BusinessModelInitializer businessModelInitializer = new BusinessModelInitializer();
            List<Pair<BusinessRelationship, Integer>> incorrectRelationships = businessModelInitializer
                    .checkRelationshipsConstraints(businessModel);
            int relationshipsWarningReturnCode = Window.CANCEL;
            if (!incorrectRelationships.isEmpty()) {
                BusinessModelRelationshipsCheckWarningDialog warningDialog = new BusinessModelRelationshipsCheckWarningDialog(
                        incorrectRelationships);
                warningDialog.create();
                warningDialog.setBlockOnOpen(true);
                relationshipsWarningReturnCode = warningDialog.open();
            }

            if (incorrectRelationships.isEmpty() || relationshipsWarningReturnCode == Window.OK) {
                GenerateJPAMappingWizard wizard = new GenerateJPAMappingWizard(businessModel, editingDomain,
                        (ISpagoBIModelCommand) command);
                WizardDialog dialog = new WizardDialog(new Shell(), wizard);
                dialog.create();
                dialog.open();
            }

        }

    } catch (Throwable t) {
        t.printStackTrace();
    }
}

From source file:it.eng.spagobi.meta.editor.multi.wizards.SelectionConnectionPage.java

License:Mozilla Public License

@Override
public void createControl(Composite parent) {
    profiles = dseBridge.getConnectionProfiles();

    Composite container = new Composite(parent, SWT.NULL);
    setControl(container);//w  ww .j  a  v a  2  s.c  o  m
    container.setLayout(new GridLayout(1, false));

    Group grpConnection = new Group(container, SWT.NONE);
    grpConnection.setText(RL.getString("multi.editor.wizard.selectionconnection.label"));
    grpConnection.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    FillLayout fl_grpConnection = new FillLayout(SWT.HORIZONTAL);
    grpConnection.setLayout(fl_grpConnection);

    ListViewer listViewer = new ListViewer(grpConnection, SWT.BORDER | SWT.V_SCROLL);
    connectionList = listViewer.getList();
    connectionList.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {

            // reset combos
            catalogCombo.removeAll();
            catalogCombo.setEnabled(false);
            schemaCombo.removeAll();
            schemaCombo.setEnabled(false);

            selectedConnectionName = connectionList.getSelection()[0];
            // ProgressMonitorDialog to show a progress bar for long
            // operation
            ProgressMonitorDialog dialog = new ProgressMonitorDialog(new Shell());
            dialog.setCancelable(false);

            try {
                dialog.run(true, false, new IRunnableWithProgress() {
                    @Override
                    public void run(IProgressMonitor monitor) {
                        // Note: this is a non-UI Thread
                        monitor.beginTask("Checking connection, please wait...", IProgressMonitor.UNKNOWN);
                        // doing task...
                        jdbcConnection = dseBridge.connect(selectedConnectionName);
                        monitor.done();
                    }
                });
            } catch (InvocationTargetException e1) {
                e1.printStackTrace();
            } catch (InterruptedException e1) {
                e1.printStackTrace();
            }

            if (jdbcConnection != null) {
                setErrorMessage(null);
                setPageComplete(true);
                populateCatalogCombo(jdbcConnection);
            } else {
                setPageComplete(false);
                ErrorDialog.openError(null, "Connection failed",
                        "Connection to database failed, please check your settings",
                        new org.eclipse.core.runtime.Status(IStatus.ERROR, "id",
                                "Connection to database failed"));
                setErrorMessage("Please select a valid connection to continue");
            }
        }
    });
    listViewer.setContentProvider(new ArrayContentProvider());
    listViewer.setLabelProvider(new LabelProvider() {
        @Override
        public String getText(Object element) {
            return ((IConnectionProfile) element).getName();
        }
    });
    listViewer.setInput(profiles);
    Group grpCatalogAndSchema = new Group(container, SWT.NONE);
    grpCatalogAndSchema.setText(RL.getString("multi.editor.wizard.selectionconnection.catalogschema.label"));
    grpCatalogAndSchema.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
    grpCatalogAndSchema.setLayout(new FillLayout(SWT.HORIZONTAL));

    Composite composite = new Composite(grpCatalogAndSchema, SWT.NONE);
    composite.setLayout(new GridLayout(4, false));

    Label lblCatalog = new Label(composite, SWT.NONE);
    lblCatalog.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblCatalog.setText(RL.getString("multi.editor.wizard.selectionconnection.catalog.label"));

    catalogCombo = new Combo(composite, SWT.READ_ONLY);
    catalogCombo.setEnabled(false);
    catalogCombo.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            int selectionIndex = catalogCombo.getSelectionIndex();
            String selectedCatalog = catalogCombo.getItem(selectionIndex);
            populateSchemaCombo(jdbcConnection, selectedCatalog);
        }
    });
    catalogCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Label lblSchema = new Label(composite, SWT.NONE);
    lblSchema.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblSchema.setText(RL.getString("multi.editor.wizard.selectionconnection.schema.label"));

    schemaCombo = new Combo(composite, SWT.READ_ONLY);
    schemaCombo.setEnabled(false);
    schemaCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

}

From source file:it.eng.spagobi.meta.editor.multi.wizards.SpagoBIModelEditorWizard.java

License:Mozilla Public License

private void createPhysicalModel() {
    try {/*from  w  w  w  . j a  v a2 s  .  c om*/
        catalogName = null;
        schemaName = null;

        connectionName = selectionConnectionPage.getConnectionName();
        logger.debug("Connection name is [{}]", connectionName);

        connectionDriver = selectionConnectionPage.getConnectionDriver();
        logger.debug("Connection Driver is [{}]", connectionDriver);

        connectionUrl = selectionConnectionPage.getConnectionUrl();
        logger.debug("Connection URL is [{}]", connectionUrl);

        connectionUsername = selectionConnectionPage.getConnectionUsername();
        logger.debug("Connection username is [{}]", connectionUsername);

        connectionPassword = selectionConnectionPage.getConnectionPassword();
        logger.debug("Connection password is [{}]", connectionPassword);

        connectionDatabaseName = selectionConnectionPage.getConnectionDatabaseName();
        logger.debug("Connection databaseName is [{}]", connectionDatabaseName);

        // Getting Catalog Name
        if (selectionConnectionPage.getCatalogName() != null) {
            catalogName = selectionConnectionPage.getCatalogName();
            logger.debug("Connection catalog name is [{}]", catalogName);
        }
        // Getting Schema Name
        if (selectionConnectionPage.getSchemaName() != null) {
            schemaName = selectionConnectionPage.getSchemaName();
            logger.debug("Connection schema name is [{}]", schemaName);
        }

        // Getting table to import inside physical model
        TableItem[] selectedPhysicalTableItem = physicalTableSelectionPage.getTablesToImport();
        selectedPhysicalTable = new ArrayList<String>();
        for (TableItem item : selectedPhysicalTableItem) {
            selectedPhysicalTable.add(item.getText());
        }

        // Getting Model Name
        modelName = newModelWizardFileCreationPage.getModelName();
        // Getting JDBC Connection
        connection = selectionConnectionPage.getConnection();

        ProgressMonitorDialog dialogPhysicalModel = new ProgressMonitorDialog(new Shell());
        dialogPhysicalModel.setCancelable(false);
        dialogPhysicalModel.run(true, false, new IRunnableWithProgress() {
            @Override
            public void run(IProgressMonitor monitor) {
                // Note: this is a non-UI Thread
                monitor.beginTask("Generating Physical Model of SpagoBI Model, please wait...",
                        IProgressMonitor.UNKNOWN);

                // doing task...
                PhysicalModelInitializer physicalModelInitializer = new PhysicalModelInitializer();
                physicalModelInitializer.setRootModel(spagobiModel);

                // Physical Model initialization
                if (selectedPhysicalTable.isEmpty()) {
                    spagobiModel.getPhysicalModels()
                            .add(physicalModelInitializer.initialize(modelName, connection, connectionName,
                                    connectionDriver, connectionUrl, connectionUsername, connectionPassword,
                                    connectionDatabaseName, catalogName, schemaName));
                } else {
                    // with table filtering
                    spagobiModel.getPhysicalModels()
                            .add(physicalModelInitializer.initialize(modelName, connection, connectionName,
                                    connectionDriver, connectionUrl, connectionUsername, connectionPassword,
                                    connectionDatabaseName, catalogName, schemaName, selectedPhysicalTable));
                }

                monitor.done();
            }
        });
    } catch (InvocationTargetException t) {
        throw new RuntimeException("Impossible to initialize the physical model", t);
    } catch (InterruptedException e) {
        logger.error("Physical Model generation, InterruptedException [{}]", e);
        e.printStackTrace();
    }
}

From source file:it.eng.spagobi.meta.editor.multi.wizards.SpagoBIModelEditorWizard.java

License:Mozilla Public License

private void createBusinessModel() {
    try {//from w  w  w .  j a  v  a  2  s.c  o m

        // Getting physical table to import inside business table
        TableItem[] selectedBusinessTableItem = businessTableSelectionPage.getTablesToImport();
        selectedBusinessTable = new ArrayList<PhysicalTable>();
        PhysicalModel physicalModel = spagobiModel.getPhysicalModels().get(0);
        // check if there are no selected table to import in the Business Model
        if (selectedBusinessTableItem != null) {
            for (TableItem item : selectedBusinessTableItem) {
                PhysicalTable physicalTable = physicalModel.getTable(item.getText());
                selectedBusinessTable.add(physicalTable);
            }
        }

        ProgressMonitorDialog dialogBusinessModel = new ProgressMonitorDialog(new Shell());
        dialogBusinessModel.setCancelable(false);

        dialogBusinessModel.run(true, false, new IRunnableWithProgress() {
            @Override
            public void run(IProgressMonitor monitor) {
                // Note: this is a non-UI Thread
                monitor.beginTask("Generating Business Model of SpagoBI Model, please wait...",
                        IProgressMonitor.UNKNOWN);
                logger.debug("start monitor");
                // doing task...
                // Business Model initialization
                if (selectedBusinessTable.isEmpty()) {
                    // create empty Business Model
                    BusinessModelInitializer businessModelInitializer = new BusinessModelInitializer();
                    spagobiModel.getBusinessModels().add(businessModelInitializer
                            .initializeEmptyBusinessModel(modelName, spagobiModel.getPhysicalModels().get(0)));

                } else {
                    // with table filtering
                    BusinessModelInitializer businessModelInitializer = new BusinessModelInitializer();
                    spagobiModel.getBusinessModels()
                            .add(businessModelInitializer.initialize(modelName,
                                    new PhysicalTableFilter(selectedBusinessTable),
                                    spagobiModel.getPhysicalModels().get(0)));
                }
                // end of task
                logger.debug("end monitor");
                monitor.done();
            }
        });
    } catch (InterruptedException e) {
        logger.error("Business Model generation, InterruptedException [{}]", e);
        e.printStackTrace();
    } catch (Throwable t) {
        throw new RuntimeException("Impossible to initialize the business model", t);
    }
}

From source file:it.eng.spagobi.meta.editor.olap.actions.CreateMondrianAction.java

License:Mozilla Public License

/**
 * This executes the command./*from www.jav a 2s  . co  m*/
 */
@Override
public void run() {
    try {
        int returnCode = Window.CANCEL;

        BusinessModel businessModel = (BusinessModel) ((BusinessRootItemProvider) owner).getParentObject();

        // First, check if there are any physical model objects marked as deleted
        PhysicalModelInitializer physicalModelInitializer = new PhysicalModelInitializer();
        List<ModelObject> markedElements = physicalModelInitializer
                .getElementsMarkedAsDeleted(businessModel.getPhysicalModel());
        if (!markedElements.isEmpty()) {
            DeleteElementsWarningDialog warningDialog = new DeleteElementsWarningDialog(markedElements);
            warningDialog.create();
            warningDialog.setBlockOnOpen(true);
            returnCode = warningDialog.open();
            if (returnCode == Window.OK) {
                // execute a command for mass delete of elements marked as deleted
                DeletePhysicalModelObjectAction deletePhysicalModelObjectAction = new DeletePhysicalModelObjectAction();
                final Command deleteCommand = deletePhysicalModelObjectAction.createCommand(markedElements);
                // this guard is for extra security, but should not be necessary
                if (editingDomain != null && deleteCommand != null) {
                    // use up the command

                    ProgressMonitorDialog progressDialog = new ProgressMonitorDialog(new Shell());
                    progressDialog.setCancelable(false);
                    try {
                        progressDialog.run(false, false, new IRunnableWithProgress() {
                            @Override
                            public void run(IProgressMonitor monitor) {
                                // Note: this is a non-UI Thread
                                monitor.beginTask("Deleting marked elements, please wait...",
                                        IProgressMonitor.UNKNOWN);
                                // doing task...

                                editingDomain.getCommandStack().execute(deleteCommand);

                                monitor.done();
                            }
                        });
                    } catch (InvocationTargetException e1) {
                        e1.printStackTrace();
                    } catch (InterruptedException e1) {
                        e1.printStackTrace();
                    }
                }

            }
        }

        if (markedElements.isEmpty() || returnCode != Window.CANCEL) {
            Model model = businessModel.getParentModel();
            OlapModel olapModel = model.getOlapModels().get(0);

            NewMondrianFileWizard wizard = new NewMondrianFileWizard(olapModel, editingDomain,
                    (ISpagoBIModelCommand) command);
            wizard.init(PlatformUI.getWorkbench(), new StructuredSelection());
            WizardDialog dialog = new WizardDialog(wizard.getShell(), wizard);
            dialog.create();
            dialog.open();
        }

    } catch (Throwable t) {
        t.printStackTrace();
    }
}

From source file:it.eng.spagobi.meta.model.physical.commands.update.UpdatePhysicalModelCommand.java

License:Mozilla Public License

@Override
public void execute() {
    logger.debug("Executing UpdatePhysicalModelCommand");

    physicalModel = (PhysicalModel) parameter.getOwner();

    ProgressMonitorDialog dialog = new ProgressMonitorDialog(new Shell());
    dialog.setCancelable(false);

    try {/*  www.  j a  va2s .com*/
        dialog.run(true, false, new IRunnableWithProgress() {
            @Override
            public void run(IProgressMonitor monitor) {
                // Note: this is a non-UI Thread
                monitor.beginTask("Updating Physical Model, please wait...", IProgressMonitor.UNKNOWN);
                // doing task...
                updatePhysicalModel(physicalModel);

                monitor.done();
            }
        });
    } catch (InvocationTargetException e1) {
        e1.printStackTrace();
    } catch (InterruptedException e1) {
        e1.printStackTrace();
    }
    showInformation("Info", "Physical Model Updated ");

}

From source file:org.apache.sling.ide.eclipse.ui.internal.InstallEditorSection.java

License:Apache License

private void initialize() {

    final ISlingLaunchpadConfiguration config = launchpadServer.getConfiguration();

    quickLocalInstallButton.setSelection(config.bundleInstallLocally());
    bundleLocalInstallButton.setSelection(!config.bundleInstallLocally());

    SelectionListener listener = new SelectionAdapter() {

        @Override// w ww  .j  av a  2 s . c om
        public void widgetSelected(SelectionEvent e) {
            execute(new SetBundleInstallLocallyCommand(server, quickLocalInstallButton.getSelection()));
        }
    };

    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";

                            }
                            monitor.worked(1);

                            monitor.setTaskName("Updating server configuration");
                            final Version finalDeployedVersion = deployedVersion;
                            Display.getDefault().syncExec(new Runnable() {
                                @Override
                                public void run() {
                                    execute(new SetBundleVersionCommand(server,
                                            EmbeddedArtifactLocator.SUPPORT_BUNDLE_SYMBOLIC_NAME,
                                            finalDeployedVersion.toString()));
                                    try {
                                        server.save(false, new NullProgressMonitor());
                                    } catch (CoreException e) {
                                        Activator.getDefault().getLog().log(e.getStatus());
                                    }
                                }
                            });
                            monitor.worked(1);

                        } catch (OsgiClientException e) {
                            throw new InvocationTargetException(e);
                        } catch (URISyntaxException e) {
                            throw new InvocationTargetException(e);
                        } catch (IOException e) {
                            throw new InvocationTargetException(e);
                        } finally {
                            monitor.done();
                        }

                        Display.getDefault().asyncExec(new Runnable() {
                            @Override
                            public void run() {
                                MessageDialog.openInformation(getShell(), "Support bundle install operation",
                                        message);
                            }
                        });
                    }
                });
            } catch (InvocationTargetException e1) {

                IStatus status = new Status(Status.ERROR, Activator.PLUGIN_ID,
                        "Error while installing support bundle: " + e1.getTargetException().getMessage(),
                        e1.getTargetException());

                ErrorDialog.openError(getShell(), "Error while installing support bundle", e1.getMessage(),
                        status);
            } catch (InterruptedException e1) {
                Thread.currentThread().interrupt();
                return;
            }
        }
    });
}