sk.uniba.euromath.editor.textEditor.editParts
Class TextEditPart

java.lang.Object
  extended by org.eclipse.gef.editparts.AbstractEditPart
      extended by org.eclipse.gef.editparts.AbstractGraphicalEditPart
          extended by sk.uniba.euromath.editor.xmlEditor.editParts.XMLEditPart
              extended by sk.uniba.euromath.editor.textEditor.editParts.TextEditPart
All Implemented Interfaces:
IAdaptable, org.eclipse.gef.EditPart, org.eclipse.gef.GraphicalEditPart, org.eclipse.gef.RequestConstants, ITextPieceKeeper

public class TextEditPart
extends XMLEditPart
implements ITextPieceKeeper

EditPart that represents one line of text. Has also editing capabilities, but editing does nothing, supposed to be overriden.

Author:
Tomáš Studva, Martin Kollar 1.10.2005

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart
org.eclipse.gef.editparts.AbstractGraphicalEditPart.AccessibleGraphicalEditPart, org.eclipse.gef.editparts.AbstractGraphicalEditPart.DefaultAccessibleAnchorProvider
 
Nested classes/interfaces inherited from class org.eclipse.gef.editparts.AbstractEditPart
org.eclipse.gef.editparts.AbstractEditPart.EditPolicyIterator
 
Field Summary
 
Fields inherited from class sk.uniba.euromath.editor.xmlEditor.editParts.XMLEditPart
id
 
Fields inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart
figure, sourceConnections, targetConnections
 
Fields inherited from class org.eclipse.gef.editparts.AbstractEditPart
children, FLAG_ACTIVE, FLAG_FOCUS, MAX_FLAG
 
Fields inherited from interface org.eclipse.gef.EditPart
SELECTED, SELECTED_NONE, SELECTED_PRIMARY
 
Fields inherited from interface org.eclipse.gef.RequestConstants
REQ_ADD, REQ_ALIGN, REQ_ALIGN_CHILDREN, REQ_CLONE, REQ_CONNECTION_END, REQ_CONNECTION_START, REQ_CREATE, REQ_CREATE_BENDPOINT, REQ_DELETE, REQ_DELETE_DEPENDANT, REQ_DIRECT_EDIT, REQ_MOVE, REQ_MOVE_BENDPOINT, REQ_MOVE_CHILDREN, REQ_OPEN, REQ_ORPHAN, REQ_ORPHAN_CHILDREN, REQ_RECONNECT_SOURCE, REQ_RECONNECT_TARGET, REQ_RESIZE, REQ_RESIZE_CHILDREN, REQ_SELECTION, REQ_SELECTION_HOVER
 
Constructor Summary
TextEditPart(ITextLocator figure, CaretManager cManager, org.eclipse.gef.GraphicalViewer graphicalViewer, XMLAccess xmlAccess, Boolean selectable)
          Constructor.
 
Method Summary
protected  void createEditPolicies()
          Installs adition policies - text policies.
 void deselect()
          Deselects anything selected.
 org.eclipse.gef.DragTracker getDragTracker(org.eclipse.gef.Request request)
           
protected  org.eclipse.gef.GraphicalViewer getGraphicalViewer()
          Getter for graphical viewer.
 List getModelChildren()
          Returns empty list, because can't have children.
 String getPreviousText()
          Returns text from node before keeper's text.
 ITextPieceSelectionStatus getSelectionStatus()
          Returns status about which text is selected.
 String getText()
          Returns text hold by this ITextPieceKeeper which is the same as text displayed by figure of this editpart.
 ITextPieceContainer getTextContainer()
          Returns ITextPieceContainer where keeper is held.
 ITextLocator getTextLocator()
          Returns ITextLocator for this keeper.
 ITextPieceInfo getTextPieceInfo()
          Returns ITextPieceInfo about keeper's text piece.
protected  org.eclipse.gef.EditPolicy getUnderstandingPolicy(org.eclipse.gef.Request request)
          Returns first policy that understands request.
 String getWholeContainerText()
           
 String getWholeTextToPosition(int index)
          Returns text before keeper's text from node + substring of keeper's text to position index.
protected  XMLAccess getXmlAccess()
           
 void performRequest(org.eclipse.gef.Request req)
          Finds Understaning policy, gets command from this policy and put it to command stack for execute.
 void select()
          Selects whole text.
 void select(int start, int end)
          Selects text starting at position start and ending at position end - 1.
 void setTextContainer(TextPieceContainer textContainer)
          Sets text container and text info from that container.
 
Methods inherited from class sk.uniba.euromath.editor.xmlEditor.editParts.XMLEditPart
addChildVisual, computeModelChildren, createFigure, getID, getNavigationSiblings, getTargetEditPart, getXMLEditPartFactory, isSelectable, refreshVisuals, removeChildVisual, setID, setSelectability
 
Methods inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart
activate, addNodeListener, addNotify, addSourceConnection, addTargetConnection, createConnection, createOrFindConnection, deactivate, fireRemovingSourceConnection, fireRemovingTargetConnection, fireSourceConnectionAdded, fireTargetConnectionAdded, getAdapter, getContentPane, getFigure, getLayer, getModelSourceConnections, getModelTargetConnections, getSourceConnections, getTargetConnections, primAddSourceConnection, primAddTargetConnection, primRemoveSourceConnection, primRemoveTargetConnection, refresh, refreshSourceConnections, refreshTargetConnections, registerVisuals, removeNodeListener, removeNotify, removeSourceConnection, removeTargetConnection, reorderChild, reorderSourceConnection, reorderTargetConnection, setFigure, setLayoutConstraint, unregisterVisuals
 
Methods inherited from class org.eclipse.gef.editparts.AbstractEditPart
activateEditPolicies, addChild, addEditPartListener, createChild, deactivateEditPolicies, debug, debugFeedback, eraseSourceFeedback, eraseTargetFeedback, fireActivated, fireChildAdded, fireDeactivated, fireRemovingChild, fireSelectionChanged, getAccessibleEditPart, getChildren, getCommand, getEditPolicy, getEditPolicyIterator, getEventListeners, getFlag, getModel, getParent, getRoot, getSelected, getViewer, hasFocus, installEditPolicy, isActive, refreshChildren, register, registerAccessibility, registerModel, removeChild, removeEditPartListener, removeEditPolicy, setFlag, setFocus, setModel, setParent, setSelected, showSourceFeedback, showTargetFeedback, toString, understandsRequest, unregister, unregisterAccessibility, unregisterModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.gef.EditPart
addEditPartListener, eraseSourceFeedback, eraseTargetFeedback, getChildren, getCommand, getEditPolicy, getModel, getParent, getRoot, getSelected, getViewer, hasFocus, installEditPolicy, isActive, removeEditPartListener, removeEditPolicy, setFocus, setModel, setParent, setSelected, showSourceFeedback, showTargetFeedback, understandsRequest
 

Constructor Detail

TextEditPart

public TextEditPart(ITextLocator figure,
                    CaretManager cManager,
                    org.eclipse.gef.GraphicalViewer graphicalViewer,
                    XMLAccess xmlAccess,
                    Boolean selectable)
Constructor.

Parameters:
figure - displaying text piece
cManager - CaretManager
graphicalViewer - graphical viewer reference
xmlAccess - xml access reference
selectable - flag if is selectable
Method Detail

getDragTracker

public org.eclipse.gef.DragTracker getDragTracker(org.eclipse.gef.Request request)
Specified by:
getDragTracker in interface org.eclipse.gef.EditPart
Overrides:
getDragTracker in class XMLEditPart
Parameters:
request - can be anything, the result does not depent on request
Returns:
TextDragTracker or null
See Also:
EditPart.getDragTracker(org.eclipse.gef.Request)

createEditPolicies

protected void createEditPolicies()
Installs adition policies - text policies.

Overrides:
createEditPolicies in class XMLEditPart

getModelChildren

public List getModelChildren()
Returns empty list, because can't have children.

Overrides:
getModelChildren in class XMLEditPart
Returns:
empty list

getUnderstandingPolicy

protected org.eclipse.gef.EditPolicy getUnderstandingPolicy(org.eclipse.gef.Request request)
Returns first policy that understands request.

Parameters:
request - to understand
Returns:
policy which understands request and null otherwise

performRequest

public void performRequest(org.eclipse.gef.Request req)
Finds Understaning policy, gets command from this policy and put it to command stack for execute.

Specified by:
performRequest in interface org.eclipse.gef.EditPart
Overrides:
performRequest in class org.eclipse.gef.editparts.AbstractEditPart
Parameters:
req - Request

getText

public String getText()
Returns text hold by this ITextPieceKeeper which is the same as text displayed by figure of this editpart.

Specified by:
getText in interface ITextPieceKeeper
Returns:
text displayed by figure of this editpart

getTextLocator

public ITextLocator getTextLocator()
Description copied from interface: ITextPieceKeeper
Returns ITextLocator for this keeper.

Specified by:
getTextLocator in interface ITextPieceKeeper
Returns:
TextAreaFigure that is ITextLocator
See Also:
ITextPieceKeeper.getTextLocator()

getTextPieceInfo

public ITextPieceInfo getTextPieceInfo()
Description copied from interface: ITextPieceKeeper
Returns ITextPieceInfo about keeper's text piece.

Specified by:
getTextPieceInfo in interface ITextPieceKeeper
Returns:
info for keeped text
See Also:
ITextPieceKeeper.getTextPieceInfo()

getSelectionStatus

public ITextPieceSelectionStatus getSelectionStatus()
Description copied from interface: ITextPieceKeeper
Returns status about which text is selected.

Specified by:
getSelectionStatus in interface ITextPieceKeeper
Returns:
TextPieceSelectionStatusImpl
See Also:
ITextPieceSelectionStatus#getStatus()

select

public void select()
Description copied from interface: ITextPieceKeeper
Selects whole text.

Specified by:
select in interface ITextPieceKeeper
See Also:
ITextPieceKeeper.select()

select

public void select(int start,
                   int end)
Description copied from interface: ITextPieceKeeper
Selects text starting at position start and ending at position end - 1.

Specified by:
select in interface ITextPieceKeeper
Parameters:
start - index of first character in the selection
end - index of first character that is not in the selection
See Also:
ITextPieceKeeper.select(int, int)

deselect

public void deselect()
Description copied from interface: ITextPieceKeeper
Deselects anything selected.

Specified by:
deselect in interface ITextPieceKeeper
See Also:
ITextPieceKeeper.deselect()

getGraphicalViewer

protected org.eclipse.gef.GraphicalViewer getGraphicalViewer()
Getter for graphical viewer.

Returns:
graphical viewer

getTextContainer

public ITextPieceContainer getTextContainer()
Description copied from interface: ITextPieceKeeper
Returns ITextPieceContainer where keeper is held.

Specified by:
getTextContainer in interface ITextPieceKeeper
Returns:
container containing this keeper
See Also:
ITextPieceKeeper.getTextContainer()

setTextContainer

public void setTextContainer(TextPieceContainer textContainer)
Sets text container and text info from that container.

Parameters:
textContainer -

getPreviousText

public String getPreviousText()
Description copied from interface: ITextPieceKeeper
Returns text from node before keeper's text.

Specified by:
getPreviousText in interface ITextPieceKeeper
Returns:
substring of textual node's text, with start index 0 to offset of first character of keeper's text in node's text.
See Also:
ITextPieceKeeper.getPreviousText()

getWholeContainerText

public String getWholeContainerText()
Returns:
Text in the Container, that should by not very different from text in TextNode

getWholeTextToPosition

public String getWholeTextToPosition(int index)
Description copied from interface: ITextPieceKeeper
Returns text before keeper's text from node + substring of keeper's text to position index. Character at position index is not included (it is like substring).

Specified by:
getWholeTextToPosition in interface ITextPieceKeeper
Parameters:
index - local position in text
Returns:
substring of textual node's text, with start index 0 to (offset of first character of keeper's text + position) in node's text.
See Also:
ITextPieceKeeper.getWholeTextToPosition(int)

getXmlAccess

protected XMLAccess getXmlAccess()
Returns:
Returns the xmlAccess.


Copyright © 2003-2006 null. All Rights Reserved.