Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ptp-dev] Getting URI of a synchronized resource

Further to this, I've added a more generic method to obtain the "active" location of a resource. For local and remote projects, the active location is just that returned by getLocationURI(). For synchronized projects, this is the location of the resource on the currently active synchronize target host.

Given an IResource called resource, you simply need to do this:

	IRemoteResource remoteResource = (IRemoteResource) resource.getAdapter(IRemoteResource.class);
	if (remoteResource != null) {
		URI location = remoteResource.getActiveLocationURI();
		if (location != null) {
			... 
		}
	}

Regards,
Greg

On Oct 12, 2011, at 9:17 AM, Greg Watson wrote:

> I've added a couple of methods to make it easier to obtain the URI of a resource in a synchronized project, since this is probably something that will be done fairly frequently (I know Dave and Wyatt were looking at this recently). It's easy to obtain the URI of a resource in a local or remote project by calling IResource#getLocationURI(), but for a synchronized project, this only obtains the URI of the local copy. Since synchronized projects can have multiple targets, it's a bit more complicated to find the actual remote location.
> 
> See bug 360661 for details.
> 
> Cheers,
> Greg
> _______________________________________________
> ptp-dev mailing list
> ptp-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/ptp-dev



Back to the top