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.
project.xpath.pom.xml=project/packaging[text()='nbm' or text()='nbm-application']
which is not working?
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.
Created attachment 113806 [details]
PROPERTY_WILL_OPEN_PROJECTS and its use in ergonomics
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.
I confirm this patch works with JavaFX and resolves issue #205558.
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).
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).
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.
(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.
> 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.
(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.
(In reply to comment #1)
> ide.ergonomics/apisupport.properties has
> project.xpath.pom.xml=project/packaging[text()='nbm' or
> 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.
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).
(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?
Yes, it does and this will be strange for user.
The Broken Reference Dialog appears and everything in it is fixed. :-)
So it should close itself then...?
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.
Created attachment 113915 [details]
Properly documented friend contract between projectuiapi and ide.ergonomics
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).
Will integrate on Jan 1, 2012 including magical string documented in arch.xml and in a test.
Revert no-op change to OpenProjectListTest.java.
Integrated into 'main-golden'
User: Jaroslav Tulach <email@example.com>
Log: #203220: Special contract between projectui and ide.ergonomics, so the right modules are opened sooner than ProjectOpenedHook is called.
*** Bug 205558 has been marked as a duplicate of this bug. ***
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
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.