Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.team.ui.synchronize
Class AbstractSynchronizeLabelProvider

java.lang.Object
  extended by 
org.eclipse.team.ui.synchronize.AbstractSynchronizeLabelProvider
All Implemented Interfaces:
IBaseLabelProvider, ILabelProvider
Direct Known Subclasses:
SynchronizationLabelProvider

public abstract class AbstractSynchronizeLabelProvider
extends Object
implements ILabelProvider

A label provider wrapper that adds synchronization image and/or text decorations to the image and label obtained from the delegate provider.

Since:
3.2

Constructor Summary
AbstractSynchronizeLabelProvider ()
           
 
Method Summary
 void addListener ( ILabelProviderListener listener)
          Adds a listener to this label provider.
protected   Image decorateImage ( Image base, Object element)
          Decorate the image with the appropriate diff decorations.
protected   String decorateText ( String base, Object element)
          Decorate the text with the appropriate diff decorations.
 void dispose ()
          Disposes of this label provider.
protected   Image getDelegateImage ( Object element)
          Return the image for the item from the delegate label provider.
protected abstract   ILabelProvider getDelegateLabelProvider ()
          Return the label provider that will return the text and image appropriate for the given model element.
protected   String getDelegateText ( Object element)
          Obtain the text for the object from the delegate label provider.
protected   IDiff getDiff ( Object element)
          Return the sync kind of the given element.
  Font getFont ( Object element)
          Method that provides a custom font for elements that are busy.
  Image getImage ( Object element)
          Returns the image for the label of the given element.
protected  int getMarkerSeverity ( Object element)
          Return the marker severity (one of IMarker.SEVERITY_ERROR or IMarker.SEVERITY_WARNING) to be overlayed on the given element or -1 if there are no markers.
  String getText ( Object element)
          Returns the text for the label of the given element.
protected  boolean hasDecendantConflicts ( Object element)
          Return whether the given element has descendant conflicts.
protected  boolean isBusy ( Object element)
          Return whether the given element is busy (i.e. is involved in an operation.
protected abstract  boolean isDecorationEnabled ()
          Return whether the label provider should decorate with the synchronization state.
protected  boolean isIncludeOverlays ()
          Indicate whether the overlays provided by this class should be applied.
 boolean isLabelProperty ( Object element, String property)
          Returns whether the label would be affected by a change to the given property of the given element.
protected  boolean isSyncInfoInTextEnabled ()
          Returns whether the synchronization state should be included in the text of the label.
 void removeListener ( ILabelProviderListener listener)
          Removes a listener to this label provider.
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractSynchronizeLabelProvider

public AbstractSynchronizeLabelProvider()
Method Detail

getImage

public 
Image getImage(
Object element)
Description copied from interface: ILabelProvider
Returns the image for the label of the given element. The image is owned by the label provider and must not be disposed directly. Instead, dispose the label provider when no longer needed.

Specified by:
getImage in interface ILabelProvider
Parameters:
element - the element for which to provide the label image
Returns:
the image used to label the element, or null if there is no image for the given object

decorateImage

protected 
Image decorateImage(
Image base,
                              
Object element)
Decorate the image with the appropriate diff decorations. By default, this method uses the diff associated with the given element to determine how to decorate the image. It then uses the CompareConfiguration.getImage(Image, int) method to apply the decoration to the base image.

Parameters:
base - the base image to be decorated.
element - the element
Returns:
the image decorated appropriately using the diff associated with the element
See Also:
getDiff(Object), CompareConfiguration.getImage(Image, int)

getDelegateImage

protected 
Image getDelegateImage(
Object element)
Return the image for the item from the delegate label provider.

Parameters:
element - the element
Returns:
the image for the item from the delegate label provider

getText

public 
String getText(
Object element)
Description copied from interface: ILabelProvider
Returns the text for the label of the given element.

Specified by:
getText in interface ILabelProvider
Parameters:
element - the element for which to provide the label text
Returns:
the text string used to label the element, or null if there is no text label for the given object

getDelegateText

protected 
String getDelegateText(
Object element)
Obtain the text for the object from the delegate label provider.

Parameters:
element - the element
Returns:
the text label for the element

decorateText

protected 
String decorateText(
String base,
                              
Object element)
Decorate the text with the appropriate diff decorations. By default, this method uses the diff associated with the given element to determine how to decorate the text.

Parameters:
base - the base text to be decorated.
element - the element
Returns:
the text decorated appropriately using the diff associated with the element
See Also:
getDiff(Object)

addListener

public void addListener(
ILabelProviderListener listener)
Description copied from interface: IBaseLabelProvider
Adds a listener to this label provider. Has no effect if an identical listener is already registered.

Label provider listeners are informed about state changes that affect the rendering of the viewer that uses this label provider.

Specified by:
addListener in interface IBaseLabelProvider
Parameters:
listener - a label provider listener

dispose

public void dispose()
Description copied from interface: IBaseLabelProvider
Disposes of this label provider. When a label provider is attached to a viewer, the viewer will automatically call this method when the viewer is being closed. When label providers are used outside of the context of a viewer, it is the client's responsibility to ensure that this method is called when the provider is no longer needed.

Specified by:
dispose in interface IBaseLabelProvider

isLabelProperty

public boolean isLabelProperty(
Object element,
                               
String property)
Description copied from interface: IBaseLabelProvider
Returns whether the label would be affected by a change to the given property of the given element. This can be used to optimize a non-structural viewer update. If the property mentioned in the update does not affect the label, then the viewer need not update the label.

Specified by:
isLabelProperty in interface IBaseLabelProvider
Parameters:
element - the element
property - the property
Returns:
true if the label would be affected, and false if it would be unaffected

removeListener

public void removeListener(
ILabelProviderListener listener)
Description copied from interface: IBaseLabelProvider
Removes a listener to this label provider. Has no affect if an identical listener is not registered.

Specified by:
removeListener in interface IBaseLabelProvider
Parameters:
listener - a label provider listener

isSyncInfoInTextEnabled

protected boolean isSyncInfoInTextEnabled()
Returns whether the synchronization state should be included in the text of the label. By default, the Team preference is used to determine what to return. Subclasses may override.

Returns:
whether the synchronization state should be included in the text of the label

getDelegateLabelProvider

protected abstract 
ILabelProvider getDelegateLabelProvider()
Return the label provider that will return the text and image appropriate for the given model element. Subclasses are responsible for disposing of the label provider.

Returns:
the label provider that will return the text and image appropriate for the given model element

isDecorationEnabled

protected abstract boolean isDecorationEnabled()
Return whether the label provider should decorate with the synchronization state.

Returns:
whether the label provider should decorate with the synchronization state

getDiff

protected 
IDiff getDiff(
Object element)
Return the sync kind of the given element. This is used to determine how to decorate the image and label of the element. The sync kind is described in the SyncInfo class. A null is returned by default.

Parameters:
element - the element being tested
Returns:
the sync kind of the given element

isIncludeOverlays

protected boolean isIncludeOverlays()
Indicate whether the overlays provided by this class should be applied. By default, false is returned. Subclasses may override and control individual overlays by overriding the appropriate query methods. Overlays provided by this class include problem marker severity ( getMarkerSeverity(Object)), propagated conflicts ( hasDecendantConflicts(Object) and busy state ( isBusy(Object)).

Returns:
whether the overlays provided by this class should be applied

getMarkerSeverity

protected int getMarkerSeverity(
Object element)
Return the marker severity (one of IMarker.SEVERITY_ERROR or IMarker.SEVERITY_WARNING) to be overlayed on the given element or -1 if there are no markers. By Default, the element is adapted to resource mapping in order to look for markers.

Although this class handles providing the overlays, it does not react to marker changes. Subclasses must issue label updates when the markers on a logical model element change.

Parameters:
element - the element
Returns:
the marker severity

hasDecendantConflicts

protected boolean hasDecendantConflicts(
Object element)
Return whether the given element has descendant conflicts. By default, false is returned. Subclasses may override.

Parameters:
element - the element
Returns:
whether the given element has descendant conflicts

isBusy

protected boolean isBusy(
Object element)
Return whether the given element is busy (i.e. is involved in an operation. By default, false is returned. Subclasses may override.

Parameters:
element - the element
Returns:
whether the given element is busy

getFont

public 
Font getFont(
Object element)
Method that provides a custom font for elements that are busy. Although this label provider does not implement IFontProvider, subclasses that wish to get busy indication using a font can do so.

Parameters:
element - the element
Returns:
the font to indicate that the element is busy

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire