Bug 203220 - Opening Maven NBM w/ ergonomics claims apisupport not installed when merely disabled
Opening Maven NBM w/ ergonomics claims apisupport not installed when merely d...
Status: VERIFIED FIXED
Product: projects
Classification: Unclassified
Component: Generic Projects UI
7.0.1
All All
: P3 (vote)
: 7.2
Assigned To: Jaroslav Tulach
issues@projects
: API_REVIEW_FAST, ERGONOMICS
: 205558 (view as bug list)
Depends on:
Blocks: 160739 205558
  Show dependency treegraph
 
Reported: 2011-10-06 11:44 UTC by _ wadechandler
Modified: 2012-02-08 07:49 UTC (History)
7 users (show)

See Also:
Issue Type: DEFECT
:


Attachments
PROPERTY_WILL_OPEN_PROJECTS and its use in ergonomics (5.11 KB, patch)
2011-12-05 08:23 UTC, Jaroslav Tulach
Details | Diff
Properly documented friend contract between projectuiapi and ide.ergonomics (12.00 KB, patch)
2011-12-07 10:21 UTC, Jaroslav Tulach
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description _ wadechandler 2011-10-06 11:44:10 UTC
Fresh install with features disabled and opening maven rcp project has a resolve issues message about rcp support not being installed when it just needs activated.

To reproduce, have a fresh user directory with features disabled. Open an existing nb rcp maven project. There will be an issue on the project which shows up in the show and resolve issues dialog stating the nb rcp support is not available and that the common cause is it is not installed. To get this enabled one must go to the start page and click to activate features. Then enabled netbeans development. Next, the projects must be reloaded.
Comment 1 Jesse Glick 2011-10-24 16:58:38 UTC
ide.ergonomics/apisupport.properties has

project.xpath.pom.xml=project/packaging[text()='nbm' or text()='nbm-application']

which is not working?
Comment 2 Jaroslav Tulach 2011-12-05 07:52:52 UTC
This may be caused by to late enablement of necessary modules. Possibly Java cluster is already enabled, one would like to enable JavaFX or apisupport cluster, which ergonomics do, but only when the project are already opened. Need some sort of pre-notification from the openProject infrastructure that a project will be opened, before it really is.

public static final String PROPERTY_WILL_OPEN_PROJECTS;

in OpenProjects might be enough.
Comment 3 Jaroslav Tulach 2011-12-05 08:23:50 UTC
Created attachment 113806 [details]
PROPERTY_WILL_OPEN_PROJECTS and its use in ergonomics
Comment 4 Jaroslav Tulach 2011-12-05 08:25:45 UTC
The implementation seems to work fine (Anton please verify on your JavaFX case).

Jesse, if you are OK with the API in projectuiapi, I can finish the patch. Otherwise please design other way to let ergonomics know that a project will be opened.

I'd like to fix this for 7.2, making P2.
Comment 5 Anton Chechel 2011-12-05 13:20:21 UTC
I confirm this patch works with JavaFX and resolves issue #205558.
Comment 6 Jesse Glick 2011-12-05 14:17:31 UTC
Could likely work around ergonomics behavior in maven module by having it listen to enabled modules and clear its problem report if and when maven.apisupport appears. In fact it seems to already do this for maven.j2ee, but for some reason not maven.apisupport. I do not understand bug #205558 well enough to say whether a general fix is needed or not.


[JG01] Remove PROPERTY_WILL_OPEN_PROJECTS from the public API. It makes no sense to anything except ergonomics. FeatureProjectFactory can either hardcode the property name or get a direct dep on projectui (which has a friend package).
Comment 7 Jesse Glick 2011-12-05 15:50:41 UTC
BTW this is not a P2 DEFECT. There is an inappropriate badge on some projects, during first usage only, which is resolvable just by reloading the project (incl. editing its POM).
Comment 8 Anton Chechel 2011-12-05 16:06:58 UTC
The problem described in bug #205558 is that ProjectOpenedHook is not invoked by ergonomics during opening project with not yet enabled javafx feature but enabled javase before.
Comment 9 Jesse Glick 2011-12-05 16:17:03 UTC
(In reply to comment #8)
> The problem described in bug #205558 is that ProjectOpenedHook is not invoked
> by ergonomics during opening project with not yet enabled javafx feature but
> enabled javase before.

But this would also be true without ergonomics if you just enabled the FX feature manually, right? It seems that some code in FX (broken references?) should be listening to module enablement and is not.

More generally, the issue may just be that the project infrastructure does not currently listen for changes in the set of ProjectOpenedHook's registered on an open project. You could argue that if a POH is inserted dynamically into an open project's lookup, projectOpened should be called at once. (Conversely, if removed from an open project's lookup, projectClosed should be called; this could not currently happen in the IDE, which does not permit live module disablement.) I am not sure whether such behavior would be desirable in general, but it has a certain logical consistency.
Comment 10 Anton Chechel 2011-12-05 16:29:47 UTC
> But this would also be true without ergonomics if you just enabled the FX
> feature manually, right? It seems that some code in FX (broken references?)
No, if you enable javafx manually and then open existing javafx project (or create new one) then Default JavaFX Platform will be automatically created and there will be no problem with broken reference.

> should be listening to module enablement and is not.
We were thinking with Tomas about this solution but that would be big performance impact and performance team would not allow this probably. Moreover that would not work properly from UI point of view: after creating default javaf platform the broken reference dialog would appear anyway because broken reference check is performed in different thread during project opening.
Comment 11 Jesse Glick 2011-12-05 16:44:52 UTC
(In reply to comment #10)
> if you enable javafx manually and then open existing javafx project

No, I was asking about the reverse. With no ergonomics cluster around, you open an existing FX project, then you enable the FX feature. I am guessing that the same bug appears, right? I.e. the B.R. notification fails to be cleared even though there is now a valid FX platform?

>> should be listening to module enablement
>
> that would be big performance impact

What is the performance impact specifically?

> after creating default
> javafx platform the broken reference dialog would appear anyway because broken
> reference check is performed in different thread during project opening.

Possibly a bug in the B.R. dialog/infrastructure, but I am not sure what fixes its API really permits.

I am not necessarily opposed to hacking ergonomics along the lines of the proposed patch (minus public API change as in JG01); but I am trying to explore what the root cause of the problems is, especially as the similar bug #160739 was solved locally in the maven module in the past.
Comment 12 _ wadechandler 2011-12-05 18:14:49 UTC
(In reply to comment #1)
> ide.ergonomics/apisupport.properties has
> 
> project.xpath.pom.xml=project/packaging[text()='nbm' or
> text()='nbm-application']
> 
> which is not working?

Sorry Jesse. I missed the comment. I think it was both. I had an application project with many nbm projects. They all seemed to have issues. I would need to move off my user directory to verify, and I can if you still need to know unless Jarda's logic addresses this exact issue already. Thanks.
Comment 13 Tomas Zezula 2011-12-05 19:17:40 UTC
In Jesse's case (opposite order) it cannot work as the project is already opened.

The presence of ModuleInstall is the performance problem. The ModuleInstall needs to lookup JavaPlatforms and if there is no JFX default platform it needs to create one (in background thread).
But there is the difference among ergonomics and module installation. When you open JFX project you get the broken reference dialog (you expect it) and when you install JFX the MI fixes it. But when ergonomics activates the JFX both these actions are done together and there is a race which causes that the broken ref dialog is shown even there is no broken ref (the platform was created in the background).
Comment 14 Jesse Glick 2011-12-05 19:27:37 UTC
(In reply to comment #12)
> (In reply to comment #1)
> Sorry Jesse. I missed the comment.

My comment was directed at assignee, not reporter.

(In reply to comment #13)
> there is a race which causes that the
> broken ref dialog is shown even there is no broken ref (the platform was
> created in the background).

This just sounds like a bug in the broken references support to me - if some code creates an FX platform then that should trigger a refresh of the broken reference list, right?
Comment 15 Tomas Zezula 2011-12-05 19:35:06 UTC
Yes, it does and this will be strange for user.
The Broken Reference Dialog appears and everything in it is fixed. :-)
Comment 16 Jesse Glick 2011-12-05 19:38:35 UTC
So it should close itself then...?
Comment 17 Jaroslav Tulach 2011-12-05 20:13:06 UTC
Thanks for your speculations guys. I will write some test, hide the public static final PROPERTY and come up with better patch. 

As far as you concern goes: if no java cluster is enabled, then FeatureProject is the owner of the project dir. When its OpenHook is called it enables all necessary modules (JavaFX, for example or just JavaSE) and lists their OpenHooks to be called then.

However if JavaSE is enabled, then no ergonomics is involved up until the time it is know that new projects are open. At that moment new modules (like JavaFX) are enabled, but OpenHooks were already called.

The fix is trivial. Just let ergonomics know in advance that some projects will be opened.
Comment 18 Jaroslav Tulach 2011-12-07 10:21:38 UTC
Created attachment 113915 [details]
Properly documented friend contract between projectuiapi and ide.ergonomics
Comment 19 Jesse Glick 2011-12-07 14:44:23 UTC
Can do JG01 via magic strings in arch.xml, though it would be easier and safer to use a regular Java constant in the friend package (org.netbeans.modules.project.ui.api).
Comment 20 Jaroslav Tulach 2011-12-25 15:37:42 UTC
Will integrate on Jan 1, 2012 including magical string documented in arch.xml and in a test.
Comment 21 Jesse Glick 2011-12-27 18:14:16 UTC
Revert no-op change to OpenProjectListTest.java.
Comment 22 Jaroslav Tulach 2011-12-29 15:59:54 UTC
ergonomics#450dbb91ce98
Comment 23 Quality Engineering 2012-01-01 15:57:32 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/450dbb91ce98
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #203220: Special contract between projectui and ide.ergonomics, so the right modules are opened sooner than ProjectOpenedHook is called.
Comment 24 Anton Chechel 2012-01-20 13:18:27 UTC
*** Bug 205558 has been marked as a duplicate of this bug. ***
Comment 25 Tomas Danek 2012-01-31 13:24:40 UTC
works fine now, i was able to open existing Mvn NB Platform app without any problem (IDE /w ergonomics and fresh userdir).

Product Version: NetBeans IDE Dev (Build 201201260600)
Java: 1.6.0_29; Java HotSpot(TM) 64-Bit Server VM 20.4-b02-402
System: Mac OS X version 10.7.2 running on x86_64; MacRoman; en_US (nb)
User directory: /Users/tomas/.netbeans/dev
Cache directory: /Users/tomas/.netbeans/dev/var/cache
Comment 26 Jaroslav Tulach 2012-02-08 07:49:04 UTC
I've made the bug P1 just to know I should work on it. Otherwise I don't think this is a candidate for backport. It is a minor issue and requires API changes in project UI APIs.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo