title: BIRT: How to remove a dataset parameter programmatically
body: <p>I want to modify an existing *.rptdesign file and save it under a new name.
  The existing file contains a <code>Data Set</code> with a template SQL select statement and several DS parameters.
  I'd like to use an actual SQL select statement which uses only part of the DS parameters.</p>
  
  <p>However, the following code results in the exception:</p>
  
  <pre><code>Exception in thread "main" `java.lang.RuntimeException`: *The structure is floating, and its handle is invalid!*
  at org.eclipse.birt.report.model.api.StructureHandle.getStringProperty(StructureHandle.java:207)
  at org.eclipse.birt.report.model.api.DataSetParameterHandle.getName(DataSetParameterHandle.java:143)
  at org.eclipse.birt.report.model.api.DataSetHandle$DataSetParametersPropertyHandle.removeParamBindingsFor(DataSetHandle.java:851)
  at org.eclipse.birt.report.model.api.DataSetHandle$DataSetParametersPropertyHandle.removeItems(DataSetHandle.java:694)
  </code></pre>
  
  <p>--</p>
  
  <pre><code>    OdaDataSetHandle dsMaster = (OdaDataSetHandle) report.findDataSet("Master");
  
      HashSet&lt;String&gt; bindVarsUsed = new HashSet&lt;String&gt;();
      ...
      // find out which DS parameters are actually used
      HashSet&lt;String&gt; bindVarsUsed = new HashSet&lt;String&gt;();
      ...
      ArrayList&lt;OdaDataSetParameterHandle&gt; toRemove = new ArrayList&lt;OdaDataSetParameterHandle&gt;();
      for (Iterator iter = dsMaster.parametersIterator(); iter.hasNext(); ) {
          OdaDataSetParameterHandle dsPara = (OdaDataSetParameterHandle)iter.next();
          String name = dsPara.getName();
          if (name.startsWith("param_")) {
              String bindVarName = name.substring(6);
              if (!bindVarsUsed.contains(bindVarName)) {
                  toRemove.add(dsPara);
              }
          }
      }
      PropertyHandle paramsHandle = dsMaster.getPropertyHandle( OdaDataSetHandle.PARAMETERS_PROP );
      paramsHandle.removeItems(toRemove);
  </code></pre>
  
  <p>What is wrong here?
  Has anyone used the DE API to remove parameters from an existing Data Set?</p>