org.eclipse.gmf.runtime.lite.services
Class TreeDirectEditManager

java.lang.Object
  extended by org.eclipse.gmf.runtime.lite.services.TreeDirectEditManager

public abstract class TreeDirectEditManager
extends Object

Manages the direct edit operation by creating and maintaining the CellEditor and executing the resulting command if the cell editor value has changed.


Constructor Summary
TreeDirectEditManager(org.eclipse.gef.EditPart source, Class editorType, org.eclipse.gef.tools.CellEditorLocator locator)
          Constructs a new DirectEditManager for the given source edit part.
TreeDirectEditManager(org.eclipse.gef.EditPart source, Class editorType, org.eclipse.gef.tools.CellEditorLocator locator, Object feature)
          Constructs a new DirectEditManager for the given source edit part.
 
Method Summary
protected  void bringDown()
          Cleanup is done here.
protected  void commit()
          Commits the current value of the cell editor by getting a Command from the source edit part and executing it via the CommandStack.
protected  org.eclipse.jface.viewers.CellEditor createCellEditorOn(org.eclipse.swt.widgets.Composite composite)
          Creates the cell editor on the given composite.
protected  org.eclipse.gef.requests.DirectEditRequest createDirectEditRequest()
          Creates and returns the DirectEditRequest.
protected  void eraseFeedback()
          Asks the source edit part to erase source feedback.
protected  org.eclipse.jface.viewers.CellEditor getCellEditor()
          Returns the cell editor.
protected  Object getDirectEditFeature()
           
protected  org.eclipse.gef.requests.DirectEditRequest getDirectEditRequest()
          Returns the direct edit request, creating it if needed.
protected  org.eclipse.gef.EditPart getEditPart()
          Returns the source edit part.
protected abstract  void initCellEditor()
          Initializes the cell editor.
protected  boolean isDirty()
          Returns true if the cell editor's value has been changed.
protected  void setCellEditor(org.eclipse.jface.viewers.CellEditor editor)
          Sets the cell editor to the given editor.
protected  void setDirty(boolean value)
          Sets the dirty property.
protected  void setEditPart(org.eclipse.gef.EditPart source)
          Sets the source edit part.
 void setLocator(org.eclipse.gef.tools.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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeDirectEditManager

public TreeDirectEditManager(org.eclipse.gef.EditPart source,
                             Class editorType,
                             org.eclipse.gef.tools.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 part
editorType - the cell editor type
locator - the locator

TreeDirectEditManager

public TreeDirectEditManager(org.eclipse.gef.EditPart source,
                             Class editorType,
                             org.eclipse.gef.tools.CellEditorLocator locator,
                             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 part
editorType - the cell editor type
locator - the locator
feature - 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 not null, it will be deativated, disposed, and set to null.


commit

protected void commit()
Commits the current value of the cell editor by getting a Command from the source edit part and executing it via the CommandStack. Finally, bringDown() is called to perform and necessary cleanup.


createCellEditorOn

protected org.eclipse.jface.viewers.CellEditor createCellEditorOn(org.eclipse.swt.widgets.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 org.eclipse.gef.requests.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 org.eclipse.jface.viewers.CellEditor getCellEditor()
Returns the cell editor.

Returns:
the cell editor

getDirectEditFeature

protected 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 org.eclipse.gef.requests.DirectEditRequest getDirectEditRequest()
Returns the direct edit request, creating it if needed.

Returns:
the direct edit request

getEditPart

protected org.eclipse.gef.EditPart getEditPart()
Returns the source edit part.

Returns:
the source edit part

initCellEditor

protected abstract void initCellEditor()
Initializes the cell editor. Subclasses should implement this to set the initial text and add things such as VerifyListeners, if needed.


isDirty

protected boolean isDirty()
Returns true if the cell editor's value has been changed.

Returns:
true if the cell editor is dirty

setCellEditor

protected void setCellEditor(org.eclipse.jface.viewers.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(org.eclipse.gef.EditPart source)
Sets the source edit part.

Parameters:
source - the source edit part

setLocator

public void setLocator(org.eclipse.gef.tools.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. Calls initCellEditor(), CellEditor.activate(), and showFeedback().


showFeedback

public void showFeedback()
Asks the source edit part to show source feedback.


unhookListeners

protected void unhookListeners()
Unhooks listeners. Called from bringDown(). TODO: hookListeners() and unhookListeners() should have the same visibility.



Copyright © 2012. All Rights Reserved.