Class PositionInfo

java.lang.Object
org.eclipse.e4.ui.model.internal.PositionInfo

public final class PositionInfo extends Object
A holder class for the full information to position an element in a list.
Author:
René Brandstetter
  • Field Details

  • Constructor Details

    • PositionInfo

      public PositionInfo(Position position, String positionReference)
      Creates an instance of the PositionInfo.
      Parameters:
      position - the kind of the positioning
      positionReference - additional information which is need to position an element (e.g.: index, ID of another element)
      Throws:
      NullPointerException - if the position is null
  • Method Details

    • getPosition

      public Position getPosition()
      Returns the kind/type of positioning which should be used.
      Returns:
      the position
    • getPositionReference

      public String getPositionReference()
      Returns additional information which is needed to place an element.
      Returns:
      the positionReference, or null if no additional information is given
    • getPositionReferenceAsInteger

      public int getPositionReferenceAsInteger()
      Returns the additional information which is needed to place an element as an int.
      Returns:
      the positionReference as an int
      Throws:
      NumberFormatException - if the positionReference can't be parsed to an int
      NullPointerException - if the positionReference is null
    • parse

      public static PositionInfo parse(String positionInfo)
      Creates a PositionInfo object out of the given positioning string.

      Examples for a positioning string:

      • last - place an element to the end of a list
      • first - place an element to the beginning of a list
      • index:3 - place an element at the provided index 3 in a list
      • before:org.eclipse.test.id - place an element in a list in front of the element with the ID "org.eclipse.test.id"
      • after:org.eclipse.test.id - place an element in a list after the element with the ID "org.eclipse.test.id"
      Parameters:
      positionInfo - the positioning string
      Returns:
      a PositionInfo which holds all the data mentioned in the positioning string, or null if the positioning string doesn't hold a positioning information
    • toString

      public String toString()
      Overrides:
      toString in class Object