CamouflagePlugin Plugin v0.6

http://www.intellij.org/twiki/bin/view/Main/CamouflagePlugin

- bugfix
- added in v0.6 :

  • Camouflage log4j statements that follow the "if (isEnabled..)" pattern :


- only 1 line in the then branch
- same level in the condition, and in the then statement

Example: will be camouflaged
-


if (aLogger.isEnabledFor(Level.]]>) ){
aLogger.xxx ("message", ..)
}

or

if (aLogger.isDebugEnabledFor() ){
aLogger.log(Level.XXX, "message", ..)
}


Example: will NOT be camouflaged
-


if (aLogger.isEnabledFor(Level.ALL) ){
aLogger.debug ("message", ..)
}


(Note: can be associated to the AllAll intention, through the
configration ui)





Attachment(s):
log4jcamouflaging.png
4 comments
Comment actions Permalink

Alain, your plugin looks great, but the question remains:

- is there a possibility to permanently turn of all camouflages,
or I must invoke intention in each class where I want them
to be turned on?



0
Comment actions Permalink

Michal ,

>- is there a possibility to permanently turn of all camouflages,
>or I must invoke intention in each class where I want them
>to be turned on?

>

As the CamouflagePlugin provides its services through intentions, you
don't "turn them on/off", but you must call them where you need them.

The "Camouflage AllAll' intention is quite powerful as, with one key
press, it applies all the camouflages to all the current class
elements, depending on the options turned on in the IDE settings.

It's not exactly what you request, but I'll soon add the possibility to
process many classes/packages/the whole project in one go, through the
project and package view. As this plugin uses code folding to do its
magic, I don't think a live mode is practical/a good idea.

Alain

0
Comment actions Permalink


Alain Ravet wrote:

  • * Camouflage log4j statements that follow the "if (isEnabled..)" pattern :


Cool. That was fast. It has some problems though:

- Given the code below, with the caret at the |, the "Camouflage all log4j ifs" does
not work. Nothing happens when invoking it. Same with caret on class-level and the
ALL-ALL intention. Looks like the problem is the outer "if" around the inner one.

public static void main(String[] args) {
if (args != null) {
if (LOG.isDebugEnabled()) {
LOG.debug("debug...");|
}
}
}

- On the same code, the intention is shown even when the "if" is already folded. Invoking
the intention does nothing but moving the caret one line up.

- Another one, related to the one above: After invoking the intention on an already folded
region, the editor starts to behave strangely when moving through the folded area. Might be
a problem of the Folding API though.

- Is there a possibility to listen for unfolding events and unfold the closing brace when the
"if" gets unfolded? It looks a little strange when there's only the "if" visible but not the closing
brace...

- A little typo: "camouflage this log4j state_te_ment"


Configuration UI:

- The labels are not clickable. One has to click the checkbox to actually check it.


Thanks for the work,

Sascha


0
Comment actions Permalink


Sascha Weinreuter wrote:

>.. It has some problems though:

>

Fixed in v0.7 :


>- Is there a possibility to listen for unfolding events and unfold the closing brace when the
>"if" gets unfolded? It looks a little strange when there's only the "if" visible but not the closing
>brace...
>

>

High on the todo list.

Alain

0

Please sign in to leave a comment.