This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Use case: JUnitLibraryDownloader wants download and install JUnit NBM if missing (or enable it if install but disabled). In current state, it needs to do searching these NBM, communicate possible network problems, possible missing NBMs on which depends on itself etc., even though PM has such capability to take care of it and made UI API simpler.
FYI: There is http://hg.netbeans.org/main-golden/file/a20754ec222a/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/ConfigurationPanel.java where you can pass in the set of codenamebases and a Callable<JComponent> to create the real UI when the modules are enabled. The system checks whether the modules are enabled/disabled/needed to be downloaded. Handles all the necessary actions inside of the single JPanel and at the end replaces its own UI with the one returned by the Callable<JComponent>. Having something like this in generic API would help unify most of the UI that deals with turning on modules.
two more usecases where we already do download on demand and try to emulate the PluginManger: - bundled subversion client for win32 (download on first try to use svn on win) - jira modules (download on first try to setup a jira connection) see also #170450
Created attachment 131056 [details] patch There are other candidates like code.analysis and possibly dlight.terminal in future. I'm attaching a patch based on Honza Lahoda's work. Jirko can you check that and go through api review?
Created attachment 131058 [details] patch Attaching a patch with a sample usage.
(In reply to comment #3) > Created attachment 131056 [details] > patch > > There are other candidates like code.analysis and possibly dlight.terminal in > future. > > I'm attaching a patch based on Honza Lahoda's work. > > Jirko can you check that and go through api review? Yes, I will do. Thanks for the patch
First, I applaud to this effort, thank you. A correction though: I cannot take the credit for the ModuleInstallerSupport - vast majority of it is by Jesse, and I copied it to code.analysis from junit/src/org/netbeans/modules/junit/JUnitLibraryDownloader.java making just some small adjustments. Looking at the junit version might be a good idea, to see if the generic support could be enhanced to cover the junit usecase as well. (There is one more copy in the FindBugs module, but I can easily take care of that one.) On code level, this: } else { must be added between: LOG.fine("try again searching"); RP.post(this); and: assert false : "Unknown " + answer;
Created attachment 131079 [details] updated patch Handles JUnit & FindBugs as well. The return value is Object representing the option selected in error dialog or null. I guess this could be wrapped somehow, but I'm not sure it would be useful anyhow.
Please review.
Thanks for the patch. JR01: The API has to allow to install a collection of modules instead of single one. At lease JUnit library consists from two modules so I don't make any sense to install them one by one (showing UI twice).
(In reply to comment #9) > Thanks for the patch. > > JR01: The API has to allow to install a collection of modules instead of single > one. At lease JUnit library consists from two modules so I don't make any sense > to install them one by one (showing UI twice). Is that a current state? I adapted JUnit as well - it is downloading one module at a time afaik. Otherwise support for multiple modules might be useful.
(In reply to comment #10) > (In reply to comment #9) > > Thanks for the patch. > > > > JR01: The API has to allow to install a collection of modules instead of single > > one. At lease JUnit library consists from two modules so I don't make any sense > > to install them one by one (showing UI twice). > Is that a current state? I adapted JUnit as well - it is downloading one module No, it is't. See au.pluginimporter/JUnitLibraryInstaller.install() { ... // find both findModules(JUNIT_LIB, JUNIT_MODULE); // install them together ... } > at a time afaik. Otherwise support for multiple modules might be useful.
(In reply to comment #11) > (In reply to comment #10) > > (In reply to comment #9) > > > Thanks for the patch. > > > > > > JR01: The API has to allow to install a collection of modules instead of single > > > one. At lease JUnit library consists from two modules so I don't make any sense > > > to install them one by one (showing UI twice). > > Is that a current state? I adapted JUnit as well - it is downloading one module > No, it is't. See au.pluginimporter/JUnitLibraryInstaller.install() { > ... > // find both > findModules(JUNIT_LIB, JUNIT_MODULE); > // install them together > ... > } > > at a time afaik. Otherwise support for multiple modules might be useful. I don't want to argue - just to clarify things. Is the code used somewhere? @ServiceProvider(service = Runnable.class, path = "WarmUp") in InstallLibraryTask is commented out. I didn't find any other reference to JUnitLibraryInstaller or InstallLibraryTask. The junit/src/org/netbeans/modules/junit/JUnitLibraryDownloader.java (LibraryDefiner) is invoked when needed. Which I thing is the right approach. Install a module when it is really going to be used. This is the class I changed to use the new API.
(In reply to comment #12) > (In reply to comment #11) > > (In reply to comment #10) > > > (In reply to comment #9) > > > > Thanks for the patch. > > > > > > > > JR01: The API has to allow to install a collection of modules instead of single > > > > one. At lease JUnit library consists from two modules so I don't make any sense > > > > to install them one by one (showing UI twice). > > > Is that a current state? I adapted JUnit as well - it is downloading one module > > No, it is't. See au.pluginimporter/JUnitLibraryInstaller.install() { > > ... > > // find both > > findModules(JUNIT_LIB, JUNIT_MODULE); > > // install them together > > ... > > } > > > at a time afaik. Otherwise support for multiple modules might be useful. > I don't want to argue - just to clarify things. > > Is the code used somewhere? @ServiceProvider(service = Runnable.class, path = No, it's a dead code actually (was replaced by installing JUnit in install time since 7.3). I'm going to remove it. It just shows a case when would install more modules together helped if we should return back to install the JUnit while start-up. > "WarmUp") in InstallLibraryTask is commented out. I didn't find any other > reference to JUnitLibraryInstaller or InstallLibraryTask. > > The junit/src/org/netbeans/modules/junit/JUnitLibraryDownloader.java > (LibraryDefiner) is invoked when needed. Which I thing is the right approach. > Install a module when it is really going to be used. This is the class I > changed to use the new API.
(In reply to comment #13) > > Is the code used somewhere? @ServiceProvider(service = Runnable.class, path = > No, it's a dead code actually (was replaced by installing JUnit in install time > since 7.3). I'm going to remove it. It just shows a case when would install > more modules together helped if we should return back to install the JUnit > while start-up. > Ok, I'll try to update the patch to provide such option. I'm just not sure whether to publish it in API unless there is a client.
Created attachment 131167 [details] updated patch Re JR01: This patch provides a method installing multiple plugins at once.
(In reply to comment #14) > (In reply to comment #13) > > > Is the code used somewhere? @ServiceProvider(service = Runnable.class, path = > > No, it's a dead code actually (was replaced by installing JUnit in install time > > since 7.3). I'm going to remove it. It just shows a case when would install > > more modules together helped if we should return back to install the JUnit > > while start-up. > > > Ok, I'll try to update the patch to provide such option. I'm just not sure > whether to publish it in API unless there is a client. code.analysis could be such a client - it generally may need to install more than one module. But this situation does not occur currently, AFAIK.
(In reply to comment #15) > Created attachment 131167 [details] > updated patch > > Re JR01: This patch provides a method installing multiple plugins at once. Thanks. It looks good for me now.
Thanks for the review. I'll integrate the change tomorrow.
Fixed in web-main 35ee4100701e.
Integrated into 'main-golden', will be available in build *201302131522* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/35ee4100701e User: Petr Hejl <phejl@netbeans.org> Log: #196538 - Extend UI API for PM.openInstallWizard(String... codeNameBase)