Example usage for org.springframework.ide.eclipse.boot.dash.util CancelationTokens merge

List of usage examples for org.springframework.ide.eclipse.boot.dash.util CancelationTokens merge

Introduction

In this page you can find the example usage for org.springframework.ide.eclipse.boot.dash.util CancelationTokens merge.

Prototype

public static CancelationToken merge(CancelationToken cancelationToken, IProgressMonitor monitor) 

Source Link

Usage

From source file:org.springframework.ide.eclipse.boot.dash.cloudfoundry.CloudAppDashElement.java

public void restartOnly(UserInteractions ui, CancelationToken cancelationToken, IProgressMonitor monitor)
        throws Exception {
    whileStarting(ui, cancelationToken, monitor, () -> {
        if (!getClient().applicationExists(getName())) {
            throw ExceptionUtil.coreException(
                    "Unable to start the application. Application does not exist anymore in Cloud Foundry: "
                            + getName());
        }/*from www  .ja  va2s  .c  om*/

        checkTerminationRequested(cancelationToken, monitor);

        log("Starting application: " + getName());
        getClient().restartApplication(getName(), CancelationTokens.merge(cancelationToken, monitor));

        new ApplicationRunningStateTracker(cancelationToken, this).startTracking(monitor);

        CFApplicationDetail updatedInstances = getClient().getApplication(getName());
        setDetailedData(updatedInstances);
    });
}

From source file:org.springframework.ide.eclipse.boot.dash.cloudfoundry.CloudAppDashElement.java

public void push(CloudApplicationDeploymentProperties deploymentProperties, RunState runningOrDebugging,
        DebugSupport debugSupport, CancelationToken cancelationToken, UserInteractions ui,
        IProgressMonitor monitor) throws Exception {

    boolean isDebugging = runningOrDebugging == RunState.DEBUGGING;
    whileStarting(ui, cancelationToken, monitor, () -> {
        // Refresh app data and check that the application (still) exists in
        // Cloud Foundry
        // This also ensures that the 'diff change dialog' will pick up on
        // the latest changes.
        // TODO: should this refresh be moved closer to the where we
        // actually compute the diff?
        CloudAppDashElement updatedApp = this.refresh();
        if (updatedApp == null) {
            ExceptionUtil.coreException(new Status(IStatus.ERROR, BootDashActivator.PLUGIN_ID,
                    "No Cloud Application found for '" + getName() + "'"));
        }/*www  .j  a va2 s.c  om*/
        IProject project = getProject();
        if (project == null) {
            ExceptionUtil.coreException(new Status(IStatus.ERROR, BootDashActivator.PLUGIN_ID,
                    "Local project not associated to CF app '" + getName() + "'"));
        }

        checkTerminationRequested(cancelationToken, monitor);

        CloudApplicationDeploymentProperties properties = deploymentProperties == null
                ? getCloudModel().resolveDeploymentProperties(updatedApp, ui, monitor)
                : deploymentProperties;

        // Update JAVA_OPTS env variable with Remote DevTools Client secret
        DevtoolsUtil.setupEnvVarsForRemoteClient(properties.getEnvironmentVariables(),
                DevtoolsUtil.getSecret(project));
        if (debugSupport != null) {
            if (isDebugging) {
                debugSupport.setupEnvVars(properties.getEnvironmentVariables());
            } else {
                debugSupport.clearEnvVars(properties.getEnvironmentVariables());
            }
        }

        checkTerminationRequested(cancelationToken, monitor);

        CFPushArguments pushArgs = properties.toPushArguments(getCloudModel().getCloudDomains(monitor));

        getClient().push(pushArgs, CancelationTokens.merge(cancelationToken, monitor));

        log("Application pushed to Cloud Foundry: " + getName());
    });
}