summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormianrui2012-06-13 02:46:34 (EDT)
committer mwu2012-06-13 02:46:34 (EDT)
commite5e05a6643c99651d87e6b35334e796617d3fe2a (patch)
treeda8e31144b87b8c0f2b9c275d58a52f56f776de5
parent7ee067f52ae00596fbd03e45ad139ed7085becb2 (diff)
downloadorg.eclipse.birt-e5e05a6643c99651d87e6b35334e796617d3fe2a.zip
org.eclipse.birt-e5e05a6643c99651d87e6b35334e796617d3fe2a.tar.gz
org.eclipse.birt-e5e05a6643c99651d87e6b35334e796617d3fe2a.tar.bz2
TED – Issue 50780 [OS][420] No error message when column name is number.
-rw-r--r--UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/nls/messages.properties1
-rw-r--r--UI/org.eclipse.birt.report.designer.ui.data/src/org/eclipse/birt/report/designer/data/ui/dataset/DataSetComputedColumnsPage.java18
2 files changed, 19 insertions, 0 deletions
diff --git a/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/nls/messages.properties b/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/nls/messages.properties
index 05d16de..8996288 100644
--- a/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/nls/messages.properties
+++ b/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/nls/messages.properties
@@ -633,6 +633,7 @@ DerivedDataSet.action.error.message.InvalidNumber.DataSet=The number of the avai
DataSetComputedColumnsPage.ComputedColumns.Tooltip=Define computed columns.
DataSetComputedColumnsPage.description=Define computed columns:
DataSetComputedColumnsPage.duplicatedName=Duplicated Column Name.
+DataSetComputedColumnsPage.numberName=Column Name can not be a number.
DataSetComputedColumnsPage.toolTipText.Down=Move Computed Column Down.
DataSetComputedColumnsPage.toolTipText.Up=Move Computed Column Up.
DataSetComputedColumnsPage.toolTipText.Remove=Remove Computed Column.
diff --git a/UI/org.eclipse.birt.report.designer.ui.data/src/org/eclipse/birt/report/designer/data/ui/dataset/DataSetComputedColumnsPage.java b/UI/org.eclipse.birt.report.designer.ui.data/src/org/eclipse/birt/report/designer/data/ui/dataset/DataSetComputedColumnsPage.java
index 090861f..33e7c4c 100644
--- a/UI/org.eclipse.birt.report.designer.ui.data/src/org/eclipse/birt/report/designer/data/ui/dataset/DataSetComputedColumnsPage.java
+++ b/UI/org.eclipse.birt.report.designer.ui.data/src/org/eclipse/birt/report/designer/data/ui/dataset/DataSetComputedColumnsPage.java
@@ -17,6 +17,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.regex.Pattern;
import org.eclipse.birt.core.data.ExpressionUtil;
import org.eclipse.birt.core.data.IColumnBinding;
@@ -928,6 +929,11 @@ public class DataSetComputedColumnsPage extends AbstractDescriptionPropertyPage
super( structureOrHandle );
populateFunctions( );
}
+ public void create( )
+ {
+ super.create( );
+ validateSyntax( );
+ }
protected void setSystemHelp( Composite composite )
{
@@ -1662,6 +1668,12 @@ public class DataSetComputedColumnsPage extends AbstractDescriptionPropertyPage
return getBlankPropertyStatus( dialogLabels[COLUMN_NAME_INDEX] );
if ( isBlankProperty( cmbDataType.getText( ) ) )
return getBlankPropertyStatus( dialogLabels[DATA_TYPE_INDEX] );
+ //ColumnName is number
+ if ( isNumeric( txtColumnName.getText( ) ) )
+ {
+ return getMiscStatus( IStatus.ERROR,
+ Messages.getString( "DataSetComputedColumnsPage.numberName" ) );
+ }
// if ( expression!=null && isBlankProperty( expression.getText( ) ) )
// {
// String funcName = getSelectedFunction( ).getName( );
@@ -1704,6 +1716,12 @@ public class DataSetComputedColumnsPage extends AbstractDescriptionPropertyPage
return getOKStatus( );
}
+ private boolean isNumeric( String text )
+ {
+ Pattern pattern = Pattern.compile("-[0-9]*|[0-9]*");
+ return pattern.matcher(text).matches();
+ }
+
private boolean checkExpressionBindingFields( ) throws BirtException
{
for ( int i = 0; i < txtParams.length; i++ )