| Summary: | Need easy method to obtain URI of synchronized resource | ||
|---|---|---|---|
| Product: | [Tools] PTP | Reporter: | Greg Watson <g.watson> |
| Component: | RDT.sync | Assignee: | Greg Watson <g.watson> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | wspear |
| Version: | 5.0.2 | ||
| Target Milestone: | 5.0.3 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
|
Description
Greg Watson
I've added two methods: BuildConfigurationManager#getActiveSyncLocationURI(IResource) BuildConfigurationManager#getSyncLocationURI(IConfiguration, IResource) The former obtains the resource URI for the active sync configuration (as specified by the active build configuration). The latter can be used to obtain the resource URI based on any build configuration (since a project can have multiple build/sync configurations). Fixed in ptp_5_0 and HEAD. This doesn't solve all the issues because using these methods have a dependency on the org.eclipse.ptp.rdt.sync.core plugin. To avoid this, I've added an IRemoteProject interface and an adapter factory that allows an IProject to be adapted to an IRemoteProject. IRemoteProject is in org.eclipse.ptp.remote.core, so the only dependency required is to this plugin. A client can then do the following:
IRemoteProject remoteProject = (IRemoteProject) resource.getProject().getAdapter(IRemoteProject.class);
if (remoteProject != null) {
URI location = remoteProject.getActiveLocationURI(resource);
if (location != null) {
...
}
}
This will obtain the URI of the synchronized resource, or the normal URI if it is a local or remote resource.
This is only available in HEAD as it requires an API change.
The interface has been simplified slightly. It now works directly on a resource rather requiring access to the project:
IRemoteResource remoteResource = (IRemoteResource) resource.getAdapter(IRemoteResource.class);
if (remoteResource != null) {
URI location = remoteResource.getActiveLocationURI();
if (location != null) {
...
}
}
*** Bug 357291 has been marked as a duplicate of this bug. *** |