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.

Hi John,
Thank you very much for your advice. You saved me many hours of experimenting.

Regards,
Thomas Hallgren

John Arthorne wrote:

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.




Back to the top