+5
At 09:15 01.03.02 +0100, you wrote:
>In the same direction, I'd like an
> "Invert boolean expression"
>refactoring.
>
>
>
>Before :
>--------
> final boolean errorDetected = ( errorMessage.length() != 0 ) ;
> ..
> if (! errorDetected ) {
> ...
> }
>
>To :
>----
> final boolean noErrorDetected = !( errorMessage.length() != 0 )
> or, better
> final boolean noErrorDetected = ( errorMessage.length() == 0 ) ;
> ..
> if ( noErrorDetected ) {
> ...
> }
>
>
>Alain Ravet
>
>
>
>
>----- Original Message -----
>"Bissell, Tim" wrote
> > One refactoring I'd love to have is one which inverts
> > an if-else statement; i.e.
> >
> >
> >
> > if (an-expr){
> > BLOCK-1
> > }
> > else {
> > BLOCK-2
> > }
> >
> > all to often I decide it would make more sense if it
> > looked like:
> >
> > if (!(an-expr)) {
> > BLOCK-2
> > }
> > else {
> > BLOCK-1
> > }
> >
> > I'd love to be able to right-click>refactor>invert-if
> > on the if keyword, even if I have to simplify the expression
> > by hand (e.g. (!(x == y)) to (x != y) ) by hand afterwards;
> > it is moving the compound statements about which is a pain.
_______________________________________________
Eap-list mailing list
[EMAIL PROTECTED]
http://www.intellij.com/mailman/listinfo/eap-list