|
GEF (MVC) 3.9.0.201308190730 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.gef.ui.palette.customize.PaletteEntryFactory
public abstract class PaletteEntryFactory
A PaletteEntryFactory creates certain type of
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.
PaletteCustomizer
,
PaletteCustomizerDialog
Constructor Summary | |
---|---|
PaletteEntryFactory()
|
Method Summary | |
---|---|
boolean |
canCreate(PaletteEntry selected)
This method is called by the PaletteCustomizerDialog to
determine whether to enable or disable this action on the toolbar and the
context menu. |
protected abstract PaletteEntry |
createNewEntry(Shell shell)
Create the PaletteEntry |
PaletteEntry |
createNewEntry(Shell shell,
PaletteEntry selected)
This method is called when a new palette entry of the type supported by this PaletteEntryFactory is to be created. |
protected PaletteContainer |
determineContainerForNewEntry(PaletteEntry selected)
Given the current selection, this method determines the parent for the new entry to be created. |
protected int |
determineIndexForNewEntry(PaletteContainer c,
PaletteEntry selected)
Calculates the index at which the new entry is to be created, given the current selection. |
protected java.lang.Object |
determineTypeForNewEntry(PaletteEntry selected)
Given the current selection, this method determines the type of the new entry to be created. |
ImageDescriptor |
getImageDescriptor()
|
java.lang.String |
getLabel()
|
void |
setImageDescriptor(ImageDescriptor imgDesc)
Sets the ImageDescriptor used to create the image to
represent this factory |
void |
setLabel(java.lang.String newLabel)
Sets this factory's name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PaletteEntryFactory()
Method Detail |
---|
public PaletteEntry createNewEntry(Shell shell, PaletteEntry selected)
PaletteEntryFactory
is to be created.
shell
- The Shell
of the
PaletteCustomizerDialog
selected
- The PaletteEntry
that was selected in the outline
when this action was launched. Will never be null
.
PaletteEntry
protected abstract PaletteEntry createNewEntry(Shell shell)
shell
- The Shell
of the
PaletteCustomizerDialog
; it can be used to create
another warning or information dialog.
public boolean canCreate(PaletteEntry selected)
PaletteCustomizerDialog
to
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
PaletteContainer
s with the following user permission:
PERMISSION_FULL_MODIFICATION
selected
- The selected PaletteEntry
(Will never be
null
)
true
if, given the current selection, this
PaletteEntryFactory
can create a new
PaletteEntry
protected PaletteContainer determineContainerForNewEntry(PaletteEntry selected)
Sub-classes may override this method.
selected
- The selected entry
protected java.lang.Object determineTypeForNewEntry(PaletteEntry selected)
Sub-classes may override this method.
selected
- The selected entry
protected int determineIndexForNewEntry(PaletteContainer c, PaletteEntry selected)
Sub-classes may override this method.
c
- The parent containerselected
- The selected entry
public ImageDescriptor getImageDescriptor()
ImageDescriptor
used to create the image to
represent this factorypublic java.lang.String getLabel()
public void setImageDescriptor(ImageDescriptor imgDesc)
ImageDescriptor
used to create the image to
represent this factory
imgDesc
- The new ImageDescriptorpublic void setLabel(java.lang.String newLabel)
newLabel
- The new name for this factory
|
GEF (MVC) 3.9.0.201308190730 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |