Class AbstractDirectEditingFeature

java.lang.Object
org.eclipse.graphiti.features.impl.AbstractFeature
org.eclipse.graphiti.features.impl.AbstractDirectEditingFeature
All Implemented Interfaces:
IDirectEditingFeature, IFeature, IFeatureProviderHolder, IDirectEditing, IDescription, IName
Direct Known Subclasses:
DirectEditingFeatureForPattern

public abstract class AbstractDirectEditingFeature extends AbstractFeature implements IDirectEditingFeature
The Class AbstractDirectEditingFeature.
  • Field Details

    • EMPTY_STRING_ARRAY

      protected static final String[] EMPTY_STRING_ARRAY
      The Constant EMPTY_STRING_ARRAY.
  • Constructor Details

  • Method Details

    • canExecute

      public boolean canExecute(IContext context)
      Description copied from interface: IFeature
      Decides if the current feature can execute with the given context.
      Specified by:
      canExecute in interface IFeature
      Parameters:
      context - this is the general input for this method
      Returns:
      true if the feature can be executed, false if not
      See Also:
    • canDirectEdit

      public boolean canDirectEdit(IDirectEditingContext context)
      Description copied from interface: IDirectEditing
      Checks if the feature can perform direct editing on the context handed over.
      Specified by:
      canDirectEdit in interface IDirectEditing
      Parameters:
      context - the context
      Returns:
      This method is equivalent to
      See Also:
    • execute

      public void execute(IContext context)
      Description copied from interface: IFeature
      Executes the current feature with the given context.
      Specified by:
      execute in interface IFeature
      Parameters:
      context - this is the general input for this method
      See Also:
    • hasDoneChanges

      public boolean hasDoneChanges()
      Returns true only if the direct editing feature really has changed anything. This is indicated by the execution of the feature in the DirectEditingFeatureCommandWithContext.execute method.
      Specified by:
      hasDoneChanges in interface IFeature
      Overrides:
      hasDoneChanges in class AbstractFeature
      Returns:
      true if the feature should appear in the undo stack, false otherwise
    • setValueChanged

      public final void setValueChanged()
      Called by the framework (@see DirectEditingFeatureCommandWithContext) to indicate that this direct editing feature execution has really changed something. Only in this case there should be an entry in the undo stack and the editor should get dirty.
    • getPossibleValues

      public String[] getPossibleValues(IDirectEditingContext context)
      Description copied from interface: IDirectEditing
      This value will be used if the cell editor is a combo box. This functionality only applies to TYPE_DROPDOWN.
      Specified by:
      getPossibleValues in interface IDirectEditing
      Parameters:
      context - the context
      Returns:
      the possible values for the combo box.
    • getValueProposals

      public String[] getValueProposals(String value, int caretPos, IDirectEditingContext context)
      Description copied from interface: IDirectEditing
      This proposals will be used for the completion list of a simple text cell editor. This functionality only applies to TYPE_TEXT.
      Specified by:
      getValueProposals in interface IDirectEditing
      Parameters:
      value - current value
      caretPos - current cursor position
      context - the context
      Returns:
      the proposed values
    • checkValueValid

      public String checkValueValid(String value, IDirectEditingContext context)
      Description copied from interface: IDirectEditing
      This method will be called by clients many times to see if current value is valid and could be set.
      Specified by:
      checkValueValid in interface IDirectEditing
      Parameters:
      value - the value
      context - the context
      Returns:
      null if value is okay and could be set; any text means value is not valid; text is reason for invalidality
    • completeValue

      public String completeValue(String value, int caretPos, String choosenValue, IDirectEditingContext context)
      Description copied from interface: IDirectEditing
      Framework calls this method to let the feature calculate the new value.
      Specified by:
      completeValue in interface IDirectEditing
      Parameters:
      value - current value
      caretPos - current cursor position
      choosenValue - value choosen by user
      context - the context
      Returns:
      the new value
    • stretchFieldToFitText

      public boolean stretchFieldToFitText()
      Description copied from interface: IDirectEditing
      Stretch input field to fit its contents. This functionality applies to TYPE_TEXT, TYPE_DROPDOWN and TYPE_DROPDOWN_READ_ONLY.
      Specified by:
      stretchFieldToFitText in interface IDirectEditing
      Returns:
      true if the field should exactly fit the contents
    • isAutoCompletionEnabled

      public boolean isAutoCompletionEnabled()
      Description copied from interface: IDirectEditing
      Checks if auto completion is enabled. This functionality only applies to TYPE_TEXT.
      Specified by:
      isAutoCompletionEnabled in interface IDirectEditing
      Returns:
      true, if proposals should appear automatically
    • isCompletionAvailable

      public boolean isCompletionAvailable()
      Description copied from interface: IDirectEditing
      Checks if completion is available. This functionality only applies to TYPE_TEXT.
      Specified by:
      isCompletionAvailable in interface IDirectEditing
      Returns:
      true if completion is / proposals are available at all
    • getName

      public String getName()
      Description copied from interface: IName
      Gets the name.
      Specified by:
      getName in interface IName
      Overrides:
      getName in class AbstractFeature
      Returns:
      the name
    • getProposalSupport

      public IProposalSupport getProposalSupport()
      Description copied from interface: IDirectEditing
      The direct editing mode contains controls for code completion and the selection from a combo box. In both cases the standard implementation supports only strings.

      If the customer wants to work with Objects he must provide an implementation of IProposalSupport. In this case the following methods of IDirectEditing are ignored:


      * String checkValueValid(String value, IDirectEditingContext context);
      * String completeValue(String value, int caretPosition, String choosenValue, IDirectEditingContext context);
      * String[] getPossibleValues(IDirectEditingContext context);
      * String[] getValueProposals(String value, int caretPosition, IDirectEditingContext context);
      * void setValue(String value, IDirectEditingContext context);

      Specified by:
      getProposalSupport in interface IDirectEditing
      Returns:
      the special implementation to support Objects in code completion and combo box
      Since:
      0.8
    • setValue

      public void setValue(String value, IDirectEditingContext context)
      Description copied from interface: IDirectEditing
      Set the new value. The value comes from the text editing UI component.
      Specified by:
      setValue in interface IDirectEditing
      Parameters:
      value - the value
      context - the context
      Since:
      0.8