Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-core-dev] Location of removed projects.


I think you'll need to use a combination of PRE_DELETE and POST_CHANGE. Typically, IResource#getLocation() should return a valid value after the fact, in a POST_CHANGE event. The main case where IResource#getLocation() will return null is when the project has been deleted, at which point we can't make a reasonable guess after deletion about where that project was located.  By listening for PRE_DELETE, you will capture project deletions, at which point the project location is still available. So, I would suggest trying something like this:

In PRE_DELETE, record the location of each project being deleted.
In POST_CHANGE, call IResource#getLocation(). If this returns null, use the project location recorded in PRE_DELETE, and append the resource's project-relative path (IResource#getProjectRelativePath()).

IResource#getLocation can also be null if the resource is not stored in the local file system. In this case, you can use IResource#getLocationURI to obtain the resource location.




Thomas Hallgren <thomas@xxxxxxx>
Sent by: platform-core-dev-bounces@xxxxxxxxxxx

05/29/2007 06:55 PM

Please respond to
"Eclipse Platform Core component developers list."        <platform-core-dev@xxxxxxxxxxx>

To
platform-core-dev@xxxxxxxxxxx
cc
Subject
[platform-core-dev] Location of removed projects.





Hi,
I have some code that needs to keep track of the location (in the
filesystem) of workspace resources that has been removed. I tried using
a IResourceDeltaVisitor visited at the time of
IResourceChangeEvent.PRE_BUILD and checked for kind
IResourceDelta.REMOVED. But apparently, the path that I get from the
delta.getResource().getLocation() is null.

What would be the correct way to keep track of the paths in the local
filesystem that has been removed?

Regards,
Thomas Hallgren


_______________________________________________
platform-core-dev mailing list
platform-core-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-core-dev


Back to the top