Package org.eclipse.e4.ui.model.internal
Class PositionInfo
java.lang.Object
org.eclipse.e4.ui.model.internal.PositionInfo
A holder class for the full information to position an element in a list.
- Author:
- René Brandstetter
-
Field Summary
Modifier and TypeFieldDescriptionstatic final PositionInfo
ThePositionInfo
which represent an insert at the beginning of the list.static final PositionInfo
ThePositionInfo
which represent an insert at the end of the list. -
Constructor Summary
ConstructorDescriptionPositionInfo
(Position position, String positionReference) Creates an instance of the PositionInfo. -
Method Summary
Modifier and TypeMethodDescriptionReturns the kind/type of positioning which should be used.Returns additional information which is needed to place an element.int
Returns the additional information which is needed to place an element as an int.static PositionInfo
Creates aPositionInfo
object out of the given positioning string.toString()
-
Field Details
-
FIRST
ThePositionInfo
which represent an insert at the beginning of the list. -
LAST
ThePositionInfo
which represent an insert at the end of the list.
-
-
Constructor Details
-
PositionInfo
Creates an instance of the PositionInfo.- Parameters:
position
- the kind of the positioningpositionReference
- additional information which is need to position an element (e.g.: index, ID of another element)- Throws:
NullPointerException
- if theposition
isnull
-
-
Method Details
-
getPosition
Returns the kind/type of positioning which should be used.- Returns:
- the position
-
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 thepositionReference
can't be parsed to an intNullPointerException
- if thepositionReference
isnull
-
parse
Creates aPositionInfo
object out of the given positioning string.Examples for a positioning string:
last
- place an element to the end of a listfirst
- place an element to the beginning of a listindex:3
- place an element at the provided index 3 in a listbefore: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, ornull
if the positioning string doesn't hold a positioning information
-
toString
-