Package org.eclipse.gef.ui.palette
Class PaletteViewer
java.lang.Object
org.eclipse.gef.ui.parts.AbstractEditPartViewer
org.eclipse.gef.ui.parts.GraphicalViewerImpl
org.eclipse.gef.ui.parts.ScrollingGraphicalViewer
org.eclipse.gef.ui.palette.PaletteViewer
- All Implemented Interfaces:
EditPartViewer
,GraphicalViewer
,ISelectionProvider
Graphical viewer for the GEF palette.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.gef.EditPartViewer
EditPartViewer.Conditional
-
Field Summary
Fields inherited from class org.eclipse.gef.ui.parts.AbstractEditPartViewer
constantSelection, focusPart, selection, selectionListeners
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPaletteListener
(PaletteListener paletteListener) Adds the given PaletteListener as the one to be notified when the active tool on the palette changes.protected void
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
Notifies registered listeners of change in the active tool on the paletteNOTE: A PaletteCustomizer must be set for this viewer using thesetCustomizer(PaletteCustomizer)
method before this method is invoked.Returns the palette's root model.protected void
Called if and when theControl
is disposed.protected void
This method is invoked when this viewer's control gains focus.protected void
Extended to tell the lightweight system what its control is.boolean
isExpanded
(PaletteDrawer drawer) Returns true if the given PaletteDrawer is expandedboolean
isPinned
(PaletteDrawer drawer) Returns true if the given PaletteDrawer is pinnedvoid
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
Extends the superclass implementation to scroll the native Canvas control after the super's implementation has completed.void
Captures the state of the contents of this viewer in the given mementovoid
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
This palette will use the given PaletteViewerPreferences to store all its preferences.protected void
Called when the control is being set tonull
, but before it is null.Methods inherited from class org.eclipse.gef.ui.parts.ScrollingGraphicalViewer
createControl, getFigureCanvas, hookRootFigure
Methods inherited from class org.eclipse.gef.ui.parts.GraphicalViewerImpl
createLightweightSystem, findHandleAt, findObjectAtExcluding, flush, getEventDispatcher, getLayerManager, getLightweightSystem, getRootFigure, handleFocusLost, hookDropTarget, registerAccessibleEditPart, setContextMenu, setCursor, setDragSource, setEditDomain, setRootEditPart, setRootFigure, setRouteEventsToEditDomain, unregisterAccessibleEditPart
Methods inherited from class org.eclipse.gef.ui.parts.AbstractEditPartViewer
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
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.eclipse.gef.EditPartViewer
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
Methods inherited from interface org.eclipse.jface.viewers.ISelectionProvider
addSelectionChangedListener, removeSelectionChangedListener, setSelection
-
Constructor Details
-
PaletteViewer
public PaletteViewer()Constructor
-
-
Method Details
-
addPaletteListener
Adds the given PaletteListener as the one to be notified when the active tool on the palette changes.- Parameters:
paletteListener
- The listener that needs to be notified of active tool changes on the palette
-
createDefaultRoot
protected void createDefaultRoot()Description copied from class:GraphicalViewerImpl
Creates the default root editpart. Called during construction.- Overrides:
createDefaultRoot
in classGraphicalViewerImpl
- See Also:
-
enableVerticalScrollbar
public 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. The default settings isfalse
. 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.- Parameters:
value
-true
if a vertical scrollbar should be displayed
-
fireModeChanged
protected void fireModeChanged()Notifies registered listeners of change in the active tool on the palette -
getCustomizer
- Returns:
- the customizer
-
getCustomizerDialog
NOTE: A PaletteCustomizer must be set for this viewer using thesetCustomizer(PaletteCustomizer)
method before this method is invoked.- Returns:
- The dialog that can be used to customize entries on the palette
-
getActiveTool
- Returns:
- the entry for the currently active tool
-
getPaletteRoot
Returns the palette's root model.- Returns:
- the palette root
-
getPaletteViewerPreferences
- Returns:
- The PaletteViewerPreferences that this palette is using to store its preferences (if none has been set, it returns the default one, which uses the GEF preference store)
-
handleDispose
Description copied from class:AbstractEditPartViewer
Called if and when theControl
is disposed. Subclasses may extend this method to perform additional cleanup.- Overrides:
handleDispose
in classGraphicalViewerImpl
- Parameters:
e
- the disposeevent- See Also:
-
handleFocusGained
Description copied from class:GraphicalViewerImpl
This method is invoked when this viewer's control gains focus. It gives focus to thefocusPart
, if there is one.- Overrides:
handleFocusGained
in classGraphicalViewerImpl
- Parameters:
fe
- the focusEvent received by this viewer's control- See Also:
-
hookControl
protected void hookControl()Description copied from class:GraphicalViewerImpl
Extended to tell the lightweight system what its control is.- Overrides:
hookControl
in classGraphicalViewerImpl
- See Also:
-
isExpanded
Returns true if the given PaletteDrawer is expanded- Parameters:
drawer
- the PaletteDrawer- Returns:
- true if expanded
-
isPinned
Returns true if the given PaletteDrawer is pinned- Parameters:
drawer
- the PaletteDrawer- Returns:
- true if pinned
-
removePaletteListener
The given PaletteListener will not be notified of active tool changes in the palette.- Parameters:
paletteListener
- the PaletteListener which doesn't want to be notified of active tool changes in the palette anymore
-
restoreState
Tries to apply the state of the given IMemento to the contents of this viewer. It fails silently, i.e. no exceptions are thrown if the given state could not be applied.- Parameters:
memento
- The memento that has the state to be applied to the contents of this viewer- Returns:
- a boolean indicating whether or not the given memento was successfully applied
- Since:
- 3.0
-
reveal
Description copied from class:ScrollingGraphicalViewer
Extends the superclass implementation to scroll the native Canvas control after the super's implementation has completed.- Specified by:
reveal
in interfaceEditPartViewer
- Overrides:
reveal
in classScrollingGraphicalViewer
- Parameters:
part
- the EditPart to reveal- See Also:
-
saveState
Captures the state of the contents of this viewer in the given memento- Parameters:
memento
- the IMemento in which the state is to be saved- Since:
- 3.0
-
setCustomizer
Sets the customizer.- Parameters:
customizer
- the customizer to be set
-
setActiveTool
Sets the active entry for this palette. The Editpart for the given entry will be activated (selected).- Parameters:
newMode
- the ToolEntry whose EditPart has to be set as the active tool in this palette
-
setPaletteRoot
Sets the root for this palette.- Parameters:
root
- the PaletteRoot for this palette
-
setPaletteViewerPreferences
This palette will use the given PaletteViewerPreferences to store all its preferences.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.- Parameters:
prefs
- the PaletteViewerPreferences that is to be used to store all the preferences for this palette
-
unhookControl
protected void unhookControl()Description copied from class:AbstractEditPartViewer
Called when the control is being set tonull
, but before it is null.- Overrides:
unhookControl
in classGraphicalViewerImpl
- See Also:
-