The projectOpened() and projectClosed() methods of
org.netbeans.spi.project.ui.ProjectOpenedHook should be made public. I need to
write a LookupMerger for ProjectOpenedHook and for that I must be able to call
May be too late to push such an API change thru DevRev, I don't know. We are
long after feature freeze.
I agree, I don't want to push it for 4.1. Promo-F should be enough.
Actually we can't make those methods public since existing subclasses overriding
as protected would be broken. (In sources, not I think in binaries.) Would need
some new helper methods or something.
Maybe we could add
public static void notifyProjectOpened(POH poh);
public static void notifyProjectClosed(POH poh);
to ProjectOpenedHook? Not very nice, but would probably suffice?
Another idea: what if the ant/freeform defined a new interface/abstract class
FreeformProjectOpenedHook, which would be implemented by the natures in place of
ProjectOpenedHook? The freeform project would then define the ProjectOpenHook
and do callbacks into FreeformProjectOpenedHook(s).
While your solution would work and would solve this concrete problem (in the
freeform), it would be just a not very nice workaround around a bug in
project/uiapi. I think the bug should be solved, otherwise sometimes in the
future we will face it again.
OTOH this solution allows the freeform nature to be notified when the project is
opened or closed, which is exactly what I need. From this point of view I'm
perfectly happy with it.
Currently, there is only one known client of the notifyOpened, notifyClosed API,
so it seems to me like a bit overkill to introduce such API.
Jesse, what do you think about it?
No strong opinion; either way could work. We need to add an API *somehow*
anyway, since even to add to the freeform SPI is an API change (though not as
There is another option: the projectOpened and projectClosed callbacks can be
called on all ProjectOpenedHook(s) found in the project's lookup, not only on
the first one. Although this is an incompatible change, I think it is the best
way to solve this problem.
I am attaching diff that makes this change. If there are no objects, I will pass
it to api review.
Created attachment 21978 [details]
Probably OK; send to apireviews.
One note in apichanges: <compatibility> should contain nested text explaining
what the incompatibility is, when you would be affected, and what you can do
Created attachment 21979 [details]
Improved patch with corrected api changes.
I would like to ask for API review of the following change: Currently, if a
project is being opened/closed, method projectOpened/projectClosed is called on
the first instance of org.netbeans.spi.project.ui.ProjectOpenedHook found in the
project's lookup. I propose to call this method on all instances of
org.netbeans.spi.project.ui.ProjectOpenedHook found in the project's lookup.
The patch for this change is attached.
If there are no objections, I will commit the change tomorrow.
Checking in projectui/src/org/netbeans/modules/project/ui/OpenProjectList.java;
new revision: 1.32; previous revision: 1.31
new revision: 1.4; previous revision: 1.3
Checking in projectuiapi/apichanges.xml;
/cvs/projects/projectuiapi/apichanges.xml,v <-- apichanges.xml
new revision: 1.8; previous revision: 1.7
Checking in projectuiapi/src/org/netbeans/spi/project/ui/ProjectOpenedHook.java;
new revision: 1.5; previous revision: 1.4