private void removeAnnotationsFromLocationsList( ModifierInfo modifierInfo ) { List<ParseTree> locs = getLocationsList(); for( int i = locs.size()-1; i >= 0; i-- ) { ParseTree csr = locs.get( i ); for( IGosuAnnotation ann: modifierInfo.getAnnotations() ) { if( csr == ann.getExpression().getLocation() ) { locs.remove( i ); } } } }
private int getArgIndex() { IParsedElement function = _editor.getFunctionCallAtCaret(); if( function == null ) { return -1; } int iCaretPos = _editor.getEditor().getCaretPosition(); List args = function.getLocation().getChildren(); int iNonArgLocations = 0; for( int i = args.size() - 1; i >= 0; i-- ) { IParseTree location = (IParseTree)args.get( i ); if( (function instanceof IBeanMethodCallExpression && ((IBeanMethodCallExpression)function).getRootExpression().getLocation().contains( location )) || (function instanceof INewExpression && !Arrays.stream( ((INewExpression)function).getArgs() ).anyMatch( e -> e.equals( location.getParsedElement() ) )) ) { iNonArgLocations++; } else if( location.getExtent() + 1 >= iCaretPos ) { return (args.size() - 1) - i - iNonArgLocations; } } return Math.max( 0, args.size() - 1 - iNonArgLocations ); }
int getCaretPositionForValueCompletion( IParseIssue e ) { int iErrorPos = e.getSource().getLocation().getOffset(); int iCaretPos = _editor.getCaretPosition(); if( getExpressionAtCaret() == null || !AbstractParseExceptionResolver.shouldPositionAtStartOfElement( getExpressionAtCaret().getLocation(), _editor ) ) { return iCaretPos; } if( iErrorPos <= iCaretPos || TextComponentUtil.isNonWhitespaceBetween( _editor, iCaretPos, iErrorPos ) ) { return iErrorPos; } return iCaretPos; }
int ext = ma.getRootExpression().getLocation().getExtent(); return buffer.indexOf( '.', ext ) + 1;
int ext = ma.getRootExpression().getLocation().getExtent(); return buffer.indexOf( '.', ext ) + 1;
public void stateChanged( ChangeEvent e ) { BeanTree beanInfoSelection = (BeanTree)e.getSource(); String strRef = beanInfoSelection.makePath( false ); try { String strRoot = getGosuEditor().getEditor().getText( currentLocation.getOffset(), ma.getRootExpression().getLocation().getLength() ); getGosuEditor().replaceLocation( currentLocation, strRoot + '.' + strRef ); } catch( BadLocationException e1 ) { throw new RuntimeException( e1 ); } getEditor().requestFocus(); getGosuEditor().fixSwingFocusBugWhenPopupCloses(); getEditor().repaint(); } } );
IParseTree location = exprAtCaret.getLocation(); if( location != null )
IParseTree location = exprAtCaret.getLocation(); if( location != null )