Runtime

## org.eclipse.gmf.runtime.diagram.ui.editparts
Class TextCompartmentEditPart

    java.lang.Object
      org.eclipse.gef.editparts.AbstractEditPart
          org.eclipse.gef.editparts.AbstractGraphicalEditPart
              org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart
                  org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart
                      org.eclipse.gmf.runtime.diagram.ui.editparts.TextCompartmentEditPart

All Implemented Interfaces:
  EditPart, GraphicalEditPart, IAdaptable, IAdaptableSelection, org.eclipse.gmf.runtime.diagram.ui.internal.editparts.IContainedEditPart, org.eclipse.gmf.runtime.diagram.ui.internal.editparts.IEditableEditPart, IGraphicalEditPart, ITextAwareEditPart, NotificationListener, RequestConstants

Direct Known Subclasses:
  ListItemEditPart

public class TextCompartmentEditPart
extends CompartmentEditPart
implements ITextAwareEditPart

yhe conroller for hte text compartment

Nested Class Summary

Nested classes inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart
`AbstractGraphicalEditPart.AccessibleGraphicalEditPart, AbstractGraphicalEditPart.DefaultAccessibleAnchorProvider`

Nested classes inherited from class org.eclipse.gef.editparts.AbstractEditPart
`AbstractEditPart.EditPolicyIterator`

Field Summary
`protected IParser` `parser` the text parser

Fields inherited from class org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart
`accessibleEP, elementGuid`

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
`TextCompartmentEditPart(EObject model)` coinstructor

Method Summary
`protected void` `addNotationalListeners()` This method adds all listeners to the notational world (views, figures, editpart...etc) Override this method to add more notational listeners down the hierarchy
`protected void` `addSemanticListeners()` This method adds all listeners to the semantic element behind this EditPart Override this method to add more semantic listeners down the hierarchy This method is called only if the semantic element is resolvable
`protected ParserOptions` `buildParserOptions()` Builds the parser options.
`protected void` `createDefaultEditPolicies()` Should be overridden to install editpolicies programmatically.
`protected IFigure` `createFigure()`
`protected WrapLabel` `createWrapLabel()`
`protected AccessibleEditPart` `getAccessibleEditPart()`
`IGraphicalEditPart` `getChildBySemanticHint(java.lang.String semanticHint)` There is no children to text compartments
`IContentAssistProcessor` `getCompletionProcessor()`
`java.lang.String` `getEditText()` Shortcut method to obtain edit text from parser.
`ICellEditorValidator` `getEditTextValidator()` Returns a validator for the user's edit text
`IFigure` `getFigure()` Use getLabel() instead if you which to get the WrapLabel for the the text compartent
`WrapLabel` `getLabel()` This should be used instead of getFigure() to get the figure
`protected Image` `getLabelIcon(int index)` gets the label Icon for this edit part
`protected java.lang.String` `getLabelText()` gets the label text
`protected IFigure` `getLabelToolTip()` Method getLabelToolTip.
`protected DirectEditManager` `getManager()`
`protected java.util.List` `getModelChildren()` Return this editpart's view (model) children.
`int` `getNumIcons()` getter for the Num Icons
`IParser` `getParser()` Method getParser.
`ParserOptions` `getParserOptions()` Gets the parser options.
`View` `getPrimaryChildView()` gets the primary child view for this edit part, this is usually used by direct edit requests, to see where the edit will happen
`protected java.lang.String` `getToolTipText()` This method can be overridden in the subclass to return text for the tooltip.
`protected void` `handleNotificationEvent(Notification event)` Handles the property changed event.
`protected boolean` `isAffectingParserOptions(Notification evt)` Determines if the given Notification affects the paser options
`protected boolean` `isAffectingParserOptions(java.beans.PropertyChangeEvent evt)` Determines if the given event affects the paser options
`protected boolean` `isEditable()` check if this edit part is editable or not
`protected void` `performDirectEdit()` performas direct edit
`protected void` `performDirectEdit(Point eventLocation)` Performs direct edit and will initiate another mouse click event so that the cursor will appear under the mouse
`protected void` `performDirectEditRequest(Request request)` Performs direct edit request based on request type
`protected void` `refreshFont()` Refresh the editpart's figure font.
`protected void` `refreshLabel()` Will update the tool tip text for the figure and also the icons for the label.
`protected void` `refreshParserOptions()` Builds the parser options.
`protected void` `refreshStrikeThrough()` Refreshes the font underline property
`protected void` `refreshUnderline()` Refreshes the font underline property
`protected void` `refreshVisuals()` Refresh the editpart's figure visual properties.
`protected void` `removeNotationalListeners()` This method removes all listeners to the notational world (views, figures, editpart...etc) Override this method to remove notational listeners down the hierarchy
`protected void` `removeSemanticListeners()` This method removes all listeners to the semantic element behind this EditPart Override this method to remove semantic listeners down the hierarchy
`protected void` `setFontColor(Color color)` sets the font color
`void` `setLabelText(java.lang.String text)` Called when edit text was modified and edit part should update itself to reflect the changes.
`protected void` `setManager(DirectEditManager manager)`
`void` `setNumIcons(int numIcons)` setter for the num icons

Methods inherited from class org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart
`getDragTracker, isSelectable`

Methods inherited from class org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart

`activate, addChild, addListenerFilter, addListenerFilter, basicGetModel, createConnection, createEditPolicies, deactivate, disableEditMode, enableEditMode, eraseSourceFeedback, eraseTargetFeedback, executeCommand, findEditPart, getAdapter, getChildBySemanticHintOnPrimaryView, getChildViewBySemanticHint, getCommand, getContentPaneFor, getDiagramEditDomain, getDiagramPreferencesHint, getDiagramView, getEditDomain, getEditingDomain, getMapMode, getModel, getNotationView, getPreferredValue, getPrimaryChildEditPart, getPrimaryView, getResourceManager, getRoot, getStructuralFeatureValue, getTopGraphicEditPart, handleMajorSemanticChange, hasNotationView, isCanonical, isEditModeEnabled, notifyChanged, performRequest, reactivateSemanticModel, refresh, refreshBackgroundColor, refreshChild, refreshFontColor, refreshForegroundColor, refreshSourceConnection, refreshTargetConnection, refreshVisibility, registerModel, removeListenerFilter, removeNotify, resolveSemanticElement, setBackgroundColor, setFont, setForegroundColor, setModel, setStructuralFeatureValue, setVisibility, showSourceFeedback, showTargetFeedback, transactionAboutToCommit, unregisterModel`

Methods inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart

`addChildVisual, addNodeListener, addNotify, addSourceConnection, addTargetConnection, createOrFindConnection, fireRemovingSourceConnection, fireRemovingTargetConnection, fireSourceConnectionAdded, fireTargetConnectionAdded, getContentPane, getLayer, getModelSourceConnections, getModelTargetConnections, getSourceConnections, getTargetConnections, primAddSourceConnection, primAddTargetConnection, primRemoveSourceConnection, primRemoveTargetConnection, refreshSourceConnections, refreshTargetConnections, registerVisuals, removeChildVisual, removeNodeListener, removeSourceConnection, removeTargetConnection, reorderChild, reorderSourceConnection, reorderTargetConnection, setFigure, setLayoutConstraint, unregisterVisuals`

Methods inherited from class org.eclipse.gef.editparts.AbstractEditPart

`activateEditPolicies, addEditPartListener, createChild, deactivateEditPolicies, debug, debugFeedback, fireActivated, fireChildAdded, fireDeactivated, fireRemovingChild, fireSelectionChanged, getChildren, getEditPolicy, getEditPolicyIterator, getEventListeners, getFlag, getParent, getSelected, getTargetEditPart, getViewer, hasFocus, installEditPolicy, isActive, refreshChildren, register, registerAccessibility, removeChild, removeEditPartListener, removeEditPolicy, setFlag, setFocus, setParent, setSelected, toString, understandsRequest, unregister, unregisterAccessibility`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface org.eclipse.gef.GraphicalEditPart
`addNodeListener, getContentPane, getSourceConnections, getTargetConnections, removeNodeListener, setLayoutConstraint`

Methods inherited from interface org.eclipse.gef.EditPart

`activate, addEditPartListener, addNotify, deactivate, eraseSourceFeedback, eraseTargetFeedback, getChildren, getCommand, getDragTracker, getEditPolicy, getModel, getParent, getRoot, getSelected, getTargetEditPart, getViewer, hasFocus, installEditPolicy, isActive, isSelectable, performRequest, refresh, removeEditPartListener, removeEditPolicy, removeNotify, setFocus, setModel, setParent, setSelected, showSourceFeedback, showTargetFeedback, understandsRequest`

Methods inherited from interface org.eclipse.core.runtime.IAdaptable
`getAdapter`

Field Detail

### parser

    protected IParser parser

  the text parser

Constructor Detail

### TextCompartmentEditPart

    public TextCompartmentEditPart(EObject model)

  coinstructor

Method Detail

### createDefaultEditPolicies

    protected void createDefaultEditPolicies()

  Description copied from class: `GraphicalEditPart`
  Should be overridden to install editpolicies programmatically.

  Overrides:
    `createDefaultEditPolicies` in class `CompartmentEditPart`

### createFigure

    protected IFigure createFigure()

  Overrides:
    `createFigure` in class `GraphicalEditPart`
  Returns:
    WrapLabelFigure

### createWrapLabel

    protected WrapLabel createWrapLabel()

  Returns:
    WrapLabel, the created wrap label

### getFigure

    public IFigure getFigure()

  Use getLabel() instead if you which to get the WrapLabel for the the text compartent

  Specified by:
    `getFigure` in interface `GraphicalEditPart`
  See Also:
    `GraphicalEditPart.getFigure()`

### getLabel

    public WrapLabel getLabel()

  This should be used instead of getFigure() to get the figure

  Returns:
    Return the WrapLabel for the TextCompartment

### getLabelIcon

    protected Image getLabelIcon(int index)

  gets the label Icon for this edit part

  Parameters:
    `index` - the index to use
  Returns:
    Image

### getLabelText

    protected java.lang.String getLabelText()

  gets the label text

  Returns:
    the lebel text

### getEditText

    public java.lang.String getEditText()

  Description copied from interface: `ITextAwareEditPart`
  Shortcut method to obtain edit text from parser.

  Specified by:
    `getEditText` in interface `ITextAwareEditPart`

### setLabelText

    public void setLabelText(java.lang.String text)

  Description copied from interface: `ITextAwareEditPart`
  Called when edit text was modified and edit part should update itself to reflect the changes.

  Specified by:
    `setLabelText` in interface `ITextAwareEditPart`

### getCompletionProcessor

    public IContentAssistProcessor getCompletionProcessor()

  Specified by:
    `getCompletionProcessor` in interface `ITextAwareEditPart`
  Returns:
    the `IContentAssistProcessor` that is a content assist processor proposes completions and computes context information for a particular content type

### getEditTextValidator

    public ICellEditorValidator getEditTextValidator()

  Description copied from interface: `ITextAwareEditPart`
  Returns a validator for the user's edit text

  Specified by:
    `getEditTextValidator` in interface `ITextAwareEditPart`
  Returns:
    a `ICellEditorValidator` for validating a cell editor's input.

### getParserOptions

    public final ParserOptions getParserOptions()

  Description copied from interface: `ITextAwareEditPart`
  Gets the parser options. The result is passed as a parameter to the parser's getPrintString() and isAffectingEvent() methods

  Specified by:
    `getParserOptions` in interface `ITextAwareEditPart`
  Returns:
    ParserOptions the parser options

### buildParserOptions

    protected ParserOptions buildParserOptions()

  Builds the parser options.

  Returns:
    ParserOptions the parser options

### refreshParserOptions

    protected final void refreshParserOptions()

  Builds the parser options.

### isAffectingParserOptions

    protected boolean isAffectingParserOptions(java.beans.PropertyChangeEvent evt)

  Determines if the given event affects the paser options

  Parameters:
    `evt` - The event in question
  Returns:
    whether the given event affects the parser options

### isAffectingParserOptions

    protected boolean isAffectingParserOptions(Notification evt)

  Determines if the given Notification affects the paser options

  Parameters:
    `evt` - The notification in question
  Returns:
    whether the given notification affects the parser options

### getLabelToolTip

    protected IFigure getLabelToolTip()

  Method getLabelToolTip.

  Returns:
    IFigure

### getToolTipText

    protected java.lang.String getToolTipText()

  This method can be overridden in the subclass to return text for the tooltip.

  Returns:
    String the tooltip

### isEditable

    protected boolean isEditable()

  check if this edit part is editable or not

  Returns:
    true or false

### performDirectEdit

    protected void performDirectEdit()

  performas direct edit

### performDirectEdit

    protected void performDirectEdit(Point eventLocation)

  Performs direct edit and will initiate another mouse click event so that the cursor will appear under the mouse

  Parameters:
    `eventLocation` -

### performDirectEditRequest

    protected void performDirectEditRequest(Request request)

  Performs direct edit request based on request type

  Overrides:
    `performDirectEditRequest` in class `GraphicalEditPart`
  Parameters:
    `request` - the direct edit request
  See Also:
    `org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#performDirectEditRequest(org.eclipse.gef.requests.DirectEditRequest)`

### handleNotificationEvent

    protected void handleNotificationEvent(Notification event)

  Description copied from class: `GraphicalEditPart`
  Handles the property changed event. Clients should override to respond to the specific notification events they are interested. Note: This method may get called on a non-UI thread. Clients should either ensure that their code is thread safe and/or doesn't make unsupported calls (i.e. Display.getCurrent() ) assuming they are on the main thread. Alternatively if this is not possible, then the client can wrap their handler within the Display.synchExec runnable to ensure synchronization and subsequent execution on the main thread.

  Overrides:
    `handleNotificationEvent` in class `GraphicalEditPart`
  Parameters:
    `event` - the `Notification` object that is the property changed event

### refreshVisuals

    protected void refreshVisuals()

  Description copied from class: `GraphicalEditPart`
  Refresh the editpart's figure visual properties.

  Overrides:
    `refreshVisuals` in class `GraphicalEditPart`

### refreshFont

    protected void refreshFont()

  Description copied from class: `GraphicalEditPart`
  Refresh the editpart's figure font.

  Overrides:
    `refreshFont` in class `GraphicalEditPart`

### setFontColor

    protected void setFontColor(Color color)

  Description copied from class: `GraphicalEditPart`
  sets the font color

  Overrides:
    `setFontColor` in class `GraphicalEditPart`
  Parameters:
    `color` - the new value of the font color

### addNotationalListeners

    protected void addNotationalListeners()

  Description copied from class: `GraphicalEditPart`
  This method adds all listeners to the notational world (views, figures, editpart...etc) Override this method to add more notational listeners down the hierarchy

  Overrides:
    `addNotationalListeners` in class `GraphicalEditPart`

### addSemanticListeners

    protected void addSemanticListeners()

  Description copied from class: `GraphicalEditPart`
  This method adds all listeners to the semantic element behind this EditPart Override this method to add more semantic listeners down the hierarchy This method is called only if the semantic element is resolvable

  Overrides:
    `addSemanticListeners` in class `GraphicalEditPart`

### removeNotationalListeners

    protected void removeNotationalListeners()

  Description copied from class: `GraphicalEditPart`
  This method removes all listeners to the notational world (views, figures, editpart...etc) Override this method to remove notational listeners down the hierarchy

  Overrides:
    `removeNotationalListeners` in class `GraphicalEditPart`

### removeSemanticListeners

    protected void removeSemanticListeners()

  Description copied from class: `GraphicalEditPart`
  This method removes all listeners to the semantic element behind this EditPart Override this method to remove semantic listeners down the hierarchy

  Overrides:
    `removeSemanticListeners` in class `GraphicalEditPart`

### getNumIcons

    public int getNumIcons()

  getter for the Num Icons

  Returns:
    num icons

### setNumIcons

    public void setNumIcons(int numIcons)

  setter for the num icons

  Parameters:
    `numIcons` -

### getModelChildren

    protected java.util.List getModelChildren()

  Description copied from class: `GraphicalEditPart`
  Return this editpart's view (model) children.

  Overrides:
    `getModelChildren` in class `GraphicalEditPart`
  Returns:
    list of views.

### getParser

    public IParser getParser()

  Description copied from interface: `ITextAwareEditPart`
  Method getParser.

  Specified by:
    `getParser` in interface `ITextAwareEditPart`
  Returns:
    the `IParser` that is used to retrieve the proper formating of the edit text and to create the actual editing command which will modify the model.

### refreshLabel

    protected void refreshLabel()

  Will update the tool tip text for the figure and also the icons for the label. In additional it will apply any font constraints to the label based on the type of Text Compartment we are dealing with. Any body overriding this method should either can this super.refreshLabel() or call applyFontContraintsToLabel() to ensure the the proper font constraints are apply to the label.

  See Also:
    `TextCompartmentEditPart.refreshLabel()`

### refreshUnderline

    protected void refreshUnderline()

  Refreshes the font underline property

### refreshStrikeThrough

    protected void refreshStrikeThrough()

  Refreshes the font underline property

### getAccessibleEditPart

    protected AccessibleEditPart getAccessibleEditPart()

  Overrides:
    `getAccessibleEditPart` in class `GraphicalEditPart`
  See Also:
    `AbstractEditPart.getAccessibleEditPart()`

### getChildBySemanticHint

    public IGraphicalEditPart getChildBySemanticHint(java.lang.String semanticHint)

  There is no children to text compartments

  Specified by:
    `getChildBySemanticHint` in interface `IGraphicalEditPart`
  Overrides:
    `getChildBySemanticHint` in class `GraphicalEditPart`
  Parameters:
    `semanticHint` -
  Returns:
    IGraphicalEditPart

### getManager

    protected DirectEditManager getManager()

  Returns:
    Returns the manager.

### setManager

    protected void setManager(DirectEditManager manager)

  Parameters:
    `manager` - The manager to set.

### getPrimaryChildView

    public View getPrimaryChildView()

  gets the primary child view for this edit part, this is usually used by direct edit requests, to see where the edit will happen

  Returns:
    `View`

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.