Package org.eclipse.gef.tools
Class DirectEditManager
- java.lang.Object
-
- org.eclipse.gef.tools.DirectEditManager
-
public abstract class DirectEditManager extends java.lang.Object
Manages the direct edit operation by creating and maintaining theCellEditor
and executing the resulting command if the cell editor value has changed.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
DirectEditManager.DirectEditBorder
The border used to 'frame' the cell editor.
-
Constructor Summary
Constructors Constructor Description DirectEditManager(GraphicalEditPart source, java.lang.Class editorType, CellEditorLocator locator)
Constructs a new DirectEditManager for the given source edit part.DirectEditManager(GraphicalEditPart source, java.lang.Class editorType, CellEditorLocator locator, java.lang.Object feature)
Constructs a new DirectEditManager for the given source edit part.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
bringDown()
Cleanup is done here.protected void
commit()
Commits the current value of the cell editor by getting aCommand
from the source edit part and executing it via theCommandStack
.protected CellEditor
createCellEditorOn(Composite composite)
Creates the cell editor on the given composite.protected DirectEditRequest
createDirectEditRequest()
Creates and returns the DirectEditRequest.protected void
eraseFeedback()
Asks the source edit part to erase source feedback.protected CellEditor
getCellEditor()
Returns the cell editor.protected org.eclipse.draw2d.IFigure
getCellEditorFrame()
Returns the IFigure, which is used to 'embed' the cell editor control.protected java.lang.Object
getDirectEditFeature()
protected DirectEditRequest
getDirectEditRequest()
Returns the direct edit request, creating it if needed.protected GraphicalEditPart
getEditPart()
Returns the source edit part.protected CellEditorLocator
getLocator()
protected void
handleValueChanged()
protected void
hookListeners()
protected abstract void
initCellEditor()
Initializes the cell editor.protected boolean
isDirty()
Returnstrue
if the cell editor's value has been changed.protected void
setCellEditor(CellEditor editor)
Sets the cell editor to the given editor.protected void
setDirty(boolean value)
Sets the dirty property.protected void
setEditPart(GraphicalEditPart source)
Sets the source edit part.void
setLocator(CellEditorLocator locator)
Sets the CellEditorLocator used to place the cell editor in the correct location.void
show()
Shows the cell editor when direct edit is started.void
showFeedback()
Asks the source edit part to show source feedback.protected void
unhookListeners()
Unhooks listeners.
-
-
-
Constructor Detail
-
DirectEditManager
public DirectEditManager(GraphicalEditPart source, java.lang.Class editorType, CellEditorLocator locator)
Constructs a new DirectEditManager for the given source edit part. The cell editor will be created by instantiating the type editorType. The cell editor will be placed using the given CellEditorLocator.- Parameters:
source
- the source edit parteditorType
- the cell editor typelocator
- the locator
-
DirectEditManager
public DirectEditManager(GraphicalEditPart source, java.lang.Class editorType, CellEditorLocator locator, java.lang.Object feature)
Constructs a new DirectEditManager for the given source edit part. The cell editor will be created by instantiating the type editorType. The cell editor will be placed using the given CellEditorLocator.- Parameters:
source
- the source edit parteditorType
- the cell editor typelocator
- the locatorfeature
- If the EditPart supports direct editing of multiple features, this parameter can be used to discriminate among them.- Since:
- 3.2
-
-
Method Detail
-
bringDown
protected void bringDown()
Cleanup is done here. Any feedback is erased and listeners unhooked. If the cell editor is notnull
, it will bedeativated
,disposed
, and set tonull
.
-
commit
protected void commit()
Commits the current value of the cell editor by getting aCommand
from the source edit part and executing it via theCommandStack
. Finally,bringDown()
is called to perform and necessary cleanup.
-
createCellEditorOn
protected CellEditor createCellEditorOn(Composite composite)
Creates the cell editor on the given composite. The cell editor is created by instantiating the cell editor type passed into this DirectEditManager's constuctor.- Parameters:
composite
- the composite to create the cell editor on- Returns:
- the newly created cell editor
-
createDirectEditRequest
protected DirectEditRequest createDirectEditRequest()
Creates and returns the DirectEditRequest.- Returns:
- the direct edit request
-
eraseFeedback
protected void eraseFeedback()
Asks the source edit part to erase source feedback.
-
getCellEditor
protected CellEditor getCellEditor()
Returns the cell editor.- Returns:
- the cell editor
-
getCellEditorFrame
protected org.eclipse.draw2d.IFigure getCellEditorFrame()
Returns the IFigure, which is used to 'embed' the cell editor control.- Returns:
- An
IFigure
to be used as frame around the cell editor control. - Since:
- 3.9
-
getDirectEditFeature
protected java.lang.Object getDirectEditFeature()
- Returns:
Object
that can be used if the EditPart supports direct editing of multiple features, this parameter can be used to discriminate among them.- Since:
- 3.2
-
getDirectEditRequest
protected DirectEditRequest getDirectEditRequest()
Returns the direct edit request, creating it if needed.- Returns:
- the direct edit request
-
getEditPart
protected GraphicalEditPart getEditPart()
Returns the source edit part.- Returns:
- the source edit part
-
getLocator
protected CellEditorLocator getLocator()
-
handleValueChanged
protected void handleValueChanged()
-
hookListeners
protected void hookListeners()
-
initCellEditor
protected abstract void initCellEditor()
Initializes the cell editor. Subclasses should implement this to set the initial text and add things such asVerifyListeners
, if needed.
-
isDirty
protected boolean isDirty()
Returnstrue
if the cell editor's value has been changed.- Returns:
true
if the cell editor is dirty
-
setCellEditor
protected void setCellEditor(CellEditor editor)
Sets the cell editor to the given editor.- Parameters:
editor
- the cell editor
-
setDirty
protected void setDirty(boolean value)
Sets the dirty property.- Parameters:
value
- the dirty property
-
setEditPart
protected void setEditPart(GraphicalEditPart source)
Sets the source edit part.- Parameters:
source
- the source edit part
-
setLocator
public void setLocator(CellEditorLocator locator)
Sets the CellEditorLocator used to place the cell editor in the correct location.- Parameters:
locator
- the locator
-
show
public void show()
Shows the cell editor when direct edit is started. CallsinitCellEditor()
,CellEditor.activate()
, andshowFeedback()
.
-
showFeedback
public void showFeedback()
Asks the source edit part to show source feedback.
-
unhookListeners
protected void unhookListeners()
Unhooks listeners. Called frombringDown()
.
-
-