Eclipse GEF
2.1

org.eclipse.gef.ui.palette
Class PaletteCustomizer

java.lang.Object
  |
  +--org.eclipse.gef.ui.palette.PaletteCustomizer

public abstract class PaletteCustomizer
extends Object

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
PaletteCustomizer()
           
 
Method Summary
 boolean canDelete(PaletteEntry entry)
          Indicates whether the given entry can be deleted from the model or not.
 boolean canMoveDown(PaletteEntry entry)
          Indicates whether the given entry can be moved down or not.
 boolean canMoveUp(PaletteEntry entry)
          Indicates whether the given entry can be moved up or not.
 List getNewEntryFactories()
          Returns the list of PaletteEntryFactories that can be used to create new palette entries.
 EntryPage getPropertiesPage(PaletteEntry entry)
          Returns an EntryPage that will display the custom properties of the given entry.
 void performDelete(PaletteEntry entry)
          Updates the model by deleting the given entry from it.
 void performMoveDown(PaletteEntry entry)
          Updates the model by moving the entry down.
 void performMoveUp(PaletteEntry entry)
          Updates the model by moving the entry up.
abstract  void revertToSaved()
          Undoes the changes made to the model since the last save.
abstract  void save()
          Persists the changes made to the model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PaletteCustomizer

public PaletteCustomizer()
Method Detail

canDelete

public boolean canDelete(PaletteEntry entry)
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 PaletteCustomizerDialog to determine whether or not to enable the "Delete" action.

Parameters:
entry - The selected palette entry. It'll never be null.
Returns:
true if the given entry can be deleted
See Also:
performDelete(PaletteEntry)

canMoveDown

public boolean canMoveDown(PaletteEntry entry)
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 be null)
Returns:
true if the given entry can be moved down
See Also:
performMoveDown(PaletteEntry)

canMoveUp

public boolean canMoveUp(PaletteEntry entry)
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 be null)
Returns:
true if the given entry can be moved up
See Also:
performMoveUp(PaletteEntry)

getNewEntryFactories

public List 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

public EntryPage getPropertiesPage(PaletteEntry entry)
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 be null)
Returns:
The EntryPage to represent the given entry

performDelete

public void performDelete(PaletteEntry entry)
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 be null)
See Also:
canDelete(PaletteEntry)

performMoveDown

public void performMoveDown(PaletteEntry entry)
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 be null)
See Also:
canMoveDown(PaletteEntry)

performMoveUp

public void performMoveUp(PaletteEntry entry)
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 be null)
See Also:
canMoveUp(PaletteEntry)

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.


Eclipse GEF
2.1

Copyright (c) IBM Corp. and others 2000, 2003. All Rights Reserved.