Skip to content

Commit

Permalink
Add an inner sub class to perform different obtaining category list
Browse files Browse the repository at this point in the history
behavior.
  • Loading branch information
Xusong Yuan committed Nov 20, 2012
1 parent 58f20f4 commit 8c3ae88
Showing 1 changed file with 35 additions and 1 deletion.
Expand Up @@ -62,15 +62,19 @@
import org.eclipse.birt.report.designer.ui.views.attributes.providers.ChoiceSetFactory;
import org.eclipse.birt.report.designer.util.DEUtil;
import org.eclipse.birt.report.model.api.DataSetHandle;
import org.eclipse.birt.report.model.api.DesignElementHandle;
import org.eclipse.birt.report.model.api.Expression;
import org.eclipse.birt.report.model.api.ExpressionHandle;
import org.eclipse.birt.report.model.api.ExpressionType;
import org.eclipse.birt.report.model.api.FormatValueHandle;
import org.eclipse.birt.report.model.api.PropertyHandle;
import org.eclipse.birt.report.model.api.ReportDesignHandle;
import org.eclipse.birt.report.model.api.ReportItemHandle;
import org.eclipse.birt.report.model.api.ResultSetColumnHandle;
import org.eclipse.birt.report.model.api.ScalarParameterHandle;
import org.eclipse.birt.report.model.api.SelectionChoiceHandle;
import org.eclipse.birt.report.model.api.StructureFactory;
import org.eclipse.birt.report.model.api.VariableElementHandle;
import org.eclipse.birt.report.model.api.activity.SemanticException;
import org.eclipse.birt.report.model.api.elements.DesignChoiceConstants;
import org.eclipse.birt.report.model.api.elements.ReportDesignConstants;
Expand Down Expand Up @@ -2470,7 +2474,7 @@ public void setExpression( String expression )

public IExpressionProvider getExpressionProvider( )
{
return new ExpressionProvider( inputParameter );
return new ParameterDataSetExpressionProvider( inputParameter );
}

public IExpressionContextFactory getExpressionContextFactory( )
Expand Down Expand Up @@ -4676,4 +4680,34 @@ else if ( value.equals( NULL_VALUE ) || value.equals( "" ) )
refreshStaticValueTable( );
}
}
private class ParameterDataSetExpressionProvider extends ExpressionProvider
{
public ParameterDataSetExpressionProvider( DesignElementHandle handle )
{
super(handle);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.birt.report.designer.ui.dialogs.ExpressionProvider#getCategoryList()
*/
protected List getCategoryList( )
{
ArrayList<Object> categoryList = (ArrayList<Object>)super.getCategoryList();
if(categoryList!=null&&!categoryList.contains(DATASETS))
{
if ( elementHandle.getModuleHandle( ) instanceof ReportDesignHandle
&& ( (ReportDesignHandle) elementHandle.getModuleHandle( ) ).getDataSets()!=null )
{
if(categoryList.contains(OPERATORS)){
categoryList.add(categoryList.indexOf(OPERATORS)+1, DATASETS);
}else{
categoryList.add( DATASETS );
}

}
}
return categoryList;
}
}
}

0 comments on commit 8c3ae88

Please sign in to comment.