Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » faceted project events
faceted project events [message #203030] Thu, 25 October 2007 00:18 Go to next message
Eclipse User
Originally posted by: first.last.oracle.com

Our FacetedProjectListener receives a PROJECT_MODIFIED event whenever a project
is closed or opened. Unfortunately, the listener does not receive any event at all
whenever a project is deleted or imported from a previously existed project.
Is there a reason for this? Does it make sense for us to request events for
those situations? If we received events for these situations it would simplify
the way we set up and tear down the things related to our "facet".

Thanks.
Brian Vosburgh
Re: faceted project events [message #203196 is a reply to message #203030] Fri, 26 October 2007 16:12 Go to previous messageGo to next message
Eclipse User
Originally posted by: kosta.bea.com

Hi Brian,

The fact that you are seeing a PROJECT_MODIFIED event on close/open is
actually a bug, which has been fixed in the 2.0.x and newer code lines.

There is an open enhancement request to provide a PROJECT_INITIALIZED
event that would cover opened/imported cases.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=198165

I haven't thought about providing events to cover the closed/deleted
case, but it may make sense to do. Please add your thoughts on this to
the above enhancement request. Note that PROJECT_INITIALIZED event will
not _exactly_ represent the open/import case. The reason is that the
event will only be generated when some code requests IFacetedProject
metadata for that project. We don't pro-actively scan for new projects
and initialize them for performance reasons. This distinction may not
matter for your situations, though.

Note that the general answer is that the faceted project events are not
meant to replace the facilities provided by the platform's resource
change listeners. Your co-worker Paul Fullbright and I had a discussion
on this scenario some months ago. He should be able to share with your
some code that uses the resource change listeners to handle this
scenario in the meantime.

Let me know if you have further questions.

- Konstantin



Brian Vosburgh wrote:
> Our FacetedProjectListener receives a PROJECT_MODIFIED event whenever a
> project
> is closed or opened. Unfortunately, the listener does not receive any
> event at all
> whenever a project is deleted or imported from a previously existed
> project.
> Is there a reason for this? Does it make sense for us to request events for
> those situations? If we received events for these situations it would
> simplify
> the way we set up and tear down the things related to our "facet".
>
> Thanks.
> Brian Vosburgh
Re: faceted project events [message #203370 is a reply to message #203196] Tue, 30 October 2007 11:53 Go to previous message
Eclipse User
Originally posted by: first.last.oracle.com

Thanks for the response, Konstantin. Please see comments below.

Konstantin Komissarchik wrote:
> The fact that you are seeing a PROJECT_MODIFIED event on close/open is
> actually a bug, which has been fixed in the 2.0.x and newer code lines.

I did not know this was a bug, since I'm simply trying to decipher when
the various events get fired via "black-box" testing; and I am working
in the 3.0 stream. Maybe I didn't read the docs closely enough....
I actually like things moving this way, as opposed to what I suggested
in my original message. What is the bug number? Do you expect to copy
the fix to the 3.0 stream any time soon?

> There is an open enhancement request to provide a PROJECT_INITIALIZED
> event that would cover opened/imported cases.
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=198165

Cool. This might help us out; but removing the above-mentioned PROJECT_MODIFIED
events might negate our need for PROJECT_INITIALIZED....

> I haven't thought about providing events to cover the closed/deleted
> case, but it may make sense to do. Please add your thoughts on this to
> the above enhancement request. Note that PROJECT_INITIALIZED event will
> not _exactly_ represent the open/import case. The reason is that the
> event will only be generated when some code requests IFacetedProject
> metadata for that project. We don't pro-actively scan for new projects
> and initialize them for performance reasons. This distinction may not
> matter for your situations, though.
>
> Note that the general answer is that the faceted project events are not
> meant to replace the facilities provided by the platform's resource
> change listeners.

What I am trying to do is set up the Dali project initialization and teardown
to occur at particular times, as triggered by various events in the workspace.
We have 4 pairs of events that I know we need to handle:

1. JPA facet install/uninstall: As expected, these are triggered by the Facet
POST_INSTALL and PRE_UNINSTALL events.

2. Open/close project: These are currently triggered by the Facet
PROJECT_MODIFIED event; but should be replaced by the IResourceChangeEvent
POST_CHANGE (where the delta indicates a project has been opened) and
PRE_CLOSE events once your bug fix is in place.

3. Import/delete project: These are triggered by the IResourceChangeEvent
POST_CHANGE (where the delta indicates a project has been opened) and
PRE_DELETE events.

4. Adding or removing the JPA facet from the facet settings file via direct
manipulation (e.g. restoring the file from CVS): These are triggered by the
PROJECT_MODIFIED event. Is there a better way to handle this?

5? Are there any other situations (you know of) we should be watching for?

We are trying to reduce the variety of ways our init and teardown could be
triggered, but that is muddied by the variety of ways the PROJECT_MODIFIED
event could indicate that a project with a JPA facet has "appeared" or
"disappeared" in the workspace. Removing that event from the project
open/close actually makes our job easier. Now, does it make sense to have
any sort of events that indicate that a particular facet has "appeared" or
"disappeared" (when the facet settings file is manipulated)? Or is the
PROJECT_MODIFIED event the best we can hope for?

> Your co-worker Paul Fullbright and I had a discussion
> on this scenario some months ago. He should be able to share with your
> some code that uses the resource change listeners to handle this
> scenario in the meantime.

Paul is out of the office, and I had not heard the details of these discussions.
Are they recorded somewhere public that I should have reviewed before pestering
you? :-)

> Let me know if you have further questions.
>
> - Konstantin

Thanks for your help!

> Brian Vosburgh wrote:
>> Our FacetedProjectListener receives a PROJECT_MODIFIED event whenever
>> a project
>> is closed or opened. Unfortunately, the listener does not receive any
>> event at all
>> whenever a project is deleted or imported from a previously existed
>> project.
>> Is there a reason for this? Does it make sense for us to request
>> events for
>> those situations? If we received events for these situations it would
>> simplify
>> the way we set up and tear down the things related to our "facet".
>>
>> Thanks.
>> Brian Vosburgh
Previous Topic:Way to change web root on dynamic web project
Next Topic:Re: source code for org.eclipse.wst.wsdl.validation
Goto Forum:
  


Current Time: Thu Aug 21 08:11:26 EDT 2014

Powered by FUDForum. Page generated in 0.02232 seconds