|
Eclipse Platform Release 3.2 |
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Objectorg.eclipse.core.resources.mapping.ResourceMappingContext
org.eclipse.core.resources.mapping.RemoteResourceMappingContext
org.eclipse.team.core.subscribers.SubscriberResourceMappingContext
A resource mapping context that provides the client access to the remote state
of local resources using a subscriber. It uses a SyncInfoFilter
to determine whether the local contents differ from the remote contents.
This allows the context to be used for different operations (check-in,
update and replace).
EXPERIMENTAL. This class or interface has been added as part of a work in progress. There is a guarantee neither that this API will work nor that it will remain the same. Please do not use this API without consulting with the Platform/Team team.
| Field Summary |
|---|
| Fields inherited from class org.eclipse.core.resources.mapping.RemoteResourceMappingContext |
|---|
FILE_CONTENTS_REQUIRED, NONE |
| Fields inherited from class org.eclipse.core.resources.mapping.ResourceMappingContext |
|---|
LOCAL_CONTEXT |
| Constructor Summary | |
|---|---|
SubscriberResourceMappingContext(Subscriber subscriber,
boolean autoRefresh)
Create a resource mapping context for the given subscriber |
|
| Method Summary | |
|---|---|
boolean |
contentDiffers(IFile file,
IProgressMonitor monitor)
|
static org.eclipse.core.resources.mapping.RemoteResourceMappingContext |
createContext(Subscriber subscriber)
Return a resource mapping context suitable for comparison operations. |
IStorage |
fetchBaseContents(IFile file,
IProgressMonitor monitor)
For three-way comparisons, returns an instance of IStorage in order to allow the caller to access the contents of the base resource that corresponds to the given local resource. |
IResource[] |
fetchMembers(IContainer container,
IProgressMonitor monitor)
Returns the list of member resources whose corresponding remote resources are members of the corresponding remote resource of the given local container. |
IStorage |
fetchRemoteContents(IFile file,
IProgressMonitor monitor)
Returns an instance of IStorage in order to allow the caller to access the contents of the remote that corresponds to the given local resource. |
IProject[] |
getProjects()
Return the list of projects that apply to this context. |
boolean |
hasLocalChange(IResource resource,
IProgressMonitor monitor)
For three-way comparisons, this method indicates whether local modifications have been made to the given resource. |
boolean |
hasRemoteChange(IResource resource,
IProgressMonitor monitor)
For two-way comparisons, return whether the contents of the corresponding remote differs from the content of the local file in the context of the current operation. |
boolean |
isThreeWay()
Return true if the context is associated with an operation
that is using a three-way comparison and false if it is
using a two-way comparison. |
protected void |
refresh(IResource[] resources,
int depth,
int flags,
IProgressMonitor monitor)
Refresh the subscriber and cache the fact that the resources were refreshed by calling the refreshed method. |
void |
refresh(org.eclipse.core.resources.mapping.ResourceTraversal[] traversals,
int flags,
IProgressMonitor monitor)
Refresh the known remote state for any resources covered by the given traversals. |
protected void |
refreshed(IResource[] resources,
int depth)
Record the fact that the resources have been refreshed to the given depth. |
void |
setAutoRefresh(boolean autoRefresh)
Set whether the context should refresh the state of resources when their state is requested. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public SubscriberResourceMappingContext(Subscriber subscriber,
boolean autoRefresh)
subscriber - the subscriber
from the local contents| Method Detail |
public static org.eclipse.core.resources.mapping.RemoteResourceMappingContext createContext(Subscriber subscriber)
public final boolean hasRemoteChange(IResource resource,
IProgressMonitor monitor)
throws CoreException
org.eclipse.core.resources.mapping.RemoteResourceMappingContexttrue if the remote contents differ from the local
contents.
For three-way comparisons, return whether the contents of the
corresponding remote differ from the contents of the base. In other
words, this method returns true if the corresponding
remote has changed since the last time the local resource was updated
with the remote contents.
For two-way comparisons, return true if the remote
contents differ from the local contents. In this case, this method is
equivalent to RemoteResourceMappingContext.hasLocalChange(IResource, IProgressMonitor)
This can be used by clients to determine if they need to fetch the remote
contents in order to determine if the resources that constitute the model
element are different in the remote location. If the local file exists
and the remote file does not, or the remote file exists and the local
does not then the contents will be said to differ (i.e. true
is returned). Also, implementors will most likely use a timestamp based
comparison to determine if the contents differ. This may lead to a
situation where true is returned but the actual contents
do not differ. Clients must be prepared handle this situation.
resource - the local resourcemonitor - a progress monitor, or null if progress
reporting is not desired
CoreException - if the contents could not be compared. Reasons
include:
IResourceStatus.RESOURCE_WRONG_TYPE).
public boolean hasLocalChange(IResource resource,
IProgressMonitor monitor)
throws CoreException
org.eclipse.core.resources.mapping.RemoteResourceMappingContextRemoteResourceMappingContext.hasRemoteChange(IResource, IProgressMonitor).
resource - the resource being testedmonitor - a progress monitor
CoreException - if the contents could not be compared. Reasons
include:
IResourceStatus.RESOURCE_WRONG_TYPE).
public final IStorage fetchRemoteContents(IFile file,
IProgressMonitor monitor)
throws CoreException
org.eclipse.core.resources.mapping.RemoteResourceMappingContextnull is returned. The
provided local file handle need not exist locally. A exception is thrown
if the corresponding remote resource is not a file.
This method may be long running as a server may need to be contacted to obtain the contents of the file.
file - the local filemonitor - a progress monitor, or null if progress
reporting is not desired
null is returned
CoreException - if the contents could not be fetched. Reasons
include:
IResourceStatus.RESOURCE_WRONG_TYPE).
public final IStorage fetchBaseContents(IFile file,
IProgressMonitor monitor)
throws CoreException
org.eclipse.core.resources.mapping.RemoteResourceMappingContextnull
is returned. The provided local file handle need not exist locally. A exception
is thrown if the corresponding base resource is not a file.
This method may be long running as a server may need to be contacted to obtain the contents of the file.
file - the local filemonitor - a progress monitor, or null if progress
reporting is not desired
null is returned
CoreException - if the contents could not be fetched. Reasons
include:
IResourceStatus.RESOURCE_WRONG_TYPE).
public final IResource[] fetchMembers(IContainer container,
IProgressMonitor monitor)
throws CoreException
org.eclipse.core.resources.mapping.RemoteResourceMappingContextThis method may be long running as a server may need to be contacted to obtain the members of the container's corresponding remote resource.
container - the local containermonitor - a progress monitor, or null if progress
reporting is not desired
null if the remote does not exist.
CoreException - if the members could not be fetched. Reasons
include:
IResourceStatus.RESOURCE_WRONG_TYPE).
public final void refresh(org.eclipse.core.resources.mapping.ResourceTraversal[] traversals,
int flags,
IProgressMonitor monitor)
throws CoreException
org.eclipse.core.resources.mapping.RemoteResourceMappingContext
Note that this is really only a hint to the context provider. It is up to
implementors to decide, based on the provided traversals, how to
efficiently perform the refresh. In the ideal case, calls to
RemoteResourceMappingContext.hasRemoteChange(IResource, IProgressMonitor) and
RemoteResourceMappingContext.fetchMembers(org.eclipse.core.resources.IContainer, org.eclipse.core.runtime.IProgressMonitor) would not need to contact the server after a call to a
refresh with appropriate traversals. Also, ideally, if
RemoteResourceMappingContext.FILE_CONTENTS_REQUIRED is on of the flags, then the contents
for these files will be cached as efficiently as possible so that calls to
RemoteResourceMappingContext.fetchRemoteContents(org.eclipse.core.resources.IFile, org.eclipse.core.runtime.IProgressMonitor) will also not need to contact the server. This
may not be possible for all context providers, so clients cannot assume that
the above mentioned methods will not be long running. It is still advisable
for clients to call RemoteResourceMappingContext.refresh(org.eclipse.core.resources.mapping.ResourceTraversal[], int, org.eclipse.core.runtime.IProgressMonitor) with as much details as possible since, in
the case where a provider is optimized, performance will be much better.
traversals - the resource traversals that indicate which resources
are to be refreshedflags - additional refresh behavior. For instance, if
RemoteResourceMappingContext.FILE_CONTENTS_REQUIRED is one of the flags, this indicates
that the client will be accessing the contents of the files covered by
the traversals. RemoteResourceMappingContext.NONE should be used when no additional
behavior is requiredmonitor - a progress monitor, or null if progress
reporting is not desired
CoreException - if the refresh fails. Reasons include:
protected void refresh(IResource[] resources,
int depth,
int flags,
IProgressMonitor monitor)
throws TeamException
refreshed method. The default implementation only refreshes
the state and does not fetch contents in the FILE_CONTENTS_REQUIRED
flag is passed. It is up to subclass to handle this.
resources - the resources to be refresheddepth - the depth of the refreshflags - the flags that indicate extra state that should be fetchedmonitor - a progress monitor
TeamException
protected final void refreshed(IResource[] resources,
int depth)
resources - the resources that were refresheddepth - the depth to which the resources were refreshedpublic void setAutoRefresh(boolean autoRefresh)
autoRefresh - whether the context should refresh the state of resources
when their state is requestedpublic boolean isThreeWay()
org.eclipse.core.resources.mapping.RemoteResourceMappingContexttrue if the context is associated with an operation
that is using a three-way comparison and false if it is
using a two-way comparison.
public boolean contentDiffers(IFile file,
IProgressMonitor monitor)
throws CoreException
CoreExceptionpublic IProject[] getProjects()
org.eclipse.core.resources.mapping.RemoteResourceMappingContext
|
Eclipse Platform Release 3.2 |
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2005. All rights reserved.