# InstallAction

Import: `import com.install4j.api.actions.InstallAction;`

```java
interface InstallAction extends Action
```

All install actions must implement this interface. You have to override all methods and provide a public constructor with no arguments.
It is recommended that you choose one of the derived abstract classes as a superclass.

## Inherited from

- [Action](Action.md) — 1 methods

## Methods

| Signature | Returns | Description |
|---|---|---|
| [`install(InstallerContext)`](#install-installercontext) | `boolean` | This method is called by the framework to perform the action during installation. |
| [`rollback(InstallerContext)`](#rollback-installercontext) | `void` | This method is called by the framework to perform a rollback of the `install` method. |
| [`isRollbackSupported()`](#isrollbacksupported) | `boolean` | This method is called by the framework to determine if the action supports a rollback. |

### install(InstallerContext)

```java
boolean install(InstallerContext context) throws UserCanceledException
```

This method is called by the framework to perform the action during installation.
You can use the `ProgressInterface` available from `context.getProgressInterface()`
in order to display messages to the user or ask simple questions.
For long-running actions, make sure to check `context.isCancelling()` frequently to comply
with a cancel request from the user.


**Parameters:**

- `context` — the context of the installation.

**Returns:** should return `true` if successful. If it returns `false`, the error message and the
failure strategy for the action configured in the install4j GUI will be used by the installer.

**Throws:**

- `UserCanceledException` — thrown, for example, by file installation methods. You can let
these exceptions pass through, they will be handled by the framework.

### rollback(InstallerContext)

```java
void rollback(InstallerContext context)
```

This method is called by the framework to perform a rollback of the `install` method.
This method is only called if the `install` method has already been
called and the installation is canceled by the user or if the installation fails. If this action is executed
before a rollback barrier that has already been passed successfully, the rollback will not be performed for this action.
The "Installation screen" is the only default rollback barrier in install4j.


**Parameters:**

- `context` — the context of the installation.

### isRollbackSupported()

```java
boolean isRollbackSupported()
```

This method is called by the framework to determine if the action supports a rollback.


**Returns:** `true` if a rollback is supported.

