Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » Duplicate IResourceChangeEvent for project open (Eclipse 3.0.1 + CDT 2.1.0)
Duplicate IResourceChangeEvent for project open (Eclipse 3.0.1 + CDT 2.1.0) [message #140398] Wed, 09 March 2005 08:00 Go to next message
Eclipse UserFriend
Originally posted by: Paul.Henshaw.icimsi.ch

Dear All,

I am using Eclipse 3.0.1 with CDT 2.1.0 on Windows 2000, and
have noticed that my ResourceChangeListener sometimes receives
duplicate IResourceChangeEvents following a project open operation.

If I create two new (non-C) projects A and B, with B referencing A,
and then add some custom EMF resources to both projects, when I
open and close A, everything works as expected, with a single
event being delivered to my listener.

If I then add the C nature to both A and B, and create C source files
and Makefiles to build, the CDT builder runs correctly, but when I
open and close A, my listener sometimes receives two POST_CHANGE
events
containing with IResourceDelta.OPEN flags for A.
The events are different instances (the debugger shows different ids),
but both have getFlags() & IResourceDelta.OPEN !=0 for A. Note that
no CLOSE event is received between the two OPEN events.

I'm not sure if it is relevant but getFlags() & IResourceDelta.SYNC
!=0
for A in both events. I don't normally check for IResourceDelta.SYNC,
but have noticed that in both events it is always set.

The first event is always triggered by the OpenResourceAction, the
second as part of the AutoBuildJob.

The resource change listener is registered only once with the
workspace.

I have checked the newsgroups and bugzilla, but have not been able
to find any information about duplicate resource change events.

Is this a bug? Is it possible to distinguish between "original" and
"duplicate" events?

Any help or advice would be much appreciated,

Paul
Re: Duplicate IResourceChangeEvent for project open (Eclipse 3.0.1 + CDT 2.1.0) [message #140460 is a reply to message #140398] Wed, 09 March 2005 14:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: chaves.inf.no.ufsc.spam.br

Are you aware that the flag OPEN is used for when closing *and* opening
projects? There is no CLOSE event.

I wonder why you are not *always* seeing two events.

Rafael

Paul Henshaw wrote:
> Dear All,
>
> I am using Eclipse 3.0.1 with CDT 2.1.0 on Windows 2000, and
> have noticed that my ResourceChangeListener sometimes receives
> duplicate IResourceChangeEvents following a project open operation.
>
> If I create two new (non-C) projects A and B, with B referencing A,
> and then add some custom EMF resources to both projects, when I
> open and close A, everything works as expected, with a single
> event being delivered to my listener.
>
> If I then add the C nature to both A and B, and create C source files
> and Makefiles to build, the CDT builder runs correctly, but when I
> open and close A, my listener sometimes receives two POST_CHANGE
> events
> containing with IResourceDelta.OPEN flags for A.
> The events are different instances (the debugger shows different ids),
> but both have getFlags() & IResourceDelta.OPEN !=0 for A. Note that
> no CLOSE event is received between the two OPEN events.
>
> I'm not sure if it is relevant but getFlags() & IResourceDelta.SYNC
> !=0
> for A in both events. I don't normally check for IResourceDelta.SYNC,
> but have noticed that in both events it is always set.
>
> The first event is always triggered by the OpenResourceAction, the
> second as part of the AutoBuildJob.
>
> The resource change listener is registered only once with the
> workspace.
>
> I have checked the newsgroups and bugzilla, but have not been able
> to find any information about duplicate resource change events.
>
> Is this a bug? Is it possible to distinguish between "original" and
> "duplicate" events?
>
> Any help or advice would be much appreciated,
>
> Paul
>
>
>
>
Re: Duplicate IResourceChangeEvent for project open (Eclipse 3.0.1 + CDT 2.1.0) [message #140516 is a reply to message #140460] Thu, 10 March 2005 08:12 Go to previous message
Eclipse UserFriend
Originally posted by: Paul.Henshaw.icimsi.ch

Rafael,

thanks for your message:


"Rafael Chaves" <chaves@inf.no.ufsc.spam.br> wrote in message
news:d0nk78$o7n$1@www.eclipse.org...
> Are you aware that the flag OPEN is used for when closing *and*
opening
> projects? There is no CLOSE event.
>
> I wonder why you are not *always* seeing two events.
>
> Rafael

Yes, I am aware that the OPEN flag is used for both opening
and closing projects. When I close the project, an event is
received and the following expression is true:

(delta.getFlags() & IResourceDelta.OPEN !=0) &&
!delta.getResource().isAccessible()

This is what I meant by a "CLOSE" event. Perhaps I should
have explained that more clearly in my first post, sorry
about that. One such event is received for each single
close operation, so this appears to behave as expected.

On some occasions however, I receive an event for which the
following expression is true:

(delta.getFlags() & IResourceDelta.OPEN !=0) &&
delta.getResource().isAccessible()

followed by another distinct instance of ResourceChangeEvent
for which the same expression is true, for the same project.
In between these two identical events no event with
!project.isAccessible() is received. This behaviour seems
strange to me, so I would appreciate any hints the community
can offer.

Cheers,

Paul
Previous Topic:Debugging DLL on Windows
Next Topic:error parser using watcom
Goto Forum:
  


Current Time: Thu Jul 10 09:54:39 EDT 2025

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

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

Back to the top