public final class PluginInstaller extends Object
autoupdate.ui
is installed. If no providers are registered, the installation fails as if
the user had rejected the operation using "Cancel" button.Constructor and Description |
---|
PluginInstaller() |
Modifier and Type | Method and Description |
---|---|
static PluginInstaller |
getDefault() |
Object |
install(Set<String> codenamebases,
String displayName,
Lookup context,
Object... alternativeOptions)
Attempts to install one or more plugins, specified by their codebases.
|
Object |
install(String codenamebase)
Installs a single module.
|
Object |
install(String codenamebase,
String displayName,
Lookup context,
Object... alternativeOptions)
Installs a single module.
|
public static PluginInstaller getDefault()
public Object install(@NonNull String codenamebase, @NonNull String displayName, Lookup context, @NonNull Object... alternativeOptions)
null
to use a generic description possibly based on the module name/codename. The method converts the UserCancelException
thrown by the actual implementation into NotifyDescriptor.CANCEL_OPTION
for compatibility with older code.
Otherwise, see PluginInstaller.install(java.lang.String, java.lang.String, org.openide.util.Lookup, java.lang.Object...)
.codenamebase
- codename base to installdisplayName
- title/heading for messagescontext
- additional context passed to the processalternativeOptions
- possible failure resolution choicesNotifyDescriptor.CANCEL_OPTION
if the operation is rejected (i.e. user cancel) or one of
"alternativeOptions".public Object install(@NonNull String codenamebase)
UserCancelException
thrown by the actual implementation into NotifyDescriptor.CANCEL_OPTION
for compatibility with older code.
Otherwise, see PluginInstaller.install(java.lang.String, java.lang.String, org.openide.util.Lookup, java.lang.Object...)
.codenamebase
- codename base of the module to installNotifyDescriptor.CANCEL_OPTION
if the operation is rejected (i.e. user cancel).public Object install(@NonNull Set<String> codenamebases, String displayName, Lookup context, Object... alternativeOptions) throws OperationException, UserCancelException
If fetching the plugin catalog data fails on I/O, the user can get a choice to
retry the process or cancel the operation. `alternativeOptions` are presented as other alternative solutions. If the user
chooses to cancel, operation ends with NotifyDescriptor.CANCEL_OPTION
. The user can choose to retry the operation.
The user can also select one of the `alternativeOptions`, which will terminate the operation with the chosen option as a result.
During the download, the operation can be cancelled resulting in NotifyDescriptor.CANCEL_OPTION
.
If the operation completes successfully, the method returns null
.
In the case that no installation provider is installed, the implementation throws UserCancelException
as if the operation
was rejected by the user.
codenamebases
- codename bases of modules to install. The modules will be installed in no particular order.displayName
- alternativeOptions
- null
on success. NotifyDescriptor.CANCEL_OPTION
on cancel, or one of `alternativeOptions` on failure
according to user's choice.OperationException
- if the download or installation / enable operation fails.UserCancelException
- if the operation is rejected.