Class AbstractSynchronizeLabelProvider

    • 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
      • getCompareImage

        protected Image getCompareImage​(Image base,
                                        int compareKind)
        Returns an image showing the specified change kind applied to a given base image.
        Restriction:
        This method is not intended to be referenced by clients.
        Restriction:
        This method is not intended to be re-implemented or extended by clients.
      • 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
      • 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