Community
Participate
Working Groups
I find the following template very useful and would suggest that it be included by default: Name: ifnotnull Description: if not null statement Pattern: if (${name} != null) { ${cursor} }
If we add this we should also add an 'ifnull' template.
In 3.3, the template should look like this (so one gets proposals for local variables): if (${v:var(java.lang.Object} != null) { ${cursor} }
I think it's best to add the one you like by your own. This allows you to decide whether you want the use the brackets or not.
The question of brackets is not different than the current templates we provide like "if statement". I think that programmers check "if not null" frequently enough that we should include the template by default. But of course, that's just my intuition.
Jared, I'm willing to do this if you provide the patch for the 'ifNull' and 'ifNotNull' templates. See bug 153880 for pending problems with the new template variable support.
ifnotnull and ifnull templates sound useful. I plan to provide a patch for them.
(In reply to Lars Vogel from comment #6) > ifnotnull and ifnull templates sound useful. I plan to provide a patch for > them. If so, please use the spelling suggested in comment 5.
New Gerrit change created: https://git.eclipse.org/r/57470
Gerrit change https://git.eclipse.org/r/57470 was merged to [master]. Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=17219a524865750c1c20cd321aebc0d649a7d675
Thanks for the patch, Lars. Released in master.
(In reply to Noopur Gupta from comment #10) > Thanks for the patch, Lars. Released in master. Thanks Noopur, great to get fast reviews from you! I feel motivated to do more.