Package com.cedarsoft.spring.rcp.commands

Source Code of com.cedarsoft.spring.rcp.commands.BackgroundActionCommand

package com.cedarsoft.spring.rcp.commands;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.NonNls;
import com.cedarsoft.spring.rcp.async.BackgroundAction;
import com.cedarsoft.spring.rcp.async.BlockingBackgroundActionRunner;

/**
* Executes a background action within a command
*/
public class BackgroundActionCommand extends ExtendedCommand {
  @NotNull
  private final BackgroundAction backgroundAction;

  /**
   * Creates a new command
   *
   * @param commandId        the command id
   * @param backgroundAction the background action that is executed
   */
  public BackgroundActionCommand( @NotNull @NonNls String commandId, @NotNull BackgroundAction backgroundAction ) {
    super( commandId );
    this.backgroundAction = backgroundAction;
  }

  @Override
  protected void executeCommand() throws Exception {
    new BlockingBackgroundActionRunner( getApplicationWindow(), backgroundAction ).run();
  }
}
TOP

Related Classes of com.cedarsoft.spring.rcp.commands.BackgroundActionCommand

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.