Search in sources :

Example 1 with IBuildTriggerable

use of com.openshift.restclient.capability.resources.IBuildTriggerable in project jbosstools-openshift by jbosstools.

the class StartBuildJob method doRun.

@Override
protected IStatus doRun(IProgressMonitor monitor) {
    try {
        monitor.beginTask("Starting build job", IProgressMonitor.UNKNOWN);
        IBuild build = buildsource.accept(new CapabilityVisitor<IBuildTriggerable, IBuild>() {

            @Override
            public IBuild visit(IBuildTriggerable triggerable) {
                return triggerable.trigger();
            }
        }, null);
        if (build == null) {
            return new Status(Status.INFO, OpenShiftUIActivator.PLUGIN_ID, "Manually triggering builds is unsupported");
        }
        return Status.OK_STATUS;
    } catch (OpenShiftException e) {
        return new Status(Status.ERROR, OpenShiftUIActivator.PLUGIN_ID, NLS.bind("Error starting build {0}.", buildsource.getName()), e);
    } finally {
        monitor.done();
    }
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) IBuildTriggerable(com.openshift.restclient.capability.resources.IBuildTriggerable) OpenShiftException(com.openshift.restclient.OpenShiftException) IBuild(com.openshift.restclient.model.IBuild)

Aggregations

OpenShiftException (com.openshift.restclient.OpenShiftException)1 IBuildTriggerable (com.openshift.restclient.capability.resources.IBuildTriggerable)1 IBuild (com.openshift.restclient.model.IBuild)1 IStatus (org.eclipse.core.runtime.IStatus)1 Status (org.eclipse.core.runtime.Status)1