com.ibm.commons.swt.viewers
Class AbstractDeferredViewer

java.lang.Object
  extended by org.eclipse.jface.viewers.Viewer
      extended by com.ibm.commons.swt.viewers.AbstractDeferredViewer
All Implemented Interfaces:
com.ibm.commons.swt.viewers.JobCompletedCallback, org.eclipse.jface.viewers.IInputProvider, org.eclipse.jface.viewers.IInputSelectionProvider, org.eclipse.jface.viewers.ISelectionProvider
Direct Known Subclasses:
DCComboBoxDeferredViewer

public abstract class AbstractDeferredViewer
extends org.eclipse.jface.viewers.Viewer
implements com.ibm.commons.swt.viewers.JobCompletedCallback

This class is used in conjunction with com.ibm.commons.swt.viewers.AbstractDeferredContentProvider. This viewer should be used where the contents of the viewer require a long running operation to be performed in order to populate the contents of the viewer (for instance retrieving the list of views from an application on a server).


Field Summary
 
Fields inherited from class org.eclipse.jface.viewers.Viewer
WIDGET_DATA_KEY
 
Constructor Summary
AbstractDeferredViewer()
          Constructs a new instance of the class.
AbstractDeferredViewer(java.lang.String dialogErrorTitle)
          Constructs a new instance of this class.
 
Method Summary
 void dispose()
           
protected abstract  void doUpdateControl(java.lang.Object results)
          Update the control with the results of the deferred data.
 org.eclipse.jface.viewers.IStructuredContentProvider getContentProvider()
           
abstract  org.eclipse.swt.widgets.Control getControl()
           
protected  java.lang.String getErrorDialogTitle()
          Return a string that can be used in the dialog title of any error messages launched by this viewer.
 java.lang.Object getInput()
           
 org.eclipse.jface.viewers.ILabelProvider getLabelProvider()
           
 org.eclipse.jface.viewers.ISelection getSelection()
           
protected static void getStackTraceAsMultiStatus(java.lang.Throwable t, org.eclipse.core.runtime.MultiStatus multiStatus)
           
 org.eclipse.core.runtime.IStatus getStatus()
           
 java.lang.Runnable getUpdateCallback()
          Value set the application.
protected  void hookControl()
           
 void jobCompleted(java.lang.Object results)
          Called by the content provider with the results of a completed job.
abstract  void refresh()
           
 void setContentProvider(org.eclipse.jface.viewers.IStructuredContentProvider contentProvider)
           
 void setInput(java.lang.Object input)
           
protected  void setInputOnly(java.lang.Object input)
          Set the input object w/o refreshing or any other side effects.
 void setLabelProvider(org.eclipse.jface.viewers.ILabelProvider labelProvider)
           
 void setSelection(org.eclipse.jface.viewers.ISelection selection, boolean reveal)
           
protected  void setStatus(org.eclipse.core.runtime.IStatus status)
          Set the deferred status of the combo box.
 void setUpdateCallback(java.lang.Runnable run)
          Allows an application to do some extra processing after values are received from the content provider and put into the control.
 void updateStatus()
          Update the ui in regards to any deferred status messages that are pending or that have been cleared.
 
Methods inherited from class org.eclipse.jface.viewers.Viewer
addHelpListener, addSelectionChangedListener, fireHelpRequested, fireSelectionChanged, getData, handleHelpRequest, inputChanged, removeHelpListener, removeSelectionChangedListener, scrollDown, scrollUp, setData, setSelection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDeferredViewer

public AbstractDeferredViewer(java.lang.String dialogErrorTitle)
Constructs a new instance of this class.

Parameters:
dialogErrorTitle - String A string that is later used as a title for any error dialogs which may be forced to appear for any operations that is run to retrieve the elements in the deferred content provider.

AbstractDeferredViewer

public AbstractDeferredViewer()
Constructs a new instance of the class.

Method Detail

hookControl

protected void hookControl()

getInput

public java.lang.Object getInput()
Specified by:
getInput in interface org.eclipse.jface.viewers.IInputProvider
Specified by:
getInput in class org.eclipse.jface.viewers.Viewer

setInput

public void setInput(java.lang.Object input)
Specified by:
setInput in class org.eclipse.jface.viewers.Viewer

setInputOnly

protected void setInputOnly(java.lang.Object input)
Set the input object w/o refreshing or any other side effects.

Parameters:
input -

getSelection

public org.eclipse.jface.viewers.ISelection getSelection()
Specified by:
getSelection in interface org.eclipse.jface.viewers.ISelectionProvider
Specified by:
getSelection in class org.eclipse.jface.viewers.Viewer

setSelection

public void setSelection(org.eclipse.jface.viewers.ISelection selection,
                         boolean reveal)
Specified by:
setSelection in class org.eclipse.jface.viewers.Viewer

getContentProvider

public org.eclipse.jface.viewers.IStructuredContentProvider getContentProvider()

setContentProvider

public void setContentProvider(org.eclipse.jface.viewers.IStructuredContentProvider contentProvider)

setLabelProvider

public void setLabelProvider(org.eclipse.jface.viewers.ILabelProvider labelProvider)
Parameters:
labelProvider -

getLabelProvider

public org.eclipse.jface.viewers.ILabelProvider getLabelProvider()

updateStatus

public void updateStatus()
Update the ui in regards to any deferred status messages that are pending or that have been cleared.


getErrorDialogTitle

protected java.lang.String getErrorDialogTitle()
Return a string that can be used in the dialog title of any error messages launched by this viewer. Typically, a product name may be appropriate.


getStackTraceAsMultiStatus

protected static void getStackTraceAsMultiStatus(java.lang.Throwable t,
                                                 org.eclipse.core.runtime.MultiStatus multiStatus)

setStatus

protected void setStatus(org.eclipse.core.runtime.IStatus status)
Set the deferred status of the combo box.

Parameters:
status -

getStatus

public org.eclipse.core.runtime.IStatus getStatus()
Returns:
current deferred status of the combo box.

setUpdateCallback

public void setUpdateCallback(java.lang.Runnable run)
Allows an application to do some extra processing after values are received from the content provider and put into the control.

Parameters:
callback -

getUpdateCallback

public java.lang.Runnable getUpdateCallback()
Value set the application. There is no default value.

Returns:
Runnable

getControl

public abstract org.eclipse.swt.widgets.Control getControl()
Specified by:
getControl in class org.eclipse.jface.viewers.Viewer

refresh

public abstract void refresh()
Specified by:
refresh in class org.eclipse.jface.viewers.Viewer

jobCompleted

public void jobCompleted(java.lang.Object results)
Called by the content provider with the results of a completed job.

Specified by:
jobCompleted in interface com.ibm.commons.swt.viewers.JobCompletedCallback
Parameters:
results - - This viewer expects results to be an array of Strings (String[]).

doUpdateControl

protected abstract void doUpdateControl(java.lang.Object results)
Update the control with the results of the deferred data. This method is called when the content provider completes and sends its data to the viewer.

Parameters:
results -

dispose

public void dispose()