use of org.jboss.tools.openshift.internal.ui.job.CreateResourceJob in project jbosstools-openshift by jbosstools.
the class NewResourceWizard method performFinish.
@Override
public boolean performFinish() {
boolean success = false;
try (InputStream is = (OpenshiftUIConstants.URL_VALIDATOR.isValid(model.getSource())) ? new URL(model.getSource()).openStream() : new FileInputStream(VariablesHelper.replaceVariables(model.getSource()))) {
final CreateResourceJob createJob = new CreateResourceJob(model.getProject(), is);
createJob.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
IStatus status = event.getResult();
if (JobUtils.isOk(status) || JobUtils.isWarning(status)) {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
new ResourceSummaryDialog(getShell(), createJob.getResource(), "Create Resource Summary", "Results of creating the resource(s)").open();
}
});
OpenShiftUIUtils.showOpenShiftExplorer();
}
}
});
IStatus status = runInWizard(createJob, createJob.getDelegatingProgressMonitor(), getContainer());
success = isSuccess(status);
} catch (InvocationTargetException | InterruptedException | IOException e) {
page.setErrorMessage(e.getClass().getName() + ": " + e.getLocalizedMessage());
success = false;
}
return success;
}
Aggregations