Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Project clean event?
Project clean event? [message #335244] Fri, 27 March 2009 15:15 Go to next message
Paul Fullbright is currently offline Paul FullbrightFriend
Messages: 201
Registered: July 2009
Senior Member
Is there a way to capture when a project clean occurs *other* than adding
a builder? We don't "build" anything, but we do want to know when it
occurs, especially a clean.

A resource listener isn't quite enough, because if no resource changes,
then there is no post build event.
Re: Project clean event? [message #335248 is a reply to message #335244] Fri, 27 March 2009 16:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

Hi,

There is a clean event in the resources listener.

Paul Fullbright wrote:
> Is there a way to capture when a project clean occurs *other* than
> adding a builder? We don't "build" anything, but we do want to know
> when it occurs, especially a clean.
>
> A resource listener isn't quite enough, because if no resource changes,
> then there is no post build event.
>

--
Thanks,
Rich Kulp
Re: Project clean event? [message #335249 is a reply to message #335248] Fri, 27 March 2009 16:55 Go to previous messageGo to next message
Paul Fullbright is currently offline Paul FullbrightFriend
Messages: 201
Registered: July 2009
Senior Member
You mean the getBuildKind() query? If so, I do know about that, but the
problem is that the POST_BUILD event will not be broadcast if there are no
resource changes (if there is no resource delta). So this method of
capturing that a clean has happened is not reliable. I would like to know
*every* time a clean has been invoked, whether or not resources are
changed as a result.

Rich Kulp wrote:

> Hi,

> There is a clean event in the resources listener.

> Paul Fullbright wrote:
>> Is there a way to capture when a project clean occurs *other* than
>> adding a builder? We don't "build" anything, but we do want to know
>> when it occurs, especially a clean.
>>
>> A resource listener isn't quite enough, because if no resource changes,
>> then there is no post build event.
>>
Re: Project clean event? [message #335251 is a reply to message #335249] Fri, 27 March 2009 18:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

Then capture pre_build instead of post_build.

Paul Fullbright wrote:
> You mean the getBuildKind() query? If so, I do know about that, but the
> problem is that the POST_BUILD event will not be broadcast if there are
> no resource changes (if there is no resource delta). So this method of
> capturing that a clean has happened is not reliable. I would like to
> know *every* time a clean has been invoked, whether or not resources are
> changed as a result.
>
> Rich Kulp wrote:
>
>> Hi,
>
>> There is a clean event in the resources listener.
>
>> Paul Fullbright wrote:
>>> Is there a way to capture when a project clean occurs *other* than
>>> adding a builder? We don't "build" anything, but we do want to know
>>> when it occurs, especially a clean.
>>>
>>> A resource listener isn't quite enough, because if no resource
>>> changes, then there is no post build event.
>>>
>
>
>

--
Thanks,
Rich Kulp
Re: Project clean event? [message #335252 is a reply to message #335251] Fri, 27 March 2009 18:17 Go to previous messageGo to next message
Paul Fullbright is currently offline Paul FullbrightFriend
Messages: 201
Registered: July 2009
Senior Member
I didn't mention pre_build because we're more interested in doing
something after the build has been launched, but it does suffer from the
same problem as post_build. If there are no resource changes since the
last build, there is no event.

Rich Kulp wrote:

> Then capture pre_build instead of post_build.

> Paul Fullbright wrote:
>> You mean the getBuildKind() query? If so, I do know about that, but the
>> problem is that the POST_BUILD event will not be broadcast if there are
>> no resource changes (if there is no resource delta). So this method of
>> capturing that a clean has happened is not reliable. I would like to
>> know *every* time a clean has been invoked, whether or not resources are
>> changed as a result.
>>
>> Rich Kulp wrote:
>>
>>> Hi,
>>
>>> There is a clean event in the resources listener.
>>
>>> Paul Fullbright wrote:
>>>> Is there a way to capture when a project clean occurs *other* than
>>>> adding a builder? We don't "build" anything, but we do want to know
>>>> when it occurs, especially a clean.
>>>>
>>>> A resource listener isn't quite enough, because if no resource
>>>> changes, then there is no post build event.
>>>>
>>
>>
>>
Re: Project clean event? [message #335253 is a reply to message #335252] Fri, 27 March 2009 18:51 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

I don't think that's true, or something has changed. I was the one that
requested the Clean notification to be put in several years ago. It's
purpose was to let me know a clean was requested so that I could delete
some files in metadata area. I received notifications no matter whether
any files had changed or been deleted or not.

Paul Fullbright wrote:
> I didn't mention pre_build because we're more interested in doing
> something after the build has been launched, but it does suffer from the
> same problem as post_build. If there are no resource changes since the
> last build, there is no event.
>
> Rich Kulp wrote:
>
>> Then capture pre_build instead of post_build.
>
>> Paul Fullbright wrote:
>>> You mean the getBuildKind() query? If so, I do know about that, but
>>> the problem is that the POST_BUILD event will not be broadcast if
>>> there are no resource changes (if there is no resource delta). So
>>> this method of capturing that a clean has happened is not reliable.
>>> I would like to know *every* time a clean has been invoked, whether
>>> or not resources are changed as a result.
>>>
>>> Rich Kulp wrote:
>>>
>>>> Hi,
>>>
>>>> There is a clean event in the resources listener.
>>>
>>>> Paul Fullbright wrote:
>>>>> Is there a way to capture when a project clean occurs *other* than
>>>>> adding a builder? We don't "build" anything, but we do want to
>>>>> know when it occurs, especially a clean.
>>>>>
>>>>> A resource listener isn't quite enough, because if no resource
>>>>> changes, then there is no post build event.
>>>>>
>>>
>>>
>>>
>
>
>

--
Thanks,
Rich Kulp
Re: Project clean event? [message #335255 is a reply to message #335253] Fri, 27 March 2009 20:10 Go to previous messageGo to next message
Paul Fullbright is currently offline Paul FullbrightFriend
Messages: 201
Registered: July 2009
Senior Member
OK, found the problem and you're right.

I was basing this off of this prior posting:

http://dev.eclipse.org/newslists/news.eclipse.platform/msg68 578.html

most of which seems correct when looking at the code.


I was also *never* receiving either a pre or post_build event so I assumed
it was true. You clued me in to looking at the listener registration a
bit closer. We haven't needed to look at build events prior to this, so
our usage of:

workspace.addResourceChangeListener(listener);

didn't show any problems.

Using:

workspace.addResourceChangeListener(resourceChangeListener,
IResourceChangeEvent.PRE_CLOSE | IResourceChangeEvent.PRE_DELETE |
IResourceChangeEvent.POST_CHANGE | IResourceChangeEvent.POST_BUILD);

fixes our problems. I now always receive a post_build event. I assume
having the first method solved some backwards compatibility problem for
some users at some point. Never would I have guessed that the first
method would be equivalent to calling the second with some arbitrary (to
someone) subset of flags.

Thanks for helping,
- Paul


Rich Kulp wrote:

> I don't think that's true, or something has changed. I was the one that
> requested the Clean notification to be put in several years ago. It's
> purpose was to let me know a clean was requested so that I could delete
> some files in metadata area. I received notifications no matter whether
> any files had changed or been deleted or not.
Re: Project clean event? [message #335256 is a reply to message #335255] Fri, 27 March 2009 21:43 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

Hi Paul,

I'm glad you found your answer. :-)


--
Thanks,
Rich Kulp
Previous Topic:Wizard questions
Next Topic:refresh not working properly
Goto Forum:
  


Current Time: Sat Nov 09 00:04:23 GMT 2024

Powered by FUDForum. Page generated in 0.03949 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top