Eclipse Platform
Release 3.3

org.eclipse.compare
Class CompareViewerPane

java.lang.Object
  extended byorg.eclipse.swt.widgets.Widget
      extended byorg.eclipse.swt.widgets.Control
          extended byorg.eclipse.swt.widgets.Scrollable
              extended byorg.eclipse.swt.widgets.Composite
                  extended byorg.eclipse.swt.custom.ViewForm
                      extended byorg.eclipse.compare.CompareViewerPane
All Implemented Interfaces:
Drawable, IAdaptable, IDoubleClickListener, IOpenListener, ISelectionChangedListener, ISelectionProvider
Direct Known Subclasses:
CompareViewerSwitchingPane

public class CompareViewerPane
extends ViewForm
implements ISelectionProvider, IDoubleClickListener, ISelectionChangedListener, IOpenListener, IAdaptable

A CompareViewerPane is a convenience class which installs a CLabel and a Toolbar in a ViewForm.

Double clicking onto the CompareViewerPane's title bar maximizes the CompareViewerPane to the size of an enclosing Splitter (if there is one). If more Splitters are nested maximizing walks up and maximizes to the outermost Splitter.

Since:
2.0

Field Summary
 
Fields inherited from class org.eclipse.swt.custom.ViewForm
borderInsideRGB, borderMiddleRGB, borderOutsideRGB, horizontalSpacing, marginHeight, marginWidth, verticalSpacing
 
Fields inherited from class org.eclipse.swt.widgets.Control
handle
 
Constructor Summary
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
 void addDoubleClickListener(IDoubleClickListener listener)
          Add a double-click listener to the pane.
 void addOpenListener(IOpenListener listener)
          Add an open listener to the pane.
 void addSelectionChangedListener(ISelectionChangedListener l)
          Adds a listener for selection changes in this selection provider.
static void clearToolBar(Composite parent)
          Clears tool items in the CompareViewerPane's control bar.
 void doubleClick(DoubleClickEvent event)
          Notifies of a double click.
 Object getAdapter(Class adapter)
          Returns an object which is an instance of the given class associated with this object.
 Object getInput()
          Returns the current input of this pane or null if the pane has no input.
 ISelection getSelection()
          Returns the current selection for this provider.
static ToolBarManager getToolBarManager(Composite parent)
          Returns a ToolBarManager if the given parent is a CompareViewerPane or null otherwise.
 void open(OpenEvent event)
          Notifies of an open event.
 void removeDoubleClickListener(IDoubleClickListener listener)
          Remove a double-click listener.
 void removeOpenListener(IOpenListener listener)
          Remove an open listener.
 void removeSelectionChangedListener(ISelectionChangedListener l)
          Removes the given selection change listener from this selection provider.
 void selectionChanged(SelectionChangedEvent ev)
          Notifies that the selection has changed.
 void setImage(Image image)
          Set the pane's title Image.
 void setInput(Object input)
          Sets the input object of this pane.
 void setSelection(ISelection s)
          Sets the current selection for this selection provider.
 void setText(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, computeSize, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayoutDeferred, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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 -
SWTException -
Method Detail

setText

public void setText(String label)
Set the pane's title text. The value null clears 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 value null clears it.

Parameters:
image - the image to be displayed in the pane or null

getToolBarManager

public static ToolBarManager getToolBarManager(Composite parent)
Returns a ToolBarManager if the given parent is a CompareViewerPane or null otherwise.

Parameters:
parent - a Composite or null
Returns:
a ToolBarManager if the given parent is a CompareViewerPane otherwise null

clearToolBar

public static void clearToolBar(Composite parent)
Clears tool items in the CompareViewerPane's control bar.

Parameters:
parent - a Composite or null

getInput

public Object getInput()
Returns the current input of this pane or null if the pane has no input.

Returns:
an Object that 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 or null
Since:
3.3

addSelectionChangedListener

public void addSelectionChangedListener(ISelectionChangedListener l)
Description copied from interface: ISelectionProvider
Adds a listener for selection changes in this selection provider. Has no effect if an identical listener is already registered.

Specified by:
addSelectionChangedListener in interface ISelectionProvider
Parameters:
l - a selection changed listener

removeSelectionChangedListener

public void removeSelectionChangedListener(ISelectionChangedListener l)
Description copied from interface: ISelectionProvider
Removes the given selection change listener from this selection provider. Has no affect if an identical listener is not registered.

Specified by:
removeSelectionChangedListener in interface ISelectionProvider
Parameters:
l - a selection changed listener

getSelection

public ISelection getSelection()
Description copied from interface: ISelectionProvider
Returns the current selection for this provider.

Specified by:
getSelection in interface ISelectionProvider
Returns:
the current selection

setSelection

public void setSelection(ISelection s)
Description copied from interface: ISelectionProvider
Sets the current selection for this selection provider.

Specified by:
setSelection in interface ISelectionProvider
Parameters:
s - the new selection

selectionChanged

public void selectionChanged(SelectionChangedEvent ev)
Description copied from interface: ISelectionChangedListener
Notifies that the selection has changed.

Specified by:
selectionChanged in interface ISelectionChangedListener
Parameters:
ev - event object describing the change

doubleClick

public void doubleClick(DoubleClickEvent event)
Description copied from interface: IDoubleClickListener
Notifies of a double click.

Specified by:
doubleClick in interface IDoubleClickListener
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: IOpenListener
Notifies of an open event.

Specified by:
open in interface IOpenListener
Parameters:
event - event object describing the open event

getAdapter

public Object getAdapter(Class adapter)
Description copied from interface: IAdaptable
Returns an object which is an instance of the given class associated with this object. Returns null if no such object can be found.

Specified by:
getAdapter in interface IAdaptable
Parameters:
adapter - the adapter class to look up
Returns:
a object castable to the given class, or null if this object does not have an adapter for the given class

Eclipse Platform
Release 3.3

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2007. All rights reserved.