1.1 --- a/PLSQL/Formatter/src/org/netbeans/modules/plsql/format/PlsqlFormatter.java Mon Jun 10 19:29:46 2013 +0200
1.2 +++ b/PLSQL/Formatter/src/org/netbeans/modules/plsql/format/PlsqlFormatter.java Thu Jun 13 10:27:25 2013 +0530
1.3 @@ -787,7 +787,11 @@
1.4 TokenItem previousWhen = getPreviousWhenThenBlock(previousNWS);
1.5
1.6 if (previousWhen != null) {
1.7 - indent = getIndentationDiff(previousWhen, previousNWS);
1.8 + indent = getIndentationDiff(previousWhen, previousNWS);
1.9 + }
1.10 + if(previousWhen == null && (previousNWS.getImage().equalsIgnoreCase("CASE") || previousNWS.getImage().equalsIgnoreCase("EXCEPTION")
1.11 + || getPreviousKeyword(previousNWS).getImage().trim().equalsIgnoreCase("CASE"))){
1.12 + indent = getTabSize();
1.13 }
1.14 } else if (currentImage.equalsIgnoreCase("END") || currentImage.equalsIgnoreCase("$END")) {
1.15 //END can be ending BEGIN, EXCEPTION, LOOP, IF
1.16 @@ -1550,13 +1554,16 @@
1.17 if ((imageTmp.equalsIgnoreCase("$ERROR"))
1.18 || (imageTmp.equalsIgnoreCase("BEGIN"))
1.19 || (imageTmp.equalsIgnoreCase("EXCEPTION"))
1.20 + || (imageTmp.equalsIgnoreCase("CASE"))
1.21 || (imageTmp.equalsIgnoreCase("LOOP"))) {
1.22 break;
1.23 } else if ((imageTmp.equalsIgnoreCase(";"))
1.24 && (tokenThen != null)) {
1.25 //Don't catch IF-THEN
1.26 break;
1.27 - } else if ((imageTmp.equalsIgnoreCase("WHEN"))
1.28 + }else if(imageTmp.equalsIgnoreCase("IF") && (tokenThen != null)) {
1.29 + tokenThen = null;
1.30 + }else if ((imageTmp.equalsIgnoreCase("WHEN"))
1.31 && (tokenThen != null)) {
1.32 tokenWhen = tokenTemp;
1.33 break;