Package org.eclipse.compare
Class CompareViewerPane
- java.lang.Object
-
- org.eclipse.swt.widgets.Widget
-
- org.eclipse.swt.widgets.Control
-
- org.eclipse.swt.widgets.Scrollable
-
- org.eclipse.swt.widgets.Composite
-
- org.eclipse.swt.custom.ViewForm
-
- org.eclipse.compare.CompareViewerPane
-
- All Implemented Interfaces:
IAdaptable,IDoubleClickListener,IOpenListener,ISelectionChangedListener,ISelectionProvider,Drawable
- Direct Known Subclasses:
CompareViewerSwitchingPane
public class CompareViewerPane extends ViewForm implements ISelectionProvider, IDoubleClickListener, ISelectionChangedListener, IOpenListener, IAdaptable
ACompareViewerPaneis a convenience class which installs aCLabeland aToolbarin aViewForm.Double clicking onto the
CompareViewerPane's title bar maximizes theCompareViewerPaneto the size of an enclosingSplitter(if there is one). If moreSplittersare nested maximizing walks up and maximizes to the outermostSplitter.- Since:
- 2.0
-
-
Field Summary
-
Fields inherited from class org.eclipse.swt.custom.ViewForm
borderInsideRGB, borderMiddleRGB, borderOutsideRGB, horizontalSpacing, marginHeight, marginWidth, verticalSpacing
-
-
Constructor Summary
Constructors Constructor Description CompareViewerPane(Composite container, int style)Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDoubleClickListener(IDoubleClickListener listener)Add a double-click listener to the pane.voidaddOpenListener(IOpenListener listener)Add an open listener to the pane.voidaddSelectionChangedListener(ISelectionChangedListener l)Adds a listener for selection changes in this selection provider.static voidclearToolBar(Composite parent)Clears tool items in theCompareViewerPane's control bar.protected ControlcreateTopLeft(Composite parent)voiddoubleClick(DoubleClickEvent event)Notifies of a double click.<T> TgetAdapter(Class<T> adapter)Returns an object which is an instance of the given class associated with this object.ObjectgetInput()Returns the current input of this pane or null if the pane has no input.ISelectiongetSelection()Returns the current selection for this provider.static ToolBarManagergetToolBarManager(Composite parent)Returns aToolBarManagerif the given parent is aCompareViewerPaneornullotherwise.voidopen(OpenEvent event)Notifies of an open event.voidremoveDoubleClickListener(IDoubleClickListener listener)Remove a double-click listener.voidremoveOpenListener(IOpenListener listener)Remove an open listener.voidremoveSelectionChangedListener(ISelectionChangedListener l)Removes the given selection change listener from this selection provider.voidselectionChanged(SelectionChangedEvent ev)Notifies that the selection has changed.voidsetImage(Image image)Set the pane's title Image.voidsetInput(Object input)Sets the input object of this pane.voidsetSelection(ISelection s)Sets the current selection for this selection provider.voidsetText(String label)Set the pane's title text.-
Methods inherited from class org.eclipse.swt.custom.ViewForm
computeTrim, getClientArea, getContent, getTopCenter, getTopLeft, getTopRight, setBorderVisible, setContent, setLayout, setTopCenter, setTopCenterSeparate, setTopLeft, setTopRight
-
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayoutDeferred, setTabList
-
Methods inherited from class org.eclipse.swt.widgets.Scrollable
getHorizontalBar, getScrollbarsMode, getVerticalBar
-
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
-
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.swt.graphics.Drawable
isAutoScalable
-
-
-
-
Constructor Detail
-
CompareViewerPane
public CompareViewerPane(Composite container, int style)
Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.- Parameters:
container- a widget which will be the container of the new instance (cannot be null)style- the style of widget to construct- Throws:
IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the parent is null
SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
-
-
Method Detail
-
createTopLeft
protected Control createTopLeft(Composite parent)
- Parameters:
parent- a widget which will be the parent of the control (cannot be null)- Returns:
- the control to be placed in the top left corner of the pane
- 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.
-
setText
public void setText(String label)
Set the pane's title text. The valuenullclears it.- Parameters:
label- the text to be displayed in the pane or null
-
setImage
public void setImage(Image image)
Set the pane's title Image. The valuenullclears it.- Parameters:
image- the image to be displayed in the pane or null
-
getToolBarManager
public static ToolBarManager getToolBarManager(Composite parent)
Returns aToolBarManagerif the given parent is aCompareViewerPaneornullotherwise.- Parameters:
parent- aCompositeornull- Returns:
- a
ToolBarManagerif the given parent is aCompareViewerPaneotherwisenull
-
clearToolBar
public static void clearToolBar(Composite parent)
Clears tool items in theCompareViewerPane's control bar.- Parameters:
parent- aCompositeornull
-
getInput
public Object getInput()
Returns the current input of this pane or null if the pane has no input.- Returns:
- an
Objectthat is the input to this pane or null if the pane has no input. - Since:
- 3.3
-
setInput
public void setInput(Object input)
Sets the input object of this pane.- Parameters:
input- the new input object ornull- Since:
- 3.3
-
addSelectionChangedListener
public void addSelectionChangedListener(ISelectionChangedListener l)
Description copied from interface:ISelectionProviderAdds a listener for selection changes in this selection provider. Has no effect if an identical listener is already registered.- Specified by:
addSelectionChangedListenerin interfaceISelectionProvider- Parameters:
l- a selection changed listener
-
removeSelectionChangedListener
public void removeSelectionChangedListener(ISelectionChangedListener l)
Description copied from interface:ISelectionProviderRemoves the given selection change listener from this selection provider. Has no effect if an identical listener is not registered.- Specified by:
removeSelectionChangedListenerin interfaceISelectionProvider- Parameters:
l- a selection changed listener
-
getSelection
public ISelection getSelection()
Description copied from interface:ISelectionProviderReturns the current selection for this provider.- Specified by:
getSelectionin interfaceISelectionProvider- Returns:
- the current selection
-
setSelection
public void setSelection(ISelection s)
Description copied from interface:ISelectionProviderSets the current selection for this selection provider.- Specified by:
setSelectionin interfaceISelectionProvider- Parameters:
s- the new selection
-
selectionChanged
public void selectionChanged(SelectionChangedEvent ev)
Description copied from interface:ISelectionChangedListenerNotifies that the selection has changed.- Specified by:
selectionChangedin interfaceISelectionChangedListener- Parameters:
ev- event object describing the change
-
doubleClick
public void doubleClick(DoubleClickEvent event)
Description copied from interface:IDoubleClickListenerNotifies of a double click.- Specified by:
doubleClickin interfaceIDoubleClickListener- Parameters:
event- event object describing the double-click
-
addDoubleClickListener
public void addDoubleClickListener(IDoubleClickListener listener)
Add a double-click listener to the pane. The listener will get invoked when the contents of the pane are double-clicked. Adding a listener that is already registered has no effect.- Parameters:
listener- the listener- Since:
- 3.3
-
removeDoubleClickListener
public void removeDoubleClickListener(IDoubleClickListener listener)
Remove a double-click listener. Removing a listener that is not registered has no effect.- Parameters:
listener- the listener- Since:
- 3.3
-
addOpenListener
public void addOpenListener(IOpenListener listener)
Add an open listener to the pane. The listener will get invoked when the contents of the pane are double-clicked. Adding a listener that is already registered has no effect.- Parameters:
listener- the listener- Since:
- 3.3
-
removeOpenListener
public void removeOpenListener(IOpenListener listener)
Remove an open listener. Removing a listener that is not registered has no effect.- Parameters:
listener- the listener- Since:
- 3.3
-
open
public void open(OpenEvent event)
Description copied from interface:IOpenListenerNotifies of an open event.- Specified by:
openin interfaceIOpenListener- Parameters:
event- event object describing the open event
-
getAdapter
public <T> T getAdapter(Class<T> adapter)
Description copied from interface:IAdaptableReturns an object which is an instance of the given class associated with this object. Returnsnullif no such object can be found.Clients may implement this method but should generally call
Adapters.adapt(Object, Class, boolean)rather than invoking it directly.- Specified by:
getAdapterin interfaceIAdaptable- Type Parameters:
T- the class type- Parameters:
adapter- the adapter class to look up- Returns:
- a object of the given class,
or
nullif this object does not have an adapter for the given class
-
-