Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » confusing Project.members() behavior
confusing Project.members() behavior [message #324870] Sun, 03 February 2008 02:15 Go to next message
Eclipse UserFriend
Hi all,
org.eclipse.core.internal.resources.Project's method members()'s behavior
make me confuse,

See below codes:
1. IProject project = (IProject) parentElement;
2. System.out.println("res numbers: " + project.members().length);
3. for (int y = 0; y < project.members().length; y++) {}

If I set breakpoint on line 3 and debug the progrm, in my runtime
workspace console will output res numbers : 1
and then I step into project.members(), and it return 28 members.

The same method return different result only because called in diferent
mode.
Is it right behavior?

After I add this statement before line 2
project.refreshLocal(IProject.DEPTH_INFINITE, null);
Everything is OK.


Anthony
Re: confusing Project.members() behavior [message #324919 is a reply to message #324870] Mon, 04 February 2008 09:41 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

If refresh local makes the numbers match then that means there were
files added directly to the file system instead of going through the
Eclipse IFile.setContent() method. This means Eclipse at first didn't
know about these files. Eclipse keeps an in-memory cache of the files in
a project and periodically looks at the actual filesystem to resync up
with it. The refresh forces it to resync right then before stmt 2 was
executed.


--
Thanks,
Rich Kulp
Previous Topic:Snippet036FocusBorderCellHighlighter
Next Topic:Forcing the refresh of a decoration
Goto Forum:
  


Current Time: Mon Sep 15 12:27:15 EDT 2025

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

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

Back to the top