summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorning.zhang2012-03-15 02:38:05 (EDT)
committer dgao2012-03-15 02:38:05 (EDT)
commitfd55384901f76647659c4cce2e83b7cb03378278 (patch)
treee4df04bfaf923eb9189260d999e16712f03431cf
parent80f94bc5f0a8d48d79da3bb75216628d4e7c8a50 (diff)
downloadorg.eclipse.birt-fd55384901f76647659c4cce2e83b7cb03378278.zip
org.eclipse.birt-fd55384901f76647659c4cce2e83b7cb03378278.tar.gz
org.eclipse.birt-fd55384901f76647659c4cce2e83b7cb03378278.tar.bz2
Expression builder for derived measures now has a property indicates that this expression builder is initiated on a derived measure and can be treated differently.
-rw-r--r--UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/dialog/MeasureDialog.java20
-rw-r--r--UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/util/BuilderConstants.java2
2 files changed, 21 insertions, 1 deletions
diff --git a/UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/dialog/MeasureDialog.java b/UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/dialog/MeasureDialog.java
index fae70cd..da139e7 100644
--- a/UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/dialog/MeasureDialog.java
+++ b/UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/dialog/MeasureDialog.java
@@ -11,7 +11,9 @@
package org.eclipse.birt.report.designer.ui.cubebuilder.dialog;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.eclipse.birt.core.exception.BirtException;
import org.eclipse.birt.data.engine.api.aggregation.AggregationManager;
@@ -23,10 +25,13 @@ import org.eclipse.birt.report.designer.data.ui.util.DataUtil;
import org.eclipse.birt.report.designer.internal.ui.dialogs.expression.ExpressionButton;
import org.eclipse.birt.report.designer.internal.ui.dialogs.helper.IDialogHelper;
import org.eclipse.birt.report.designer.internal.ui.dialogs.helper.IDialogHelperProvider;
+import org.eclipse.birt.report.designer.internal.ui.expressions.ExpressionContextFactoryImpl;
+import org.eclipse.birt.report.designer.internal.ui.expressions.IExpressionContextFactory;
import org.eclipse.birt.report.designer.internal.ui.util.ExpressionButtonUtil;
import org.eclipse.birt.report.designer.internal.ui.util.IHelpContextIds;
import org.eclipse.birt.report.designer.internal.ui.util.UIUtil;
import org.eclipse.birt.report.designer.internal.ui.util.WidgetUtil;
+import org.eclipse.birt.report.designer.internal.ui.util.ExpressionButtonUtil.ExpressionHelper;
import org.eclipse.birt.report.designer.ui.cubebuilder.nls.Messages;
import org.eclipse.birt.report.designer.ui.cubebuilder.provider.CubeACLExpressionProvider;
import org.eclipse.birt.report.designer.ui.cubebuilder.provider.CubeMeasureExpressionProvider;
@@ -78,6 +83,7 @@ public class MeasureDialog extends TitleAreaDialog
private boolean isEdit = false;
private boolean isAutoPrimaryKeyChecked = false;
private ExpressionButton exprBtn;
+ private ExpressionHelper helper;
private CubeMeasureExpressionProvider provider;
private Combo typeCombo;
private Text expressionText;
@@ -570,10 +576,22 @@ public class MeasureDialog extends TitleAreaDialog
} );
provider = new CubeMeasureExpressionProvider( input, input.isCalculated() );
+
+ helper = new ExpressionHelper( ) {
+ public IExpressionContextFactory getExpressionContextFactory( )
+ {
+ Map<String, Object> extras = new HashMap<String, Object>( );
+ extras.put( BuilderConstants.PROP_DERIVED_MEASURE, derivedMeasureBtn.getSelection() );
+ return new ExpressionContextFactoryImpl( getContextObject(), provider, extras );
+ }
+
+ };
+
exprBtn = ExpressionButtonUtil.createExpressionButton( group,
expressionText,
provider,
- input );
+ input,
+ helper );
new Label( group, SWT.NONE );
exprDesc = new Label( group, SWT.NONE );
diff --git a/UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/util/BuilderConstants.java b/UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/util/BuilderConstants.java
index 8ad792f..0f0bdc0 100644
--- a/UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/util/BuilderConstants.java
+++ b/UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/util/BuilderConstants.java
@@ -59,4 +59,6 @@ public class BuilderConstants
public static final String ALIGNMENT_HELPER_KEY = "Alignment Helper";//$NON-NLS-1$
public static final String ALIGNMENT_LABEL = "Alignment Label"; //$NON-NLS-1$
public static final String ALIGNMENT_VALUE = "Alignment Value";//$NON-NLS-1$
+
+ public static final String PROP_DERIVED_MEASURE = "propDerivedMeasure"; //$NON-NLS-1$
}