Class PaletteEntryFactory
- Direct Known Subclasses:
- PaletteContainerFactory,- PaletteSeparatorFactory,- PaletteStackFactory
PaletteEntries.
 
 This class only creates PaletteEntries in PaletteContainers and not directly in the
 root. It is recommended that
 sub-classes not do that either.
 
 To keep palette customization consistent across different types of editors,
 it is recommended that a new entry be created after the currently selected
 entry. If the new entry needs to be created inside the currently selected
 entry (i.e., if the currently selected entry is a
 PaletteContainer), it should be added as the last child. Look at
 determineContainerForNewEntry(PaletteEntry) and
 determineIndexForNewEntry(PaletteContainer, PaletteEntry) in this
 class and
 PaletteContainerFactory to see
 what the general guidelines are for creating containers and leaf entries.
 
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbooleancanCreate(PaletteEntry selected) This method is called by thePaletteCustomizerDialogto determine whether to enable or disable this action on the toolbar and the context menu.protected abstract PaletteEntrycreateNewEntry(Shell shell) Create the PaletteEntrycreateNewEntry(Shell shell, PaletteEntry selected) This method is called when a new palette entry of the type supported by thisPaletteEntryFactoryis to be created.protected PaletteContainerdetermineContainerForNewEntry(PaletteEntry selected) Given the current selection, this method determines the parent for the new entry to be created.protected intdetermineIndexForNewEntry(PaletteContainer c, PaletteEntry selected) Calculates the index at which the new entry is to be created, given the current selection.protected ObjectdetermineTypeForNewEntry(PaletteEntry selected) Given the current selection, this method determines the type of the new entry to be created.getLabel()voidsetImageDescriptor(ImageDescriptor imgDesc) Sets theImageDescriptorused to create the image to represent this factoryvoidSets this factory's name.
- 
Constructor Details- 
PaletteEntryFactorypublic PaletteEntryFactory()
 
- 
- 
Method Details- 
createNewEntryThis method is called when a new palette entry of the type supported by thisPaletteEntryFactoryis to be created.- Parameters:
- shell- The- Shellof the- PaletteCustomizerDialog
- selected- The- PaletteEntrythat was selected in the outline when this action was launched. Will never be- null.
- Returns:
- PaletteEntry The newly created PaletteEntry
 
- 
createNewEntryCreate the PaletteEntry- Parameters:
- shell- The- Shellof the- PaletteCustomizerDialog; it can be used to create another warning or information dialog.
- Returns:
- The newly created entry
 
- 
canCreateThis method is called by thePaletteCustomizerDialogto determine whether to enable or disable this action on the toolbar and the context menu.This default implementation allows the creation of a new entry only in PaletteContainers with the following user permission:PERMISSION_FULL_MODIFICATION- Parameters:
- selected- The selected- PaletteEntry(Will never be- null)
- Returns:
- trueif, given the current selection, this- PaletteEntryFactorycan create a new- PaletteEntry
 
- 
determineContainerForNewEntryGiven the current selection, this method determines the parent for the new entry to be created.Sub-classes may override this method. - Parameters:
- selected- The selected entry
- Returns:
- The parent of the new entry to be created
 
- 
determineTypeForNewEntryGiven the current selection, this method determines the type of the new entry to be created.Sub-classes may override this method. - Parameters:
- selected- The selected entry
- Returns:
- The type of the new entry to be created
 
- 
determineIndexForNewEntryCalculates the index at which the new entry is to be created, given the current selection.Sub-classes may override this method. - Parameters:
- c- The parent container
- selected- The selected entry
- Returns:
- the index at which the new entry should be added in the given container (-1 indicates add at the end)
 
- 
getImageDescriptor- Returns:
- ImageDescriptorused to create the image to represent this factory
 
- 
getLabel- Returns:
- This factory's name
 
- 
setImageDescriptorSets theImageDescriptorused to create the image to represent this factory- Parameters:
- imgDesc- The new ImageDescriptor
 
- 
setLabelSets this factory's name. It will be used to list this factory in the toolbar, context menu, etc.- Parameters:
- newLabel- The new name for this factory
 
 
-