use of org.jboss.tools.openshift.internal.ui.wizard.deployimage.DeployImageWizard in project jbosstools-openshift by jbosstools.
the class DeployImageHandler method runWizard.
public void runWizard(final Shell shell, final IDockerConnection dockerConnection, final IDockerImage image, final IProject project, final Connection connection) {
if (connection != null) {
final boolean[] authorized = new boolean[1];
Job job = new AbstractDelegatingMonitorJob("Checking connection...") {
@Override
protected IStatus doRun(IProgressMonitor monitor) {
try {
authorized[0] = connection.isAuthorized(new NullProgressMonitor());
return Status.OK_STATUS;
} catch (Exception e) {
return new Status(Status.ERROR, OpenShiftUIActivator.PLUGIN_ID, "Unable to load the OpenShift projects for the selected connection.", e);
}
}
};
job.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
shell.getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
DeployImageWizard wizard = new DeployImageWizard(dockerConnection, image, connection, project, authorized[0]);
WizardUtils.openWizardDialog(500, 500, wizard, shell);
}
});
}
});
job.schedule();
} else {
DeployImageWizard wizard = new DeployImageWizard(dockerConnection, image, connection, project, false);
WizardUtils.openWizardDialog(600, 1500, wizard, shell);
}
}
Aggregations