use of org.netbeans.modules.autoupdate.ui.ModuleInstallerSupport in project netbeans-rcp-lite by outersky.
the class PluginManager method install.
/**
* Open standard dialog for installing modules including declared dependencies.
* Shows it to the user, asks for confirmation, license acceptance, etc.
* The whole operation requires AWT dispatch thread access (to show the dialog)
* and blocks (until the user clicks through), so either call from AWT dispatch
* thread directly, or be sure you hold no locks and block no progress of other
* threads to avoid deadlocks.
*
* @param codenamebases the codenamebases of modules to install; must contain at least
* one codenamebase
* @param alternativeOptions 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 method
* @return <code>null</code> if all the requested modules have been successfully
* installed and/or activated, otherwise it returns the options user has
* selected in problem dialog, typically {@link NotifyDescriptor#DEFAULT_OPTION}
* (on esc), {@link NotifyDescriptor#CANCEL_OPTION} or
* any of <code>alternativeOptions</code>.
* @throws IllegalArgumentException if the <code>codenamebases</code> is empty
* @since 1.35
*/
@CheckForNull
public static Object install(@NonNull Set<String> codenamebases, @NonNull Object... alternativeOptions) {
Parameters.notNull("cnb", codenamebases);
Parameters.notNull("alternativeOptions", alternativeOptions);
if (codenamebases.isEmpty()) {
throw new IllegalArgumentException("No plugins to install");
}
try {
return new ModuleInstallerSupport(alternativeOptions).installPlugins(null, codenamebases);
} catch (OperationException ex) {
Logger.getLogger(PluginManager.class.getName()).log(Level.WARNING, null, ex);
}
return NotifyDescriptor.DEFAULT_OPTION;
}
use of org.netbeans.modules.autoupdate.ui.ModuleInstallerSupport in project netbeans-rcp-lite by outersky.
the class PluginManager method installSingle.
/**
* Open standard dialog for installing a module including declared dependencies.
* Shows it to the user, asks for confirmation, license acceptance, etc.
* The whole operation requires AWT dispatch thread access (to show the dialog)
* and blocks (until the user clicks through), so either call from AWT dispatch
* thread directly, or be sure you hold no locks and block no progress of other
* threads to avoid deadlocks.
*
* @param codenamebase the codenamebase of module to install
* @param displayName the display name of the module
* @param alternativeOptions 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 method
* @return <code>null</code> if the module has been successfully installed
* and/or activated, otherwise it returns the options user has
* selected in problem dialog, typically {@link NotifyDescriptor#DEFAULT_OPTION}
* (on esc), {@link NotifyDescriptor#CANCEL_OPTION} or
* any of <code>alternativeOptions</code>.
* @since 1.35
* @see #install(java.util.Set, java.lang.Object[])
*/
@CheckForNull
public static Object installSingle(@NonNull String codenamebase, @NonNull String displayName, @NonNull Object... alternativeOptions) {
Parameters.notNull("cnb", codenamebase);
Parameters.notNull("displayName", displayName);
Parameters.notNull("alternativeOptions", alternativeOptions);
try {
return new ModuleInstallerSupport(alternativeOptions).installPlugins(displayName, Collections.singleton(codenamebase));
} catch (OperationException ex) {
Logger.getLogger(PluginManager.class.getName()).log(Level.WARNING, null, ex);
}
return NotifyDescriptor.DEFAULT_OPTION;
}
Aggregations