Search in sources :

Example 1 with ResourceSummaryDialog

use of org.jboss.tools.openshift.internal.ui.dialog.ResourceSummaryDialog 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;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) JobChangeAdapter(org.eclipse.core.runtime.jobs.JobChangeAdapter) ResourceSummaryDialog(org.jboss.tools.openshift.internal.ui.dialog.ResourceSummaryDialog) CreateResourceJob(org.jboss.tools.openshift.internal.ui.job.CreateResourceJob) IJobChangeEvent(org.eclipse.core.runtime.jobs.IJobChangeEvent) IOException(java.io.IOException) URL(java.net.URL) FileInputStream(java.io.FileInputStream) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 2 with ResourceSummaryDialog

use of org.jboss.tools.openshift.internal.ui.dialog.ResourceSummaryDialog 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)

Example 3 with ResourceSummaryDialog

use of org.jboss.tools.openshift.internal.ui.dialog.ResourceSummaryDialog in project jbosstools-openshift by jbosstools.

the class CreateApplicationFromImageJob method getSummaryRunnable.

@Override
public Runnable getSummaryRunnable(final Shell shell) {
    return new Runnable() {

        @Override
        public void run() {
            String message = NLS.bind("Results of creating the resources from the {0}/{1} builder image.", buildConfigModel.getBuilderImageNamespace(), buildConfigModel.getBuilderImageName());
            new ResourceSummaryDialog(shell, getResources(), "Create Application Summary", message).open();
        }
    };
}
Also used : ResourceSummaryDialog(org.jboss.tools.openshift.internal.ui.dialog.ResourceSummaryDialog)

Example 4 with ResourceSummaryDialog

use of org.jboss.tools.openshift.internal.ui.dialog.ResourceSummaryDialog in project jbosstools-openshift by jbosstools.

the class ApplicationSourceListPage method onDefinedResourcesClicked.

private SelectionAdapter onDefinedResourcesClicked() {
    return new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            ITemplate template = (ITemplate) model.getSelectedAppSource().getSource();
            new ResourceSummaryDialog(getShell(), template.getObjects(), "Template Details", NLS.bind("The following resources will be created by using template\n\"{0}\":", template.getName()), new ResourceDetailsLabelProvider(template.getParameters()), new ResourceDetailsContentProvider()).open();
        }
    };
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ResourceSummaryDialog(org.jboss.tools.openshift.internal.ui.dialog.ResourceSummaryDialog) ITemplate(com.openshift.restclient.model.template.ITemplate)

Aggregations

ResourceSummaryDialog (org.jboss.tools.openshift.internal.ui.dialog.ResourceSummaryDialog)4 IStatus (org.eclipse.core.runtime.IStatus)2 IJobChangeEvent (org.eclipse.core.runtime.jobs.IJobChangeEvent)2 JobChangeAdapter (org.eclipse.core.runtime.jobs.JobChangeAdapter)2 ITemplate (com.openshift.restclient.model.template.ITemplate)1 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 URL (java.net.URL)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 CreateResourceJob (org.jboss.tools.openshift.internal.ui.job.CreateResourceJob)1 DeployImageJob (org.jboss.tools.openshift.internal.ui.job.DeployImageJob)1