public class DefaultHighlighterProvider extends java.lang.Object implements IHighlighterProvider
IHighlighterProvider
interface.
This class registers a paint listener on the control and highlights the
content specified by the IContentDescriptor
interface. The
clients should override the getBounds(Object)
and
getVisibleParentBounds(Object)
methods. This class draws a
rectangle if the highlighting style is HighlightStyle.EXISTING
and a line when the style is HighlightStyle.MISSING
IHighlighterProvider
Constructor and Description |
---|
DefaultHighlighterProvider(org.eclipse.swt.widgets.Control control,
IContentViewerPane pane)
Constructs a new DefaultHighlighterProvider
|
DefaultHighlighterProvider(org.eclipse.swt.widgets.Control control,
IContentViewerPane pane,
boolean shouldListenersBeRegistered)
Constructs a new DefaultHighlighterProvider
|
Modifier and Type | Method and Description |
---|---|
void |
addHighlightingListener(IHighlightingListener listener)
Adds a listener for highlighting changes.
|
void |
clear(java.util.EventObject causingEvent)
The provider clears all the highlighting capabilities on the viewer until
the next call to the method
setHighlightingInfo . |
protected org.eclipse.swt.graphics.Rectangle |
getBounds(boolean displayRelative,
boolean walkUpRecursively)
Returns the bounds for the current content descriptor.
|
protected org.eclipse.swt.graphics.Rectangle |
getBounds(java.lang.Object object)
Returns the bounds of the specified object within the control.
|
protected org.eclipse.swt.widgets.Control |
getControl()
Returns the parent control
|
protected IContentDescriptor |
getDescriptor()
Returns the descriptor
|
IContentDescriptor |
getHighlightingInfo()
Returns the current content descriptor used for highlighting purposes.
|
protected org.eclipse.core.runtime.ListenerList |
getHighlightingListeners()
Returns the highlighting listeners
|
org.eclipse.swt.graphics.Point |
getLeftAnchor(boolean displayRelative)
Returns the location where the connect should be anchored on the left
side of the content viewer pane.
|
org.eclipse.swt.graphics.Point |
getRightAnchor(boolean displayRelative)
Returns the location where the connect should be anchored on the right
side of the content viewer pane.
|
protected org.eclipse.swt.graphics.Rectangle |
getVisibleParentBounds(java.lang.Object object)
Returns the bounds of the immediate visible parent of the specified
object within the control.
|
void |
highlight(java.util.EventObject causingEvent)
The provider highlights the viewer based on current the content
descriptor information and notifies the listeners
|
protected boolean |
isEmpty(org.eclipse.swt.graphics.Rectangle bounds)
Returns
true if the specified bounds is null or the values
of the rectangle are zero |
protected boolean |
isPaintListenerRegistered()
Returns if paint listener is registered
|
protected void |
notifyClear(java.util.EventObject event)
Notifies the highlighting listeners
|
protected void |
notifyHighlight(java.util.EventObject event)
Notifies the highlighting listeners
|
protected void |
paintControl(org.eclipse.swt.events.PaintEvent event)
Paints the control
|
protected void |
registerListeners()
Registers listeners with the control
|
void |
removeHighlightingListener(IHighlightingListener listener)
Removes a listener for highlighting changes.
|
void |
setHighlightingInfo(IContentDescriptor descriptor)
Sets the current content descriptor for highlighting purposes.
|
protected void |
setStatusLineMessage(java.lang.String message)
Set message on the status line
|
protected void |
unregisterListeners()
Unregister listeners with the control
|
public DefaultHighlighterProvider(org.eclipse.swt.widgets.Control control, IContentViewerPane pane, boolean shouldListenersBeRegistered)
control
- the controlpane
- the associated paneshouldListenersBeRegistered
- the flag to indicate whether listeners should be registeredpublic DefaultHighlighterProvider(org.eclipse.swt.widgets.Control control, IContentViewerPane pane)
control
- the controlpane
- the associated paneprotected org.eclipse.swt.graphics.Rectangle getBounds(java.lang.Object object)
protected org.eclipse.swt.graphics.Rectangle getVisibleParentBounds(java.lang.Object object)
protected final org.eclipse.swt.widgets.Control getControl()
protected final org.eclipse.swt.graphics.Rectangle getBounds(boolean displayRelative, boolean walkUpRecursively)
displayRelative
- relative to the displaywalkUpRecursively
- flag to get the visible parent if emptypublic void highlight(java.util.EventObject causingEvent)
IHighlighterProvider
highlight
in interface IHighlighterProvider
causingEvent
- the event that is requesting the highlighting to occurIHighlighterProvider.highlight(java.util.EventObject)
public void setHighlightingInfo(IContentDescriptor descriptor)
IHighlighterProvider
IContentViewerPane
. The descriptor
contains the current delta/conflict object(s) to be used and the
highlighting stylesetHighlightingInfo
in interface IHighlighterProvider
descriptor
- the content descriptorIHighlighterProvider.setHighlightingInfo(com.ibm.xtools.comparemerge.ui.utils.IContentDescriptor)
protected final IContentDescriptor getDescriptor()
protected void paintControl(org.eclipse.swt.events.PaintEvent event)
event
- the paint eventprotected final boolean isPaintListenerRegistered()
public final IContentDescriptor getHighlightingInfo()
IHighlighterProvider
getHighlightingInfo
in interface IHighlighterProvider
null
if noneIHighlighterProvider.getHighlightingInfo()
public final void addHighlightingListener(IHighlightingListener listener)
IHighlighterProvider
addHighlightingListener
in interface IHighlighterProvider
listener
- a highlighting listenerIHighlighterProvider.addHighlightingListener(com.ibm.xtools.comparemerge.ui.listeners.IHighlightingListener)
public final void removeHighlightingListener(IHighlightingListener listener)
IHighlighterProvider
removeHighlightingListener
in interface IHighlighterProvider
listener
- a highlighting listenerIHighlighterProvider.removeHighlightingListener(com.ibm.xtools.comparemerge.ui.listeners.IHighlightingListener)
protected final org.eclipse.core.runtime.ListenerList getHighlightingListeners()
protected final void notifyHighlight(java.util.EventObject event)
event
- the event that caused the highlighting to occurprotected final void notifyClear(java.util.EventObject event)
event
- the event that caused the highlighting to clearprotected final boolean isEmpty(org.eclipse.swt.graphics.Rectangle bounds)
true
if the specified bounds is null or the values
of the rectangle are zerobounds
- the boundstrue
if emptyprotected final void setStatusLineMessage(java.lang.String message)
message
- the messagepublic org.eclipse.swt.graphics.Point getLeftAnchor(boolean displayRelative)
IHighlighterProvider
getLeftAnchor
in interface IHighlighterProvider
displayRelative
- a boolean flag to indicate if the returned point needs to be
relative to the control's display
(org.eclipse.swt.widgets.Display)IHighlighterProvider.getLeftAnchor(boolean)
public org.eclipse.swt.graphics.Point getRightAnchor(boolean displayRelative)
IHighlighterProvider
getRightAnchor
in interface IHighlighterProvider
displayRelative
- a boolean flag to indicate if the returned point needs to be
relative to the control's display
(org.eclipse.swt.widgets.Display)IHighlighterProvider.getRightAnchor(boolean)
public void clear(java.util.EventObject causingEvent)
IHighlighterProvider
setHighlightingInfo
. The
provider notifies the listenersclear
in interface IHighlighterProvider
causingEvent
- the event that is requesting the highlighting to stopIHighlighterProvider.clear(java.util.EventObject)
protected void registerListeners()
protected void unregisterListeners()