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
FieldsModifier and TypeFieldDescriptionstatic final PositionInfoThePositionInfowhich represent an insert at the beginning of the list.static final PositionInfoThePositionInfowhich represent an insert at the end of the list. -
Constructor Summary
ConstructorsConstructorDescriptionPositionInfo(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.intReturns the additional information which is needed to place an element as an int.static PositionInfoCreates aPositionInfoobject out of the given positioning string.toString()
-
Field Details
-
FIRST
ThePositionInfowhich represent an insert at the beginning of the list. -
LAST
ThePositionInfowhich 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 thepositionisnull
-
-
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
nullif 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 thepositionReferencecan't be parsed to an intNullPointerException- if thepositionReferenceisnull
-
parse
Creates aPositionInfoobject 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
PositionInfowhich holds all the data mentioned in the positioning string, ornullif the positioning string doesn't hold a positioning information
-
toString
-