public class PaletteViewer extends ScrollingGraphicalViewer
EditPartViewer.Conditional
constantSelection, focusPart, selection, selectionListeners
Constructor and Description |
---|
PaletteViewer()
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addPaletteListener(PaletteListener paletteListener)
Adds the given PaletteListener as the one to be notified when the active
tool on the palette changes.
|
protected void |
createDefaultRoot()
Creates the default root editpart.
|
void |
enableVerticalScrollbar(boolean value)
Indicates that the palette should scroll using a native vertical
scrollbar as opposed to individual lightweight buttons that appear
dynamically on each drawer.
|
protected void |
fireModeChanged()
Notifies registered listeners of change in the active tool on the palette
|
ToolEntry |
getActiveTool() |
PaletteCustomizer |
getCustomizer() |
PaletteCustomizerDialog |
getCustomizerDialog()
NOTE: A PaletteCustomizer must be set for this viewer using the
setCustomizer(PaletteCustomizer) method before this method is
invoked. |
PaletteRoot |
getPaletteRoot()
Returns the palette's root model.
|
PaletteViewerPreferences |
getPaletteViewerPreferences() |
protected void |
handleDispose(DisposeEvent e)
Called if and when the
Control is disposed. |
protected void |
handleFocusGained(FocusEvent fe)
This method is invoked when this viewer's control gains focus.
|
protected void |
hookControl()
Extended to tell the lightweight system what its control is.
|
boolean |
isExpanded(PaletteDrawer drawer)
Returns true if the given PaletteDrawer is expanded
|
boolean |
isPinned(PaletteDrawer drawer)
Returns true if the given PaletteDrawer is pinned
|
void |
removePaletteListener(PaletteListener paletteListener)
The given PaletteListener will not be notified of active tool changes in
the palette.
|
boolean |
restoreState(IMemento memento)
Tries to apply the state of the given IMemento to the contents of this
viewer.
|
void |
reveal(EditPart part)
Extends the superclass implementation to scroll the native Canvas control
after the super's implementation has completed.
|
void |
saveState(IMemento memento)
Captures the state of the contents of this viewer in the given memento
|
void |
setActiveTool(ToolEntry newMode)
Sets the active entry for this palette.
|
void |
setCustomizer(PaletteCustomizer customizer)
Sets the customizer.
|
void |
setPaletteRoot(PaletteRoot root)
Sets the root for this palette.
|
void |
setPaletteViewerPreferences(PaletteViewerPreferences prefs)
This palette will use the given PaletteViewerPreferences to store all its
preferences.
|
protected void |
unhookControl()
Called when the control is being set to
null , but before it
is null. |
createControl, getFigureCanvas, hookRootFigure
createLightweightSystem, findHandleAt, findObjectAtExcluding, flush, getEventDispatcher, getLayerManager, getLightweightSystem, getRootFigure, handleFocusLost, hookDropTarget, registerAccessibleEditPart, setContextMenu, setCursor, setDragSource, setEditDomain, setRootEditPart, setRootFigure, setRouteEventsToEditDomain, unregisterAccessibleEditPart
addDragSourceListener, addDragSourceListener, addDropTargetListener, addDropTargetListener, addPropertyChangeListener, addSelectionChangedListener, appendSelection, deselect, deselectAll, findObjectAt, findObjectAtExcluding, fireSelectionChanged, getContents, getContextMenu, getControl, getDelegatingDragAdapter, getDelegatingDropAdapter, getDragSource, getDropTarget, getEditDomain, getEditPartFactory, getEditPartRegistry, getFocusEditPart, getKeyHandler, getProperty, getResourceManager, getRootEditPart, getSelectedEditParts, getSelection, getSelectionManager, getVisualPartMap, hookDragSource, init, primGetSelectedEditParts, refreshDragSourceAdapter, refreshDropTargetAdapter, removeDragSourceListener, removeDragSourceListener, removeDropTargetListener, removeDropTargetListener, removePropertyChangeListener, removeSelectionChangedListener, select, setContents, setContents, setControl, setDropTarget, setEditPartFactory, setFocus, setKeyHandler, setProperty, setSelection, setSelectionManager
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addDragSourceListener, addDragSourceListener, addDropTargetListener, addDropTargetListener, addPropertyChangeListener, appendSelection, deselect, deselectAll, findObjectAt, findObjectAtExcluding, getContents, getContextMenu, getControl, getEditDomain, getEditPartFactory, getEditPartRegistry, getFocusEditPart, getKeyHandler, getProperty, getResourceManager, getRootEditPart, getSelectedEditParts, getSelection, getSelectionManager, getVisualPartMap, removeDragSourceListener, removeDragSourceListener, removeDropTargetListener, removeDropTargetListener, removePropertyChangeListener, select, setContents, setContents, setControl, setEditPartFactory, setFocus, setKeyHandler, setProperty, setSelectionManager
addSelectionChangedListener, removeSelectionChangedListener, setSelection
public void addPaletteListener(PaletteListener paletteListener)
paletteListener
- The listener that needs to be notified of active tool changes
on the paletteprotected void createDefaultRoot()
GraphicalViewerImpl
createDefaultRoot
in class GraphicalViewerImpl
GraphicalViewerImpl.createDefaultRoot()
public void enableVerticalScrollbar(boolean value)
false
.
Enabling this setting requires additional horizontal screen space for the
scrollbar. Therefore, its use is discouraged.
This setting must be changed prior to calling
ScrollingGraphicalViewer.createControl(org.eclipse.swt.widgets.Composite)
. After the control is created, changing this setting will have no
effect.
value
- true
if a vertical scrollbar should be displayedprotected void fireModeChanged()
public PaletteCustomizer getCustomizer()
public PaletteCustomizerDialog getCustomizerDialog()
setCustomizer(PaletteCustomizer)
method before this method is
invoked.public ToolEntry getActiveTool()
public PaletteRoot getPaletteRoot()
public PaletteViewerPreferences getPaletteViewerPreferences()
protected void handleDispose(DisposeEvent e)
AbstractEditPartViewer
Control
is disposed. Subclasses may
extend this method to perform additional cleanup.handleDispose
in class GraphicalViewerImpl
e
- the disposeeventGraphicalViewerImpl.handleDispose(org.eclipse.swt.events.DisposeEvent)
protected void handleFocusGained(FocusEvent fe)
GraphicalViewerImpl
focusPart
, if there
is one.handleFocusGained
in class GraphicalViewerImpl
fe
- the focusEvent received by this viewer's controlGraphicalViewerImpl.handleFocusGained(FocusEvent)
protected void hookControl()
GraphicalViewerImpl
hookControl
in class GraphicalViewerImpl
GraphicalViewerImpl.hookControl()
public boolean isExpanded(PaletteDrawer drawer)
drawer
- the PaletteDrawerpublic boolean isPinned(PaletteDrawer drawer)
drawer
- the PaletteDrawerpublic void removePaletteListener(PaletteListener paletteListener)
paletteListener
- the PaletteListener which doesn't want to be notified of
active tool changes in the palette anymorepublic boolean restoreState(IMemento memento)
memento
- The memento that has the state to be applied to the contents
of this viewerpublic void reveal(EditPart part)
ScrollingGraphicalViewer
reveal
in interface EditPartViewer
reveal
in class ScrollingGraphicalViewer
part
- the EditPart to revealScrollingGraphicalViewer.reveal(EditPart)
public void saveState(IMemento memento)
memento
- the IMemento in which the state is to be savedpublic void setCustomizer(PaletteCustomizer customizer)
customizer
- the customizer to be setpublic void setActiveTool(ToolEntry newMode)
newMode
- the ToolEntry whose EditPart has to be set as the active tool
in this palettepublic void setPaletteRoot(PaletteRoot root)
root
- the PaletteRoot for this palettepublic void setPaletteViewerPreferences(PaletteViewerPreferences prefs)
NOTE: This method should be invoked by a client only once (before the
first time getPaletteViewerPreferences()
is invoked). Trying to
invoke this method after that could lead to problems where some
preferences would still be stored in the old preference store.
prefs
- the PaletteViewerPreferences that is to be used to store all
the preferences for this paletteprotected void unhookControl()
AbstractEditPartViewer
null
, but before it
is null.unhookControl
in class GraphicalViewerImpl
AbstractEditPartViewer.unhookControl()
Copyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.