public final class PluginManager extends Object
Modifier and Type | Method and Description |
---|---|
static Object |
install(Set<String> codenamebases,
Object... alternativeOptions)
Open standard dialog for installing modules including declared dependencies.
|
static Object |
installSingle(String codenamebase,
String displayName,
Object... alternativeOptions)
Open standard dialog for installing a module including declared dependencies.
|
static boolean |
openInstallWizard(OperationContainer<InstallSupport> container)
Open standard dialog for installing set of modules.
|
static void |
openInstallWizard(OperationContainer<InstallSupport> container,
boolean runInBackground)
Open standard dialog for installing set of modules.
|
public static boolean openInstallWizard(OperationContainer<InstallSupport> container)
Single module installation can be handled easily by
PluginManager.installSingle(java.lang.String, java.lang.String, java.lang.Object[])
.
OperationContainer
<InstallSupport> container = OperationContainer.createForInstall();
for (UpdateUnit
u : UpdateManager.getDefault().getUpdateUnits(UpdateManager.TYPE.MODULE)
) {
if (u.getCodeName().matches("org.my.favorite.module")) {
if (u.getAvailableUpdates().isEmpty()) {
continue;
}
container.add(u.getAvailableUpdates().get(0));
}
}
PluginManager.openInstallWizard(container);
container
- the container with list of modules for installPluginManager.installSingle(java.lang.String, java.lang.String, java.lang.Object[])
,
PluginManager.install(java.util.Set, java.lang.Object[])
public static void openInstallWizard(OperationContainer<InstallSupport> container, boolean runInBackground)
container
- the container with list of modules for installrunInBackground
- if true
then installation run in the background after license acceptance@CheckForNull public static Object installSingle(@NonNull String codenamebase, @NonNull String displayName, @NonNull Object... alternativeOptions)
codenamebase
- the codenamebase of module to installdisplayName
- the display name of the modulealternativeOptions
- alternative options possibly displayed in error
dialog user may choose if it is not possible to install the plugin;
if chosen the option is return value of this methodnull
if the module has been successfully installed
and/or activated, otherwise it returns the options user has
selected in problem dialog, typically NotifyDescriptor.DEFAULT_OPTION
(on esc), NotifyDescriptor.CANCEL_OPTION
or
any of alternativeOptions
.PluginManager.install(java.util.Set, java.lang.Object[])
@CheckForNull public static Object install(@NonNull Set<String> codenamebases, @NonNull Object... alternativeOptions)
Although the method is not deprecated, modules that only uses PluginManager.install to
install additional plugins should now depend on autoupdate.services
directly,
and use PluginInstaller.install(java.lang.String, java.lang.String, org.openide.util.Lookup, java.lang.Object...)
to reduce UI dependencies.
codenamebases
- the codenamebases of modules to install; must contain at least
one codenamebasealternativeOptions
- alternative options possibly displayed in error
dialog user may choose if it is not possible to install the plugin;
if chosen the option is return value of this methodnull
if all the requested modules have been successfully
installed and/or activated, otherwise it returns the options user has
selected in problem dialog, typically NotifyDescriptor.DEFAULT_OPTION
(on esc), NotifyDescriptor.CANCEL_OPTION
or
any of alternativeOptions
.IllegalArgumentException
- if the codenamebases
is empty