RSE
Release 1.0

org.eclipse.rse.ui.view
Class SystemViewLabelAndContentProvider

java.lang.Object
  extended byorg.eclipse.core.commands.common.EventManager
      extended byorg.eclipse.jface.viewers.LabelProvider
          extended byorg.eclipse.rse.ui.view.SystemViewLabelAndContentProvider
All Implemented Interfaces:
IBaseLabelProvider, IContentProvider, ILabelProvider, IStructuredContentProvider, ITableLabelProvider, ITreeContentProvider

public class SystemViewLabelAndContentProvider
extends LabelProvider
implements ITreeContentProvider, ILabelProvider, ITableLabelProvider

Provides tree contents for objects that have the ISystemViewElement adapter registered. Also provides label contents, so can be used for both a content and label provider for TreeViewers.

This has a general flavour, which is used in most cases, and also has a specialized flavour for universal file systems, which allows restricting the list to files only or folders only. It also allows further subsetting by setting an input filter or filterstring.


Field Summary
protected  Viewer viewer
           
 
Constructor Summary
SystemViewLabelAndContentProvider()
          Constructor
SystemViewLabelAndContentProvider(boolean foldersOnly, boolean filesOnly)
          Constructor to restrict to remote folders or files
 
Method Summary
 void cancelJobs(Object location)
          Cancel any jobs that are fetching content from the given location.
protected  ImageDescriptor decorateImage(ImageDescriptor input, Object element)
          Returns an image descriptor that is based on the given descriptor, but decorated with additional information relating to the state of the provided object.
protected  String decorateText(String input, Object element)
          Returns a label that is based on the given label, but decorated with additional information relating to the state of the provided object.
 void dispose()
          The visual part that is using this content provider is about to be disposed.
 void flushCache()
          Flush the in-memory cache which remembers the result of the last getChildren request when we are in files-only or folders-only mode.
protected  ISystemViewElementAdapter getAdapter(Object o)
          Returns the implementation of ISystemViewElement for the given object.
 Object[] getChildren(Object element)
           
 Image getColumnImage(Object element, int columnIndex)
           
 String getColumnText(Object element, int columnIndex)
           
 Object[] getElements(Object element)
           
 String getFilterString()
          Get the current filter string being used to subset the list by.
 Image getImage(Object element)
           
 Object getParent(Object element)
           
 String getText(Object element)
          Returns the label text for the given object.
 Viewer getViewer()
          Return the current viewer we are associated with
 boolean hasChildren(Object element)
          hasChildren method comment.
 void inputChanged(Viewer viewer, Object oldInput, Object newInput)
          inputChanged method comment.
 void setFilterString(String filterString)
          Set a filter string to subset the list by.
protected  boolean supportsDeferredQueries()
           
 
Methods inherited from class org.eclipse.jface.viewers.LabelProvider
addListener, fireLabelProviderChanged, isLabelProperty, removeListener
 
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.jface.viewers.IBaseLabelProvider
addListener, isLabelProperty, removeListener
 

Field Detail

viewer

protected Viewer viewer
Constructor Detail

SystemViewLabelAndContentProvider

public SystemViewLabelAndContentProvider()
Constructor


SystemViewLabelAndContentProvider

public SystemViewLabelAndContentProvider(boolean foldersOnly,
                                         boolean filesOnly)
Constructor to restrict to remote folders or files

Method Detail

setFilterString

public void setFilterString(String filterString)
Set a filter string to subset the list by. For example, "A*.java" or "java,class," Only valid if filesOnly or foldersOnly mode. If the latter, its recorded and used the next time files are requested from any folder.


getFilterString

public String getFilterString()
Get the current filter string being used to subset the list by. Will be null unless setFilterString has previously been called.


flushCache

public void flushCache()
Flush the in-memory cache which remembers the result of the last getChildren request when we are in files-only or folders-only mode. Only applies when the two-boolean constructor is used.


getViewer

public Viewer getViewer()
Return the current viewer we are associated with


dispose

public void dispose()
The visual part that is using this content provider is about to be disposed. Deallocate all allocated SWT resources.

Specified by:
dispose in interface IContentProvider

getAdapter

protected ISystemViewElementAdapter getAdapter(Object o)
Returns the implementation of ISystemViewElement for the given object. Returns null if the adapter is not defined or the object is not adaptable.


cancelJobs

public void cancelJobs(Object location)
Cancel any jobs that are fetching content from the given location.

Parameters:
location -

supportsDeferredQueries

protected boolean supportsDeferredQueries()

getChildren

public Object[] getChildren(Object element)
Specified by:
getChildren in interface ITreeContentProvider
See Also:
ITreeContentProvider

getElements

public Object[] getElements(Object element)
Specified by:
getElements in interface IStructuredContentProvider
See Also:
ITreeContentProvider

getParent

public Object getParent(Object element)
Specified by:
getParent in interface ITreeContentProvider
See Also:
ITreeContentProvider

hasChildren

public boolean hasChildren(Object element)
hasChildren method comment. This method has been optimized over its original code so that we don't actually retrieve all the children (horrors!) just to decide if it has children. For performance reasons we just assume if it can have children it does. That means we always get a plus but that is way better than a very slow remote system query just to decide if we want a plus or not!

Specified by:
hasChildren in interface ITreeContentProvider

inputChanged

public void inputChanged(Viewer viewer,
                         Object oldInput,
                         Object newInput)
inputChanged method comment. AS LONG AS WE DON'T SUPPORT IWORKSPACE OBJECT THIS IS NOT NEEDED. WE LEAVE IT IN BECAUSE IT IS HARMLESS AND MIGHT BE OF VALUE SOMEDAY.

Specified by:
inputChanged in interface IContentProvider

getColumnImage

public Image getColumnImage(Object element,
                            int columnIndex)
Specified by:
getColumnImage in interface ITableLabelProvider

getColumnText

public String getColumnText(Object element,
                            int columnIndex)
Specified by:
getColumnText in interface ITableLabelProvider

getImage

public Image getImage(Object element)
Specified by:
getImage in interface ILabelProvider

getText

public String getText(Object element)
Returns the label text for the given object.

Specified by:
getText in interface ILabelProvider

decorateImage

protected ImageDescriptor decorateImage(ImageDescriptor input,
                                        Object element)
Returns an image descriptor that is based on the given descriptor, but decorated with additional information relating to the state of the provided object. Subclasses may reimplement this method to decorate an object's image.

See Also:
ImageDescriptor

decorateText

protected String decorateText(String input,
                              Object element)
Returns a label that is based on the given label, but decorated with additional information relating to the state of the provided object. Subclasses may implement this method to decorate an object's label.


RSE
Release 1.0

Copyright (c) IBM Corporation and others 2000, 2006. All Rights Reserved.