Bug 57025 - projectOpened/projectClosed methods should be called on all instances of ProjectOpenedHook
projectOpened/projectClosed methods should be called on all instances of Proj...
Status: RESOLVED FIXED
Product: projects
Classification: Unclassified
Component: Generic Projects UI
4.x
All All
: P3 (vote)
: 5.x
Assigned To: apireviews
issues@projects
: API, API_REVIEW_FAST
Depends on:
Blocks: 51880
  Show dependency treegraph
 
Reported: 2005-03-25 18:40 UTC by Andrei Badea
Modified: 2005-09-05 10:10 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments
Proposed change. (6.47 KB, patch)
2005-05-04 15:47 UTC, Jan Lahoda
Details | Diff
Improved patch with corrected api changes. (6.86 KB, patch)
2005-05-04 16:14 UTC, Jan Lahoda
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrei Badea 2005-03-25 18:40:37 UTC
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
these methods.
Comment 1 Jesse Glick 2005-03-28 18:49:03 UTC
May be too late to push such an API change thru DevRev, I don't know. We are
long after feature freeze.
Comment 2 Andrei Badea 2005-03-28 21:03:47 UTC
I agree, I don't want to push it for 4.1. Promo-F should be enough.
Comment 3 Jesse Glick 2005-04-05 23:59:03 UTC
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.
Comment 4 Andrei Badea 2005-04-07 08:34:31 UTC
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?
Comment 5 Jan Lahoda 2005-04-26 16:15:53 UTC
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).
Comment 6 Andrei Badea 2005-04-26 16:42:12 UTC
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.
Comment 7 Jan Lahoda 2005-04-26 17:04:02 UTC
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?
Comment 8 Jesse Glick 2005-04-27 17:28:06 UTC
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
central).
Comment 9 Jan Lahoda 2005-05-04 15:45:35 UTC
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.
Comment 10 Jan Lahoda 2005-05-04 15:47:03 UTC
Created attachment 21978 [details]
Proposed change.
Comment 11 Jesse Glick 2005-05-04 15:57:05 UTC
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
instead.
Comment 12 Jan Lahoda 2005-05-04 16:14:34 UTC
Created attachment 21979 [details]
Improved patch with corrected api changes.
Comment 13 Jan Lahoda 2005-05-04 16:30:41 UTC
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.
Comment 14 Jan Lahoda 2005-05-04 23:21:33 UTC
Adjusting summary.
Comment 15 Jan Lahoda 2005-05-11 11:37:28 UTC
If there are no objections, I will commit the change tomorrow.
Comment 16 Jan Lahoda 2005-05-12 10:00:51 UTC
Implemented:
Checking in projectui/src/org/netbeans/modules/project/ui/OpenProjectList.java;
/cvs/projects/projectui/src/org/netbeans/modules/project/ui/OpenProjectList.java,v
 <--  OpenProjectList.java
new revision: 1.32; previous revision: 1.31
done
Checking in
projectui/test/unit/src/org/netbeans/modules/project/ui/OpenProjectListTest.java;
/cvs/projects/projectui/test/unit/src/org/netbeans/modules/project/ui/OpenProjectListTest.java,v
 <--  OpenProjectListTest.java
new revision: 1.4; previous revision: 1.3
done
Checking in projectuiapi/apichanges.xml;
/cvs/projects/projectuiapi/apichanges.xml,v  <--  apichanges.xml
new revision: 1.8; previous revision: 1.7
done
Checking in projectuiapi/src/org/netbeans/spi/project/ui/ProjectOpenedHook.java;
/cvs/projects/projectuiapi/src/org/netbeans/spi/project/ui/ProjectOpenedHook.java,v
 <--  ProjectOpenedHook.java
new revision: 1.5; previous revision: 1.4
done


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