Class RefreshProvider
- java.lang.Object
-
- org.eclipse.core.internal.refresh.InternalRefreshProvider
-
- org.eclipse.core.resources.refresh.RefreshProvider
-
public abstract class RefreshProvider extends org.eclipse.core.internal.refresh.InternalRefreshProvider
The abstract base class for all auto-refresh providers. This class provides the infrastructure for defining an auto-refresh provider and fulfills the contract specified by theorg.eclipse.core.resources.refreshProviders
standard extension point.All auto-refresh providers must subclass this class. A
RefreshProvider
is responsible for creatingIRefreshMonitor
objects. The provider must decide if it is capable of monitoring the file, or folder and subtree under the path that is provided.Note: since 3.12, all subclasses should override
installMonitor(IResource, IRefreshResult, IProgressMonitor)
instead ofinstallMonitor(IResource, IRefreshResult)
.- Since:
- 3.0
-
-
Constructor Summary
Constructors Constructor Description RefreshProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected IRefreshMonitor
createPollingMonitor(IResource resource)
Creates a new refresh monitor that performs naive polling of the resource in the file system to detect changes.IRefreshMonitor
installMonitor(IResource resource, IRefreshResult result)
Deprecated.Subclasses should override and clients should callinstallMonitor(IResource, IRefreshResult, IProgressMonitor)
instead.IRefreshMonitor
installMonitor(IResource resource, IRefreshResult result, IProgressMonitor progressMonitor)
Returns anIRefreshMonitor
that will monitor a resource.void
resetMonitors(IResource resource)
Deprecated.Subclasses should override and clients should callresetMonitors(IResource, IProgressMonitor)
instead.void
resetMonitors(IResource resource, IProgressMonitor progressMonitor)
Resets the installed monitors for the given resource.
-
-
-
Method Detail
-
createPollingMonitor
protected IRefreshMonitor createPollingMonitor(IResource resource)
Creates a new refresh monitor that performs naive polling of the resource in the file system to detect changes. The returned monitor will immediately begin monitoring the specified resource root and report changes back to the workspace.This default monitor can be returned by subclasses when
installMonitor
is called.If the returned monitor is not immediately returned from the
installMonitor
method, then clients are responsible for telling the returned monitor to stop polling when it is no longer needed. The returned monitor can be told to stop working by invokingIRefreshMonitor.unmonitor(IResource)
.- Overrides:
createPollingMonitor
in classorg.eclipse.core.internal.refresh.InternalRefreshProvider
- Parameters:
resource
- The resource to begin monitoring- Returns:
- A refresh monitor instance
- See Also:
installMonitor(IResource, IRefreshResult)
-
installMonitor
@Deprecated public IRefreshMonitor installMonitor(IResource resource, IRefreshResult result)
Deprecated.Subclasses should override and clients should callinstallMonitor(IResource, IRefreshResult, IProgressMonitor)
instead.
-
installMonitor
public IRefreshMonitor installMonitor(IResource resource, IRefreshResult result, IProgressMonitor progressMonitor)
Returns anIRefreshMonitor
that will monitor a resource. If the resource is anIContainer
the monitor will also monitor the subtree under the container. Returnsnull
if this provider cannot create a monitor for the given resource. The provider may return the same monitor instance that has been provided for other resources.The monitor should send results and failures to the provided refresh result.
- Parameters:
resource
- the resource to monitorresult
- the result callback for notifying of failure or of resources that need refreshingprogressMonitor
- the progress monitor to use for reporting progress to the user. It is the caller's responsibility to call done() on the given monitor. Accepts null, indicating that no progress should be reported and that the operation cannot be cancelled.- Returns:
- a monitor on the resource, or
null
if the resource cannot be monitored - Since:
- 3.12
- See Also:
createPollingMonitor(IResource)
-
resetMonitors
@Deprecated public void resetMonitors(IResource resource)
Deprecated.Subclasses should override and clients should callresetMonitors(IResource, IProgressMonitor)
instead.
-
resetMonitors
public void resetMonitors(IResource resource, IProgressMonitor progressMonitor)
Resets the installed monitors for the given resource. This will remove all existing monitors that are installed on the resource, and then ask all refresh providers to begin monitoring the resource again.This method is intended to be used by refresh providers that need to change the refresh monitor that they previously used to monitor a resource.
- Overrides:
resetMonitors
in classorg.eclipse.core.internal.refresh.InternalRefreshProvider
- Parameters:
resource
- The resource to reset the monitors forprogressMonitor
- the progress monitor to use for reporting progress to the user. It is the caller's responsibility to call done() on the given monitor. Accepts null, indicating that no progress should be reported and that the operation cannot be cancelled.- Since:
- 3.12
-
-