Search in sources :

Example 1 with DeployImageJob

use of org.jboss.tools.openshift.internal.ui.job.DeployImageJob in project jbosstools-openshift by jbosstools.

the class DeployImageWizard method getJobChain.

/**
 * Gets the Job to run as a chain of smaller jobs, depending on the use-case
 * @param model the wizard model
 * @param shell the current shell
 * @return
 */
private Job getJobChain(final IDeployImageParameters model, final Shell shell) {
    final DeployImageJob deployJob = getDeployImageJob(getModel(), getShell());
    final boolean pushImageToRegistry = model.isPushImageToRegistry();
    if (pushImageToRegistry) {
        final PushImageToRegistryJob pushImageToRegistryJob = getPushImageToRegistryJob(model);
        return new JobChainBuilder(pushImageToRegistryJob).runWhenSuccessfullyDone(deployJob).runWhenSuccessfullyDone(new RefreshResourcesJob(deployJob, true)).build();
    }
    return new JobChainBuilder(deployJob).runWhenSuccessfullyDone(new RefreshResourcesJob(deployJob, true)).build();
}
Also used : RefreshResourcesJob(org.jboss.tools.openshift.internal.ui.job.RefreshResourcesJob) DeployImageJob(org.jboss.tools.openshift.internal.ui.job.DeployImageJob) PushImageToRegistryJob(org.jboss.tools.openshift.internal.core.docker.PushImageToRegistryJob) JobChainBuilder(org.jboss.tools.openshift.internal.common.core.job.JobChainBuilder)

Example 2 with DeployImageJob

use of org.jboss.tools.openshift.internal.ui.job.DeployImageJob in project jbosstools-openshift by jbosstools.

the class DeployImageWizard method getDeployImageJob.

private static DeployImageJob getDeployImageJob(final IDeployImageParameters model, final Shell shell) {
    final DeployImageJob deployJob = new DeployImageJob(model);
    deployJob.addJobChangeListener(new JobChangeAdapter() {

        @Override
        public void done(IJobChangeEvent event) {
            IStatus status = event.getResult();
            if ((JobUtils.isOk(status) || JobUtils.isWarning(status)) && !deployJob.getResources().isEmpty()) {
                Display.getDefault().syncExec(new Runnable() {

                    @Override
                    public void run() {
                        new ResourceSummaryDialog(shell, deployJob.getResources(), TITLE, deployJob.getSummaryMessage()).open();
                    }
                });
                OpenShiftUIUtils.showOpenShiftExplorer();
            }
        }
    });
    return deployJob;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) DeployImageJob(org.jboss.tools.openshift.internal.ui.job.DeployImageJob) JobChangeAdapter(org.eclipse.core.runtime.jobs.JobChangeAdapter) ResourceSummaryDialog(org.jboss.tools.openshift.internal.ui.dialog.ResourceSummaryDialog) IJobChangeEvent(org.eclipse.core.runtime.jobs.IJobChangeEvent)

Aggregations

DeployImageJob (org.jboss.tools.openshift.internal.ui.job.DeployImageJob)2 IStatus (org.eclipse.core.runtime.IStatus)1 IJobChangeEvent (org.eclipse.core.runtime.jobs.IJobChangeEvent)1 JobChangeAdapter (org.eclipse.core.runtime.jobs.JobChangeAdapter)1 JobChainBuilder (org.jboss.tools.openshift.internal.common.core.job.JobChainBuilder)1 PushImageToRegistryJob (org.jboss.tools.openshift.internal.core.docker.PushImageToRegistryJob)1 ResourceSummaryDialog (org.jboss.tools.openshift.internal.ui.dialog.ResourceSummaryDialog)1 RefreshResourcesJob (org.jboss.tools.openshift.internal.ui.job.RefreshResourcesJob)1