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.

Bug 196538 - Extend UI API for PM.openInstallWizard(String... codeNameBase)
Summary: Extend UI API for PM.openInstallWizard(String... codeNameBase)
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Autoupdate (show other bugs)
Version: 7.0
Hardware: All All
: P3 normal (vote)
Assignee: Petr Hejl
URL:
Keywords: API, API_REVIEW_FAST, PLAN
Depends on:
Blocks: 203581
  Show dependency tree
 
Reported: 2011-03-10 10:25 UTC by Jiri Rechtacek
Modified: 2013-11-06 08:35 UTC (History)
6 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
patch (22.34 KB, patch)
2013-02-06 11:35 UTC, Petr Hejl
Details | Diff
patch (41.07 KB, patch)
2013-02-06 11:53 UTC, Petr Hejl
Details | Diff
updated patch (79.61 KB, patch)
2013-02-06 22:38 UTC, Petr Hejl
Details | Diff
updated patch (84.67 KB, patch)
2013-02-08 17:24 UTC, Petr Hejl
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Rechtacek 2011-03-10 10:25:23 UTC
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.
Comment 1 Jaroslav Tulach 2011-03-10 13:08:00 UTC
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.
Comment 2 Tomas Stupka 2011-05-27 11:19:43 UTC
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
Comment 3 Petr Hejl 2013-02-06 11:35:13 UTC
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?
Comment 4 Petr Hejl 2013-02-06 11:53:32 UTC
Created attachment 131058 [details]
patch

Attaching a patch with a sample usage.
Comment 5 Jiri Rechtacek 2013-02-06 11:58:42 UTC
(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
Comment 6 Jan Lahoda 2013-02-06 14:56:13 UTC
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;
Comment 7 Petr Hejl 2013-02-06 22:38:27 UTC
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.
Comment 8 Petr Hejl 2013-02-06 22:40:27 UTC
Please review.
Comment 9 Jiri Rechtacek 2013-02-08 11:17:25 UTC
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).
Comment 10 Petr Hejl 2013-02-08 11:27:29 UTC
(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.
Comment 11 Jiri Rechtacek 2013-02-08 11:35:04 UTC
(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.
Comment 12 Petr Hejl 2013-02-08 12:04:08 UTC
(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.
Comment 13 Jiri Rechtacek 2013-02-08 13:53:07 UTC
(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.
Comment 14 Petr Hejl 2013-02-08 14:34:34 UTC
(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.
Comment 15 Petr Hejl 2013-02-08 17:24:09 UTC
Created attachment 131167 [details]
updated patch

Re JR01: This patch provides a method installing multiple plugins at once.
Comment 16 Jan Lahoda 2013-02-08 20:01:47 UTC
(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.
Comment 17 Jiri Rechtacek 2013-02-11 12:23:18 UTC
(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.
Comment 18 Petr Hejl 2013-02-12 09:36:33 UTC
Thanks for the review. I'll integrate the change tomorrow.
Comment 19 Petr Hejl 2013-02-13 10:24:40 UTC
Fixed in web-main 35ee4100701e.
Comment 20 Quality Engineering 2013-02-13 18:03:10 UTC
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)