InstallerContext (install4j API)
Keywords: com.install4j.api.InstallerContext interface

Overview | Package | Class | Tree | Deprecated | Index | Help
| install4j API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.install4j.api
Interface InstallerContext

All Superinterfaces:
  Context

All Known Subinterfaces:
  InstallerWizardContext

    public interface InstallerContext

extends Context

The extended context provided during installation. This context provides access to information about all installation parameters, as well as the methods for file installation.

Author:
  ej-technologies GmbH

Method Summary
`void` | `abort()` Deprecated. return `false` in a custom action in order to perform a rollback and close the installer.
`java.util.Collection` | `getCustomTasks()` Returns all custom tasks for this installer.
`java.util.Collection` | `getInstallationComponents()` Returns all installation components for this installer.
`java.io.File` | `getInstallerFile()` Returns the current media file.
`java.lang.String` | `getMediaName()` Get the name of the current media set.
`java.lang.String` | `getProgramGroup()` Retrieves the name of the program group selected by the user or the default program group if the user has not yet made a selection.
`java.util.Collection` | `getServiceSetups()` Returns all services that can be installed by this installation together with their installation parameters.
`boolean` | `installFile(java.io.File sourceFile, java.io.File destFile)` Installs a file.
`boolean` | `installFile(java.io.File sourceFile, java.io.File destFile, FileOptions options)` Installs a file.
`boolean` | `installFile(java.io.File sourceFile, java.io.File destFile, FileOptions options, ProgressInterface progressInterface, int fromPercent, int toPercent)` Installs a file.
`boolean` | `isCreateDesktopIcon()` Returns whether the installer will create a desktop icon.
`boolean` | `isCreateMenu()` Returns whether start menu entries should be created.
`boolean` | `isCreateMenuAllUsers()` Returns whether the start menu entries should be made for all users.
`boolean` | `isCreateQuickLaunchIcon()` Returns whether the installer will create a quick launch icon.
`void` | `registerUninstallFile(java.io.File file)` Registers a file for uninstallation.

Methods inherited from interface com.install4j.api.Context
`getAddOnApplicationId, getApplicationId, getInstallationDirectory, getUserVariableValue, isAdminUser, isUnattended, rebootAfterFinish`

Method Detail

### isCreateMenu

    boolean isCreateMenu()

  Returns whether start menu entries should be created. This method is only relevant on Microsoft Windows.

  Returns:
    `true` if start menu entries should be created

### getProgramGroup

    java.lang.String getProgramGroup()

  Retrieves the name of the program group selected by the user or the default program group if the user has not yet made a selection. This method is only relevant on Microsoft Windows.

  Returns:
    the name of the program group.

### isCreateMenuAllUsers

    boolean isCreateMenuAllUsers()

  Returns whether the start menu entries should be made for all users. This only applies to Windows NT/2000/XP.

  Returns:
    `true` if the menu entries are for all users

### getServiceSetups

    java.util.Collection getServiceSetups()

  Returns all services that can be installed by this installation together with their installation parameters.

  Returns:
    a collection containing `ServiceSetup` instances.
  See Also:
    `ServiceSetup`

### getInstallationComponents

    java.util.Collection getInstallationComponents()

  Returns all installation components for this installer. If no installation components have been defined in the install4j GUI, the returned collection will be empty. The items in the collection will be in the same order as defined in the GUI.

  Returns:
    a collection containing `InstallationComponentSetup` instances.
  See Also:
    `InstallationComponentSetup`

### getCustomTasks

    java.util.Collection getCustomTasks()

  Returns all custom tasks for this installer. Custom tasks are configured in the install4j GUI and can be selected or deselected by the user.

  Returns:
    a collection containing `CustomTaskSetup` instances.
  See Also:
    `CustomTaskSetup`

### isCreateDesktopIcon

    boolean isCreateDesktopIcon()

  Returns whether the installer will create a desktop icon. This method is only relevant on Microsoft Windows.

  Returns:
    `true` if the installer will create a desktop icon.

### isCreateQuickLaunchIcon

    boolean isCreateQuickLaunchIcon()

  Returns whether the installer will create a quick launch icon. This method is only relevant on Microsoft Windows.

  Returns:
    `true` if the installer will create a quick launch icon.

### getMediaName

    java.lang.String getMediaName()

  Get the name of the current media set.

  Returns:
    the original file name of the media set beeing installed without suffix

### installFile

    boolean installFile(java.io.File sourceFile,
                        java.io.File destFile)
                        throws UserCanceledException

  Installs a file. This is the same as calling `installFile(File, File, FileOptions)` with `new FileOptions(sourceFile.lastModified())`. The uninstaller will uninstall a file that has been installed with this method. The overwrite policy will be `FileOptions.OVERWRITE_ALWAYS_ASK`.

  Parameters:
    `sourceFile` - the file to be installed.
    `destFile` - the destination file.
  Returns:
    `true` if successful.
  Throws:
    `UserCanceledException` - if the user hits cancel on the progress screen or on an overwrite or retry dialog.

### installFile

    boolean installFile(java.io.File sourceFile,
                        java.io.File destFile,
                        FileOptions options)
                        throws UserCanceledException

  Installs a file. This is the same as calling `installFile(File, File, FileOptions, ProgressInterface)` with no `ProgressInterface` (null). The `FileOptions` parameter determines the overwrite strategy as well as whether the file will be registered for uninstallation.

  Parameters:
    `sourceFile` - the file to be installed.
    `destFile` - the destination file.
    `options` - the installation options.
  Returns:
    `true` if successful.
  Throws:
    `UserCanceledException` - if the user hits cancel on the progress screen or on an overwrite or retry dialog.

### installFile

    boolean installFile(java.io.File sourceFile,
                        java.io.File destFile,
                        FileOptions options,
                        ProgressInterface progressInterface,
                        int fromPercent,
                        int toPercent)
                        throws UserCanceledException

  Installs a file. The method will try to copy the source file to the destination file. The `FileOptions` parameter determines the overwrite strategy as well as whether the file will be registered for uninstallation. With this method, the progess bar will be updated during the installation. Use this method if you install very large files.

  Parameters:
    `sourceFile` - the file to be installed.
    `destFile` - the destination file.
    `options` - the installation options.
    `progressInterface` - the interface for displaying progress during the file installation. You should pass the interface that is passed as a parameter in the `performAction` method of your custom action.
    `fromPercent` - the start percentage value for the file installation. The progress interface will be advanced starting with this percentage value.
    `toPercent` - the end percentage value for the file installation. The progress interface will be advanced up to this percentage value.
  Returns:
    `true` if successful.
  Throws:
    `UserCanceledException` - if the user hits cancel on the progress screen or on an overwrite or retry dialog.

### registerUninstallFile

    void registerUninstallFile(java.io.File file)

  Registers a file for uninstallation.

  Parameters:
    `file` - the file that should be removed when uninstalling the application.

### getInstallerFile

    java.io.File getInstallerFile()

  Returns the current media file. On Mac OS X it returns the base directory of the installer app bundle, not the sit file.

  Returns:
    the current media file. Returns `null` if you debug the installer, since there's no installer file in that case.

### abort

    void abort()

  Deprecated. return `false` in a custom action in order to perform a rollback and close the installer.

Overview | Package | Class | Tree | Deprecated | Index | Help
| install4j API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD