Package org.eclipse.graphiti.ui.editor
Class DefaultPaletteBehavior
- java.lang.Object
-
- org.eclipse.graphiti.ui.editor.DefaultPaletteBehavior
-
public class DefaultPaletteBehavior extends java.lang.ObjectThis class can be subclassed by clients to adapt the palette appearance and behavior of the Graphiti diagram Editor. The API is very much aligned with the way GEF handles the palette within its editors, seeGraphicalEditorWithFlyoutPalettefor more information on that. To exchange the default implementation you have to return an instance of your subclass in the methodDiagramBehavior.createPaletteBehaviour().
Note that there is always a 1:1 relation with aDiagramBehavior.- Since:
- 0.9
-
-
Field Summary
Fields Modifier and Type Field Description protected static intDEFAULT_PALETTE_SIZEThe initial size of the palette.protected DiagramBehaviordiagramBehaviorThe associatedDiagramBehaviorprotected static java.lang.StringPROPERTY_PALETTE_DOCK_LOCATIONProperty name for storing the location (east, west) of the palette within the editor in an Eclipse preference store.protected static java.lang.StringPROPERTY_PALETTE_SIZEProperty name for storing the size of the palette within the editor in an Eclipse preference store.protected static java.lang.StringPROPERTY_PALETTE_STATEProperty name for storing the state (collapsed, expanded, hidden) of the palette within the editor in an Eclipse preference store.
-
Constructor Summary
Constructors Constructor Description DefaultPaletteBehavior(DiagramBehavior diagramBehavior)Creates a new standard palette behaviour for a Graphiti diagram editor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.eclipse.gef.palette.PaletteRootcreatePaletteRoot()Creates thePaletteRootof this editor.protected org.eclipse.gef.ui.palette.PaletteViewerProvidercreatePaletteViewerProvider()Returns the PaletteViewerProvider, which can be used to create a new PaletteViewer.voiddispose()Disposes this instance.org.eclipse.gef.ui.palette.FlyoutPaletteComposite.FlyoutPreferencesgetPalettePreferences()Returns the Graphiti specific preferences for the palette.org.eclipse.gef.palette.PaletteRootgetPaletteRoot()Returns the already existingPaletteRootinstance for theDiagramBehaviorassociated the this palette behavior or creates a newPaletteRootinstance in case none exists.voidinitializeViewer()Initializes the used GEF palette viewer to display the palette as defined.voidrefreshPalette()Refreshes the palette.
-
-
-
Field Detail
-
PROPERTY_PALETTE_DOCK_LOCATION
protected static final java.lang.String PROPERTY_PALETTE_DOCK_LOCATION
Property name for storing the location (east, west) of the palette within the editor in an Eclipse preference store.- See Also:
- Constant Field Values
-
PROPERTY_PALETTE_SIZE
protected static final java.lang.String PROPERTY_PALETTE_SIZE
Property name for storing the size of the palette within the editor in an Eclipse preference store.- See Also:
- Constant Field Values
-
PROPERTY_PALETTE_STATE
protected static final java.lang.String PROPERTY_PALETTE_STATE
Property name for storing the state (collapsed, expanded, hidden) of the palette within the editor in an Eclipse preference store.- See Also:
- Constant Field Values
-
DEFAULT_PALETTE_SIZE
protected static final int DEFAULT_PALETTE_SIZE
The initial size of the palette.- See Also:
- Constant Field Values
-
diagramBehavior
protected final DiagramBehavior diagramBehavior
The associatedDiagramBehavior- Since:
- 0.10
-
-
Constructor Detail
-
DefaultPaletteBehavior
public DefaultPaletteBehavior(DiagramBehavior diagramBehavior)
Creates a new standard palette behaviour for a Graphiti diagram editor. The passedDiagramBehavioris closely linked to this instance (1:1 relation) and both instances will have a common lifecycle.- Parameters:
diagramEditor- The associatedDiagramBehavior.- Since:
- 0.10
-
-
Method Detail
-
createPaletteRoot
protected org.eclipse.gef.palette.PaletteRoot createPaletteRoot()
Creates thePaletteRootof this editor. To retrieve thePaletteRootobject usegetPaletteRoot()instead which will return an already existing instance or create a new one by delegating to this method.- Returns:
- a new Graphiti specific
PaletteRootinstance - See Also:
org.eclipse.graphiti.ui.editor.GraphicalEditorIncludingPalette#getPaletteRoot()
-
getPaletteRoot
public org.eclipse.gef.palette.PaletteRoot getPaletteRoot()
Returns the already existingPaletteRootinstance for theDiagramBehaviorassociated the this palette behavior or creates a newPaletteRootinstance in case none exists.- Returns:
- a new Graphiti specific
PaletteRootinstance
-
initializeViewer
public void initializeViewer()
Initializes the used GEF palette viewer to display the palette as defined. The default implementation initializes the preference store with the GEFDefaultPaletteViewerPreferencesand triggers a refresh of the palette.
-
getPalettePreferences
public org.eclipse.gef.ui.palette.FlyoutPaletteComposite.FlyoutPreferences getPalettePreferences()
Returns the Graphiti specific preferences for the palette. This method will be called by the GEFGraphicalEditorWithFlyoutPaletteduring initialization.- Returns:
- a Graphiti specific instanceof
FlyoutPaletteComposite.FlyoutPreferences.
-
createPaletteViewerProvider
protected org.eclipse.gef.ui.palette.PaletteViewerProvider createPaletteViewerProvider()
Returns the PaletteViewerProvider, which can be used to create a new PaletteViewer. This method can be overwritten to return a subclass of the PaletteViewerProvider, which configures the PaletteViewer with a different ContextMenu, with a PaletteCustomizer or with a different IPreferencesStore. Do not call this method directly, instead call getPaletteViewerProvider(), which buffers the created object.By default this method returns a new PaletteViewerProvider.
- Returns:
- The PaletteViewerProvider, which can be used to create a new PaletteViewer.
-
refreshPalette
public void refreshPalette()
Refreshes the palette.
-
dispose
public void dispose()
Disposes this instance. Must be called before closing the associated Graphiti diagram editor. The default implementation clears thepaletteRootreference.
-
-