public abstract class CompareViewerSwitchingPane extends CompareViewerPane
CompareViewerPane
that supports dynamic viewer switching.
Clients must implement the viewer switching strategy by implementing
the getViewer(Viewer, Object)
method.
If a property with the name CompareUI.COMPARE_VIEWER_TITLE
is set
on the top level SWT control of a viewer, it is used as a title in the CompareViewerPane
's
title bar.
borderInsideRGB, borderMiddleRGB, borderOutsideRGB, horizontalSpacing, marginHeight, marginWidth, verticalSpacing
Constructor and Description |
---|
CompareViewerSwitchingPane(Composite parent,
int style)
Creates a
CompareViewerSwitchingPane as a child of the given parent and with the
specified SWT style bits. |
CompareViewerSwitchingPane(Composite parent,
int style,
boolean visibility)
Creates a
CompareViewerSwitchingPane as a child of the given parent and with the
specified SWT style bits. |
Modifier and Type | Method and Description |
---|---|
Object |
getAdapter(Class adapter)
Returns an object which is an instance of the given class
associated with this object.
|
ISelection |
getSelection()
Returns the current selection for this provider.
|
String |
getTitleArgument()
Returns the optional title argument that has been set with
setTitelArgument or null if no optional title
argument has been set. |
Viewer |
getViewer()
Returns the current viewer.
|
protected abstract Viewer |
getViewer(Viewer oldViewer,
Object input)
Returns a viewer which is able to display the given input.
|
protected boolean |
inputChanged(Object input) |
boolean |
isEmpty()
Returns
true if no viewer is installed or if the current viewer
is a NullViewer . |
boolean |
setFocus()
Causes the receiver to have the keyboard focus,
such that all keyboard events will be delivered to it.
|
void |
setInput(Object input)
Sets the input object of this pane.
|
void |
setSelection(ISelection s)
Sets the current selection for this selection provider.
|
void |
setTitleArgument(String argument)
Sets an additional and optional argument for the pane's title.
|
addDoubleClickListener, addOpenListener, addSelectionChangedListener, clearToolBar, createTopLeft, doubleClick, getInput, getToolBarManager, open, removeDoubleClickListener, removeOpenListener, removeSelectionChangedListener, selectionChanged, setImage, setText
computeTrim, getClientArea, getContent, getTopCenter, getTopLeft, getTopRight, setBorderVisible, setContent, setLayout, setTopCenter, setTopCenterSeparate, setTopLeft, setTopRight
changed, checkSubclass, computeSize, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setLayoutDeferred, setTabList
getHorizontalBar, getScrollbarsMode, getVerticalBar
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, 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, 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
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
public CompareViewerSwitchingPane(Composite parent, int style)
CompareViewerSwitchingPane
as a child of the given parent and with the
specified SWT style bits.parent
- a widget which will be the parent of the new instance (cannot be null)style
- the style of widget to constructIllegalArgumentException
- SWTException
- public CompareViewerSwitchingPane(Composite parent, int style, boolean visibility)
CompareViewerSwitchingPane
as a child of the given parent and with the
specified SWT style bits.parent
- a widget which will be the parent of the new instance (cannot be null)style
- the style of widget to constructvisibility
- the initial visibility of the CompareViewerSwitchingPaneIllegalArgumentException
- SWTException
- public Viewer getViewer()
public String getTitleArgument()
setTitelArgument
or null
if no optional title
argument has been set.null
public boolean isEmpty()
true
if no viewer is installed or if the current viewer
is a NullViewer
.true
if no viewer is installed or if the current viewer is a NullViewer
public ISelection getSelection()
ISelectionProvider
getSelection
in interface ISelectionProvider
getSelection
in class CompareViewerPane
public void setSelection(ISelection s)
ISelectionProvider
setSelection
in interface ISelectionProvider
setSelection
in class CompareViewerPane
s
- the new selectionprotected boolean inputChanged(Object input)
input
- the inputpublic void setInput(Object input)
getViewer(Viewer, Object)
.
If the returned viewer differs from the current one, the old viewer
is disposed and the new one installed. Then the input object is fed
into the newly installed viewer by calling its setInput(Object)
method.
If new and old viewer don't differ no new viewer is installed but just
setInput(Object)
is called.
If the input is null
the pane is cleared,
that is the current viewer is disposed.setInput
in class CompareViewerPane
input
- the new input object or null
public void setTitleArgument(String argument)
argument
- an optional argument for the pane's titlepublic Object getAdapter(Class adapter)
null
if
no such object can be found.getAdapter
in interface IAdaptable
getAdapter
in class CompareViewerPane
adapter
- the adapter class to look upnull
if this object does not
have an adapter for the given classIAdaptable.getAdapter(java.lang.Class)
public boolean setFocus()
Control
setFocus
in class Composite
true
if the control got focus, and false
if it was unable to.Control.forceFocus()
protected abstract Viewer getViewer(Viewer oldViewer, Object input)
null
is returned.
The additional argument oldViewer represents the viewer currently installed
in the pane (or null
if no viewer is installed).
It can be returned from this method if the current viewer can deal with the
input (and no new viewer must be created).oldViewer
- the currently installed viewer or null
input
- the input object for which a viewer must be determined or null
null
if no viewer can be determined
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.