Package org.eclipse.gef.ui.palette
Class PaletteCustomizer
java.lang.Object
org.eclipse.gef.ui.palette.PaletteCustomizer
PaletteCustomizer is the PaletteCustomizerDialog's
interface to the model. This class is responsible for propogating to the
model changes made in the dialog.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancanAdd(PaletteContainer container, PaletteEntry entry) Return true if this container can accept this entry as a new child.booleancanDelete(PaletteEntry entry) Indicates whether the given entry can be deleted from the model or not.booleancanMoveDown(PaletteEntry entry) Indicates whether the given entry can be moved down or not.booleancanMoveUp(PaletteEntry entry) Indicates whether the given entry can be moved up or not.Returns the list of PaletteEntryFactories that can be used to create new palette entries.getPropertiesPage(PaletteEntry entry) Returns an EntryPage that will display the custom properties of the given entry.voidperformDelete(PaletteEntry entry) Updates the model by deleting the given entry from it.voidperformMoveDown(PaletteEntry entry) Updates the model by moving the entry down.voidperformMoveUp(PaletteEntry entry) Updates the model by moving the entry up.abstract voidUndoes the changes made to the model since the last save.abstract voidsave()Persists the changes made to the model.
-
Constructor Details
-
PaletteCustomizer
public PaletteCustomizer()
-
-
Method Details
-
canAdd
Return true if this container can accept this entry as a new child. By default, this method checks to see first if the container has full permissions, then checks to see if this container can accept the type of the entry.- Parameters:
container- the container that will be the parent of this entryentry- the entry to add to the container- Returns:
- true if this container can hold this entry
-
canDelete
Indicates whether the given entry can be deleted from the model or not. Whether or not an entry can be deleted depends on its permsission (PaletteEntry.getUserModificationPermission()).This method will be invoked by
PaletteCustomizerDialogto determine whether or not to enable the "Delete" action.- Parameters:
entry- The selected palette entry. It'll never benull.- Returns:
trueif the given entry can be deleted- See Also:
-
canMoveDown
Indicates whether the given entry can be moved down or not. Whether or not an entry can be moved down or not is determined by its parent's user modification permission (PaletteEntry.getUserModificationPermission()).Will be called by PaletteCustomizerDialog to determine whether or not to enable the "Move Down" action.
- Parameters:
entry- The selected palette entry (it'll never benull)- Returns:
trueif the given entry can be moved down- See Also:
-
canMoveUp
Indicates whether the given entry can be moved up or not. Whether or not an entry can be moved up or not is determined by its parent's user modification permission (PaletteEntry.getUserModificationPermission()).Will be called by PaletteCustomizerDialog to determine whether or not to enable the "Move Up" action.
- Parameters:
entry- The selected palette entry (it'll never benull)- Returns:
trueif the given entry can be moved up- See Also:
-
getNewEntryFactories
Returns the list of PaletteEntryFactories that can be used to create new palette entries. The String returned by the getText() method of each PaletteEntryFactory will be used to populate the "New" drop-down. getImageDescriptor() will be used to set the icons on the drop down. This method can return null if there are no PaletteEntryFactories available.- Returns:
- The List of PaletteEntryFactories
-
getPropertiesPage
Returns an EntryPage that will display the custom properties of the given entry. Can return null if there are no custom properties.- Parameters:
entry- The PaletteEntry whose properties page needs to be displayed (it'll never benull)- Returns:
- The EntryPage to represent the given entry
-
performDelete
Updates the model by deleting the given entry from it.
Called when the "Delete" action in the PaletteCustomizerDialog is executed.- Parameters:
entry- The selected palette entry (it'll never benull)- See Also:
-
performMoveDown
Updates the model by moving the entry down.
Called when the "Move Down" action in the PaletteCustomizerDialog is invoked.- Parameters:
entry- The selected palette entry (it'll never benull)- See Also:
-
performMoveUp
Updates the model by moving the entry up.
Called when the "Move Up" action in the PaletteCustomizerDialog is invoked.- Parameters:
entry- The selected palette entry (it'll never benull)- See Also:
-
revertToSaved
public abstract void revertToSaved()Undoes the changes made to the model since the last save.This method is invoked when the "Cancel" is selected in the
PaletteCustomizerDialog. -
save
public abstract void save()Persists the changes made to the model.Called when "OK" or "Apply" are selected in the
PaletteCustomizerDialog.
-