java.lang.Objectcom.ibm.jdg2e.view.files.ui.FileContentProvider
Obtains file resources from selected input for display in view.
A dynamic approach based on Job and WorkbenchJob
support, is used to both reduce UI locking and allow for an improved user
dynamic. The getElements method does not actually return
content, instead it starts a job that will result in the delivery of the
required content to the viewer.
If the user changes the input or filtering rules all in-flight work is canceled and the new input/filter rules are used. This is possible because jobs are used for most of the processing.
| Nested Class Summary | |
|---|---|
(package private) class |
FileContentProvider.AddToViewer
This job is used to deliver content to the viewer. |
(package private) class |
FileContentProvider.FileFinder
Job to find input for the File Resources view. |
(package private) class |
FileContentProvider.FileProxyVisitor
Visitor for File Resources view. |
| Constructor Summary | |
|---|---|
(package private) |
FileContentProvider()
Constructor. |
|
FileContentProvider(FileView view)
|
| Method Summary | |
|---|---|
(package private) void |
cancelActiveJobs()
Cancel any jobs that might be active. |
void |
dispose()
Cancel any active jobs and clear references. |
(package private) void |
findFiles(java.lang.Object parent,
org.eclipse.core.runtime.IProgressMonitor monitor)
Create and run an IResourceProxyVisitor to fine files. |
java.lang.Object[] |
getElements(java.lang.Object parent)
Find all IFile resources for the selected input. |
int |
getElementsLength()
Provides access to the size of the elements that might be visible in the viewer. |
void |
inputChanged(org.eclipse.jface.viewers.Viewer viewer,
java.lang.Object oldInput,
java.lang.Object newInput)
Following the pattern of removing listener from old input and adding to new input. |
void |
resetTimestampRange()
Forces viewer update of all content to reflect new rules for label provider logic that color codes recent updates based on the selected time span range. |
void |
resourceChanged(org.eclipse.core.resources.IResourceChangeEvent event)
Identifies when changes have occurred and asks that the viewer refresh to show current content. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
FileContentProvider()
public FileContentProvider(FileView view)
view - used to obtain IWorkbenchSiteProgressService
reference to schedule workbench part aware jobs.| Method Detail |
void cancelActiveJobs()
public void dispose()
dispose in interface org.eclipse.jface.viewers.IContentProviderIContentProvider.dispose()
void findFiles(java.lang.Object parent,
org.eclipse.core.runtime.IProgressMonitor monitor)
IResourceProxyVisitor to fine files.
parent - Input to be searched for files.monitor - used to determine if the job has been canceled.public java.lang.Object[] getElements(java.lang.Object parent)
IFile resources for the selected input.
When the input is new/unknown, this is nota a direct request in that
this method actually returns an empty array. The real processing
is packaged in a job that uses an IResourceProxyVisitor
that walks the input resource tree to find IFile resources.
When the parent parameter represents the current input then
the existing array is returned to avoid re-walking the resource tree for
a simple sort request.
getElements in interface org.eclipse.jface.viewers.IStructuredContentProviderIStructuredContentProvider.getElements(java.lang.Object)public int getElementsLength()
IFile elements.
public void inputChanged(org.eclipse.jface.viewers.Viewer viewer,
java.lang.Object oldInput,
java.lang.Object newInput)
inputChanged in interface org.eclipse.jface.viewers.IContentProviderIContentProvider.inputChanged(org.eclipse.jface.viewers.Viewer,
java.lang.Object, java.lang.Object)public void resetTimestampRange()
public void resourceChanged(org.eclipse.core.resources.IResourceChangeEvent event)
IResourceChangeListener includes a minor optimization
so that viewer refresh requests are only sent when files that are in the viewer have
actually changed.
resourceChanged in interface org.eclipse.core.resources.IResourceChangeListenerIResourceChangeListener.resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)