Help with structural search and replace?

I want to make all field modifieres public that are annotated with a certain annotation e.g. @UiField. Currently the modifier might be anything else than public. I tried the templates below but the problems are; I miss e.g. protected and private fields and parameters of the @UiField annotation go mission on the replacement code (so @UiField ($Params$) doesn't capture the params). Can you please tell me how I make this the right way?

@UiField ($Params$) @Modifier("packageLocal") $FieldType$ $FieldName$ = $Init$;



@UiField ($Params$) public $FieldType$ $FieldName$ = $Init$;

1 comment
Comment actions Permalink

Didn't try your case, but according to what I was playing around in the last hours you can add a script constraint to your $FieldName$:

!__context__.hasModifierProperty(com.intellij.psi.PsiModifier.PUBLIC)

Another (potentially equivalent) is to add the script on "Complete Match", but use !FieldName.has... instead of __context__.

0

Please sign in to leave a comment.