public int getInsertOffset ( XtendTypeDeclaration container ) { if ( container . getMembers ( ) . isEmpty ( ) ) { final ICompositeNode node = NodeModelUtils . findActualNodeFor ( container ) ; final ILeafNode openingBraceNode = IterableExtensions . findFirst ( node . getLeafNodes ( ) , lnode -> "{" . equals ( lnode . getText ( ) ) ) ; //$NON-NLS-1$ if ( openingBraceNode != null ) { return openingBraceNode . getOffset ( ) + 1 ; } return node . getEndOffset ( ) ; } final EObject lastFeature = IterableExtensions . last ( container . getMembers ( ) ) ; final ICompositeNode node = NodeModelUtils . findActualNodeFor ( lastFeature ) ; return node . getEndOffset ( ) ; }
Replies the index where elements could be inserted into the given container .