|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ibm.commons.swt.viewers.AbstractDeferredContentProvider
public abstract class AbstractDeferredContentProvider
A content provider that can be used in conjunction with any viewer (that supports
org.eclipse.jface.viewers.IStructuredContentProvider
). This content provider is
best used for operations that require long running operations, such as network operations.
When the viewer calls getElements(Object)
a DeferredDataObject
is returned
by default. At the same time a Job is scheduled to perform the work required to populate
the contents of the viewer.
The Job to perform the work will call the abstract method doWork(Object, DeferredElements)
. Subclasses
must implement doWork(Object, DeferredElements)
. Viewers that use this ContentProvider must
implement com.ibm.commons.swt.viewers.JobCompletedCallback
preferrably they should extendcom.ibm.commons.swt.viewers.AbstractDeferredContentProvider
.
Once the work has been completed to provide the content, the viewer's
com.ibm.commons.swt.viewers.JobCompletedCallback.jobCompleted(Object)
method to refresh the
viewer in order to display the new content.
Nested Class Summary | |
---|---|
class |
AbstractDeferredContentProvider.DeferredElements
Data structure to return the results of a job to the caller. |
Constructor Summary | |
---|---|
AbstractDeferredContentProvider()
|
Method Summary | |
---|---|
void |
dispose()
Cancels any jobs that are running. |
abstract org.eclipse.core.runtime.IStatus |
doWork(java.lang.Object input,
AbstractDeferredContentProvider.DeferredElements output)
Do the work in getElements() by getting the elements and putting the results in the output parameter by calling the the setElemnts() method on output. Example:
Object[] results = .... |
java.lang.Object[] |
getElements(java.lang.Object inputElement)
Returns a DeferredElements object by default. |
abstract java.lang.String |
getJobDisplayName(java.lang.Object input)
|
void |
inputChanged(org.eclipse.jface.viewers.Viewer viewer,
java.lang.Object oldInput,
java.lang.Object newInput)
Format of input: String[0] = server name String[1] = database name String[2] = design element name String[3] = design element type (see defines) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractDeferredContentProvider()
Method Detail |
---|
public abstract java.lang.String getJobDisplayName(java.lang.Object input)
input
- - input passed to getElements().
public abstract org.eclipse.core.runtime.IStatus doWork(java.lang.Object input, AbstractDeferredContentProvider.DeferredElements output)
Object[] results = .... (code to retrieve results)
output.setElements(results);
input
- - input passed to getElements();output
- - update this reference with the results of the fetch
by calling its setElements() method.
public java.lang.Object[] getElements(java.lang.Object inputElement)
doWork(Object, DeferredElements)
method. Once the job is complete
com.ibm.commons.swt.viewers.JobCompletedCallback.jobCompleted(Object)
will be called
to notify the viewer that the fetched contents are available.
getElements
in interface org.eclipse.jface.viewers.IStructuredContentProvider
public void dispose()
dispose
in interface org.eclipse.jface.viewers.IContentProvider
public void inputChanged(org.eclipse.jface.viewers.Viewer viewer, java.lang.Object oldInput, java.lang.Object newInput)
inputChanged
in interface org.eclipse.jface.viewers.IContentProvider
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |