Show
Ignore:
Timestamp:
09/04/10 13:04:29 (21 months ago)
Author:
stefan
Message:

quick hack to fix bug #55: \newcommand template throws an exception after skipping the optional parameters

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/sce/codehelper/StaticCommandsCodeHelper.java

    r771 r836  
    134134      if (commandUsage.substring(argumentEnd).trim().startsWith("]")) optional = true; 
    135135 
     136      boolean secondOptional = false; 
     137      if (optional) { 
     138        if (commandUsage.substring(0, argumentStart-1).trim().endsWith("]")) { 
     139          secondOptional = true; 
     140          command.setUsage(commandUsage.replaceAll("\\[@" + argumentName + "@\\]", "")); 
     141          continue; 
     142        } 
     143      } 
     144 
    136145      // create the argument 
    137       CHCommandArgument argument = new CHCommandArgument(argumentName, optional); 
     146      CHCommandArgument argument = new CHCommandArgument(argumentName, optional, secondOptional); 
    138147      argument.setHint(argumentXML.getAttribute("hint")); 
    139148