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 SummaryNested classes/interfaces inherited from interface org.eclipse.gef.EditPartViewerEditPartViewer.Conditional
- 
Field SummaryFields inherited from class org.eclipse.gef.ui.parts.AbstractEditPartViewerconstantSelection, focusPart, selection, selectionListeners
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddPaletteListener(PaletteListener paletteListener) Adds the given PaletteListener as the one to be notified when the active tool on the palette changes.protected voidCreates the default root editpart.voidenableVerticalScrollbar(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 voidNotifies 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.org.eclipse.gef.ui.palette.editparts.PaletteAnimatorGets the PaletteAnimator for this paletteReturns the palette's root model.protected voidCalled if and when theControlis disposed.protected voidThis method is invoked when this viewer's control gains focus.protected voidExtended to tell the lightweight system what its control is.booleanisExpanded(PaletteDrawer drawer) Returns true if the given PaletteDrawer is expandedbooleanisPinned(PaletteDrawer drawer) Returns true if the given PaletteDrawer is pinnedvoidremovePaletteListener(PaletteListener paletteListener) The given PaletteListener will not be notified of active tool changes in the palette.booleanrestoreState(IMemento memento) Tries to apply the state of the given IMemento to the contents of this viewer.voidExtends the superclass implementation to scroll the native Canvas control after the super's implementation has completed.voidCaptures the state of the contents of this viewer in the given mementovoidsetActiveTool(ToolEntry newMode) Sets the active entry for this palette.voidsetColorProvider(PaletteColorProvider colorProvider) Sets the color provider that is used for painting the figures of this viewer.voidsetCustomizer(PaletteCustomizer customizer) Sets the customizer.voidsetPaletteAnimator(org.eclipse.gef.ui.palette.editparts.PaletteAnimator paletteAnimator) Sets the PaletteAnimator for this palettevoidsetPaletteRoot(PaletteRoot root) Sets the root for this palette.voidThis palette will use the given PaletteViewerPreferences to store all its preferences.protected voidCalled when the control is being set tonull, but before it is null.Methods inherited from class org.eclipse.gef.ui.parts.ScrollingGraphicalViewercreateControl, getFigureCanvas, hookRootFigureMethods inherited from class org.eclipse.gef.ui.parts.GraphicalViewerImplcreateLightweightSystem, findHandleAt, findObjectAtExcluding, flush, getEventDispatcher, getLayerManager, getLightweightSystem, getRootFigure, handleFocusLost, hookDropTarget, registerAccessibleEditPart, setContextMenu, setCursor, setDragSource, setEditDomain, setRootEditPart, setRootFigure, setRouteEventsToEditDomain, unregisterAccessibleEditPartMethods inherited from class org.eclipse.gef.ui.parts.AbstractEditPartVieweraddDragSourceListener, addDragSourceListener, addDropTargetListener, addDropTargetListener, addPropertyChangeListener, addSelectionChangedListener, appendSelection, deselect, deselectAll, findObjectAt, findObjectAtExcluding, fireSelectionChanged, getContents, getContextMenu, getControl, getDelegatingDragAdapter, getDelegatingDropAdapter, getDragSource, getDropTarget, getEditDomain, getEditPartFactory, getEditPartForModel, 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, setSelectionManagerMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.gef.EditPartVieweraddDragSourceListener, addDragSourceListener, addDropTargetListener, addDropTargetListener, addPropertyChangeListener, appendSelection, deselect, deselectAll, findObjectAt, findObjectAtExcluding, getContents, getContextMenu, getControl, getEditDomain, getEditPartFactory, getEditPartForModel, getEditPartRegistry, getFocusEditPart, getKeyHandler, getProperty, getResourceManager, getRootEditPart, getSelectedEditParts, getSelection, getSelectionManager, getVisualPartMap, removeDragSourceListener, removeDragSourceListener, removeDropTargetListener, removeDropTargetListener, removePropertyChangeListener, select, setContents, setContents, setControl, setEditPartFactory, setFocus, setKeyHandler, setProperty, setSelectionManagerMethods inherited from interface org.eclipse.jface.viewers.ISelectionProvideraddSelectionChangedListener, removeSelectionChangedListener, setSelection
- 
Constructor Details- 
PaletteViewerpublic PaletteViewer()Constructor
 
- 
- 
Method Details- 
addPaletteListenerAdds 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
 
- 
createDefaultRootprotected void createDefaultRoot()Description copied from class:GraphicalViewerImplCreates the default root editpart. Called during construction.- Overrides:
- createDefaultRootin class- GraphicalViewerImpl
- See Also:
 
- 
enableVerticalScrollbarpublic 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-- trueif a vertical scrollbar should be displayed
 
- 
fireModeChangedprotected void fireModeChanged()Notifies registered listeners of change in the active tool on the palette
- 
getCustomizer- Returns:
- the customizer
 
- 
getCustomizerDialogNOTE: 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
 
- 
getPaletteAnimatorpublic org.eclipse.gef.ui.palette.editparts.PaletteAnimator getPaletteAnimator()Gets the PaletteAnimator for this palette- Returns:
- the palletteAnimator to be used for palette animations
- Since:
- 3.19
 
- 
getPaletteRootReturns 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)
 
- 
getColorProvider- Returns:
- The color provider that is used for painting the figures of this
         viewer. If no palette has been set by the user,
         ColorProvider.SystemColorFactory.getColorProvider()is returned instead ofnull.
- Since:
- 3.20
 
- 
handleDisposeDescription copied from class:AbstractEditPartViewerCalled if and when theControlis disposed. Subclasses may extend this method to perform additional cleanup.- Overrides:
- handleDisposein class- GraphicalViewerImpl
- Parameters:
- e- the disposeevent
- See Also:
 
- 
handleFocusGainedDescription copied from class:GraphicalViewerImplThis method is invoked when this viewer's control gains focus. It gives focus to thefocusPart, if there is one.- Overrides:
- handleFocusGainedin class- GraphicalViewerImpl
- Parameters:
- fe- the focusEvent received by this viewer's control
- See Also:
 
- 
hookControlprotected void hookControl()Description copied from class:GraphicalViewerImplExtended to tell the lightweight system what its control is.- Overrides:
- hookControlin class- GraphicalViewerImpl
- See Also:
 
- 
isExpandedReturns true if the given PaletteDrawer is expanded- Parameters:
- drawer- the PaletteDrawer
- Returns:
- true if expanded
 
- 
isPinnedReturns true if the given PaletteDrawer is pinned- Parameters:
- drawer- the PaletteDrawer
- Returns:
- true if pinned
 
- 
removePaletteListenerThe 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
 
- 
restoreStateTries 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
 
- 
revealDescription copied from class:ScrollingGraphicalViewerExtends the superclass implementation to scroll the native Canvas control after the super's implementation has completed.- Specified by:
- revealin interface- EditPartViewer
- Overrides:
- revealin class- ScrollingGraphicalViewer
- Parameters:
- part- the EditPart to reveal
- See Also:
 
- 
saveStateCaptures 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
 
- 
setCustomizerSets the customizer.- Parameters:
- customizer- the customizer to be set
 
- 
setActiveToolSets 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
 
- 
setPaletteAnimatorpublic void setPaletteAnimator(org.eclipse.gef.ui.palette.editparts.PaletteAnimator paletteAnimator) Sets the PaletteAnimator for this palette- Parameters:
- paletteAnimator- the PaletteAnimator to be used for this palletteViewer's children
- Since:
- 3.19
 
- 
setPaletteRootSets the root for this palette.- Parameters:
- root- the PaletteRoot for this palette
 
- 
setPaletteViewerPreferencesThis 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
 
- 
setColorProviderSets the color provider that is used for painting the figures of this viewer. Ifnullis passed as an argument, the palette is reset to its default configuration.- Parameters:
- colorProvider- The color provider for this viewer.
- Since:
- 3.20
 
- 
unhookControlprotected void unhookControl()Description copied from class:AbstractEditPartViewerCalled when the control is being set tonull, but before it is null.- Overrides:
- unhookControlin class- GraphicalViewerImpl
- See Also:
 
 
-