[226067] Removed compiler warnings on non-externalized strings
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/UiPlugin.java b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/UiPlugin.java
index d470d7d..7bfbf48 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/UiPlugin.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/UiPlugin.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2006 Actuate Corporation.
+ * Copyright (c) 2004, 2008 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -43,7 +43,7 @@
plugin = this;
try
{
- resourceBundle = ResourceBundle.getBundle( "org.eclipse.datatools.enablement.oda.xml.ui.messages" );
+ resourceBundle = ResourceBundle.getBundle( "org.eclipse.datatools.enablement.oda.xml.ui.messages" ); //$NON-NLS-1$
}
catch ( MissingResourceException x )
{
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/i18n/Messages.java b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/i18n/Messages.java
index 5d42a13..7b85ff6 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/i18n/Messages.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/i18n/Messages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2006 Actuate Corporation.
+ * Copyright (c) 2004, 2008 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -16,7 +16,7 @@
public class Messages
{
- private static final String BUNDLE_NAME = "org.eclipse.datatools.enablement.oda.xml.ui.i18n.messages"; //$NON-NLS-1$
+ private static final String BUNDLE_NAME = "org.eclipse.datatools.enablement.oda.xml.ui.i18n.messages"; //$NON-NLS-1$
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
.getBundle(BUNDLE_NAME);
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/utils/IHelpConstants.java b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/utils/IHelpConstants.java
index e0135ee..80e9ee5 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/utils/IHelpConstants.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/utils/IHelpConstants.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2006 Actuate Corporation.
+ * Copyright (c) 2004, 2008 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,7 +18,7 @@
public interface IHelpConstants
{
- public static final String PREFIX = "org.eclipse.datatools.oda.cshelp" + "."; //$NON-NLS-1$
+ public static final String PREFIX = "org.eclipse.datatools.oda.cshelp" + "."; //$NON-NLS-1$ //$NON-NLS-2$
public static final String CONEXT_ID_DATASOURCE_XML = PREFIX
+ "Wizard_XML_Datasource_ID";//$NON-NLS-1$
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/utils/XMLRelationInfoUtil.java b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/utils/XMLRelationInfoUtil.java
index 6de843c..eb81214 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/utils/XMLRelationInfoUtil.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/utils/XMLRelationInfoUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 Actuate Corporation.
+ * Copyright (c) 2004, 2008 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -25,7 +25,9 @@
public class XMLRelationInfoUtil
{
- /**
+ private static final String EMPTY_STRING = ""; //$NON-NLS-1$
+
+ /**
* connect the relationInfo with special regular expression "#-#"
*
* @param originalStr
@@ -37,7 +39,7 @@
if ( originalStr == null || originalStr.trim( ).length( ) <= 0 )
return newInfo;
else
- return originalStr + "#-#" + newInfo;
+ return originalStr + "#-#" + newInfo; //$NON-NLS-1$
}
/**
@@ -49,7 +51,7 @@
*/
public static String getTableRelationInfo( String info, String tableName )
{
- String[] splitStr = info.split( "\\Q#-#\\E" );
+ String[] splitStr = info.split( "\\Q#-#\\E" ); //$NON-NLS-1$
for ( int i = 0; i < splitStr.length; i++ )
{
if ( splitStr[i].startsWith( tableName ) )
@@ -77,7 +79,7 @@
{
if ( info == null || info.trim( ).length( ) <= 0 )
return 0;
- String[] splitStr = info.split( "\\Q#-#\\E" );
+ String[] splitStr = info.split( "\\Q#-#\\E" ); //$NON-NLS-1$
return splitStr.length;
}
@@ -116,7 +118,7 @@
if ( relationInformation == null
|| relationInformation.trim( ).length( ) == 0 )
return newString;
- String[] splitStr = relationInformation.split( "\\Q#-#\\E" );
+ String[] splitStr = relationInformation.split( "\\Q#-#\\E" ); //$NON-NLS-1$
for ( int i = 0; i < splitStr.length; i++ )
{
if ( splitStr[i].startsWith( tableName ) )
@@ -135,7 +137,7 @@
*/
private static String concatRealtionInfo( String[] splitStr )
{
- String str = "";
+ String str = EMPTY_STRING;
for ( int i = 0; i < splitStr.length; i++ )
{
if ( splitStr[i] != null && splitStr[i].trim( ).length( ) > 0 )
@@ -162,7 +164,7 @@
*/
private static int getTableRelationInfoIndex( String info, String tableName )
{
- String[] splitStr = info.split( "\\Q#-#\\E" );
+ String[] splitStr = info.split( "\\Q#-#\\E" ); //$NON-NLS-1$
for ( int i = 0; i < splitStr.length; i++ )
{
if ( splitStr[i].startsWith( tableName ) )
@@ -182,14 +184,14 @@
String relationInfo, String xPath )
{
String infoStr = relationInfo;
- String[] splitStr = relationInfo.split( "\\Q#-#\\E" );
+ String[] splitStr = relationInfo.split( "\\Q#-#\\E" ); //$NON-NLS-1$
String tableStr = splitStr[0];
RelationInformation info = null;
try
{
info = new RelationInformation( tableStr );
String rootPath = info.getTableOriginalRootPath( tableName );
- tableStr = tableStr.replaceFirst( "\\Q" + rootPath + "\\E", xPath );
+ tableStr = tableStr.replaceFirst( "\\Q" + rootPath + "\\E", xPath ); //$NON-NLS-1$ //$NON-NLS-2$
}
catch ( OdaException e )
{
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/ColumnMappingDialog.java b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/ColumnMappingDialog.java
index d4ea1db..57d3f5d 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/ColumnMappingDialog.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/ColumnMappingDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 Actuate Corporation.
+ * Copyright (c) 2004, 2008 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -45,7 +45,8 @@
public class ColumnMappingDialog extends TrayDialog
{
- private String title;
+ private static final String EMPTY_STRING = ""; //$NON-NLS-1$
+ private String title;
private Combo typeCombo;
private String columnName;
@@ -67,14 +68,14 @@
private boolean isEditMode;
private static String[] dataTypeDisplayNames = new String[]{
- Messages.getString( "datatypes.dateTime" ), //$NON-NLS-1$
- Messages.getString( "datatypes.decimal" ), //$NON-NLS-1$
- Messages.getString( "datatypes.float" ), //$NON-NLS-1$
- Messages.getString( "datatypes.integer" ), //$NON-NLS-1$
- Messages.getString( "datatypes.date" ),
- Messages.getString( "datatypes.time" ),
- Messages.getString( "datatypes.string" ),
- Messages.getString( "datatypes.boolean" )
+ Messages.getString( "datatypes.dateTime" ), //$NON-NLS-1$
+ Messages.getString( "datatypes.decimal" ), //$NON-NLS-1$
+ Messages.getString( "datatypes.float" ), //$NON-NLS-1$
+ Messages.getString( "datatypes.integer" ), //$NON-NLS-1$
+ Messages.getString( "datatypes.date" ), //$NON-NLS-1$
+ Messages.getString( "datatypes.time" ), //$NON-NLS-1$
+ Messages.getString( "datatypes.string" ), //$NON-NLS-1$
+ Messages.getString( "datatypes.boolean" ) //$NON-NLS-1$
};
public ColumnMappingDialog( Shell parent, String title,
@@ -82,8 +83,8 @@
{
super( parent );
this.title = title;
- this.columnName = ( selectedItem == null ? "" : selectedItem );
- this.xpath = ( xpath == null ? "" : xpath );
+ this.columnName = ( selectedItem == null ? EMPTY_STRING : selectedItem );
+ this.xpath = ( xpath == null ? EMPTY_STRING : xpath );
this.type = DataTypeUtil.getDataTypeDisplayName( dataType );
this.isEditMode = editMode;
this.xpathList = editMode ? null
@@ -168,7 +169,7 @@
{
typeIndex = i;
}
- else if ( dataTypeDisplayNames[i].equals( Messages.getString( "datatypes.string" ) ) )
+ else if ( dataTypeDisplayNames[i].equals( Messages.getString( "datatypes.string" ) ) ) //$NON-NLS-1$
{
stringIndex = i;
}
@@ -217,7 +218,7 @@
GridData labelData = new GridData( );
labelData.horizontalAlignment = 10;
Label customLabel = new Label( customComposite, SWT.WRAP );
- customLabel.setText( Messages.getString( "ColumnMappingDialog.info.xPath" ) );
+ customLabel.setText( Messages.getString( "ColumnMappingDialog.info.xPath" ) ); //$NON-NLS-1$
customLabel.setLayoutData( labelData );
GridData textData = new GridData( );
textData.widthHint = 300;
@@ -343,7 +344,7 @@
customData.widthHint = 400;
customButton = new Button( exprBtnGroup, SWT.RADIO );
customButton.setLayoutData( customData );
- customButton.setText( Messages.getString( "xPathChoosePage.messages.elementSelection.item.custom" ) );
+ customButton.setText( Messages.getString( "xPathChoosePage.messages.elementSelection.item.custom" ) ); //$NON-NLS-1$
customButton.setSelection( true );
customButton.addSelectionListener( new SelectionAdapter( ) {
@@ -395,19 +396,19 @@
{
if ( xpathList == null )
{
- absoluteLabel.setText( Messages.getString( "xPathChoosePage.messages.elementSelection.disable.absolutePath" ) );
- anyLocationLabel.setText( Messages.getString( "xPathChoosePage.messages.elementSelection.disable.anyLocation" ) );
+ absoluteLabel.setText( Messages.getString( "xPathChoosePage.messages.elementSelection.disable.absolutePath" ) ); //$NON-NLS-1$
+ anyLocationLabel.setText( Messages.getString( "xPathChoosePage.messages.elementSelection.disable.anyLocation" ) ); //$NON-NLS-1$
setButtonsEnabled( false );
return;
}
if ( xpathList.size( ) >= 2 )
{
- absoluteLabel.setText( Messages.getFormattedString( "xPathChoosePage.messages.elementSelection.item.absolutePath",
+ absoluteLabel.setText( Messages.getFormattedString( "xPathChoosePage.messages.elementSelection.item.absolutePath", //$NON-NLS-1$
new String[]{
columnName, (String) xpathList.get( 0 )
} ) );
- anyLocationLabel.setText( Messages.getFormattedString( "xPathChoosePage.messages.elementSelection.item.anyLocation",
+ anyLocationLabel.setText( Messages.getFormattedString( "xPathChoosePage.messages.elementSelection.item.anyLocation", //$NON-NLS-1$
new String[]{
columnName, (String) xpathList.get( 1 )
} ) );
@@ -415,8 +416,8 @@
}
else
{
- absoluteLabel.setText( Messages.getString( "xPathChoosePage.messages.elementSelection.disable.absolutePath" ) );
- anyLocationLabel.setText( Messages.getString( "xPathChoosePage.messages.elementSelection.disable.anyLocation" ) );
+ absoluteLabel.setText( Messages.getString( "xPathChoosePage.messages.elementSelection.disable.absolutePath" ) ); //$NON-NLS-1$
+ anyLocationLabel.setText( Messages.getString( "xPathChoosePage.messages.elementSelection.disable.anyLocation" ) ); //$NON-NLS-1$
setButtonsEnabled( false );
}
composite.layout( );
@@ -447,7 +448,7 @@
}
else
{
- xmlPathCombo.setText( "" );
+ xmlPathCombo.setText( EMPTY_STRING );
setButtonsEnabled( false );
return;
}
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/ColumnMappingPage.java b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/ColumnMappingPage.java
index f5d404a..ee07c5e 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/ColumnMappingPage.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/ColumnMappingPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 Actuate Corporation.
+ * Copyright (c) 2004, 2008 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -82,7 +82,17 @@
ITableLabelProvider
{
- private Tree availableXmlTree;
+ private static final String ROOT = "ROOT"; //$NON-NLS-1$
+ private static final String RIGHT_SQUARE_BRACKET = "]"; //$NON-NLS-1$
+ private static final String LEFT_SQUARE_BRACKET = "["; //$NON-NLS-1$
+ private static final String LEFT_CURLY_BRACKET = "{"; //$NON-NLS-1$
+ private static final String RIGHT_CURLY_BRACKET = "}"; //$NON-NLS-1$
+ private static final String RIGHT_ANGLE_BRACKET = ">"; //$NON-NLS-1$
+ private static final String COMMA = ","; //$NON-NLS-1$
+ private static final String SEMICOLON = ";"; //$NON-NLS-1$
+ private static final String UNDERSCORE = "_"; //$NON-NLS-1$
+ private static final String EMPTY_STRING = ""; //$NON-NLS-1$
+ private Tree availableXmlTree;
private Button btnAddOne;
private Button btnAddAll;
private Button btnPreview;
@@ -102,23 +112,23 @@
private String selectedTreeItemText;
- private static String COLUMN_NAME = Messages.getString( "dataset.editor.columnName" );
- private static String XPATH_NAME = Messages.getString( "dataset.editor.xpathexpression" );
- private static String TYPE_NAME = Messages.getString( "dataset.editor.datatype" );
- private static String DEFAULT_PAGE_NAME = Messages.getString( "xPathChoosePage.messages.xmlColumnMapping" );
- private static String DEFAULT_PAGE_Message = Messages.getString( "wizard.title.defineColumnMapping" );
- private static String PATH_SEPERATOR = "/";
- private static String ATTRIBUTE_MARK = "@";
+ private static String COLUMN_NAME = Messages.getString( "dataset.editor.columnName" ); //$NON-NLS-1$
+ private static String XPATH_NAME = Messages.getString( "dataset.editor.xpathexpression" ); //$NON-NLS-1$
+ private static String TYPE_NAME = Messages.getString( "dataset.editor.datatype" ); //$NON-NLS-1$
+ private static String DEFAULT_PAGE_NAME = Messages.getString( "xPathChoosePage.messages.xmlColumnMapping" ); //$NON-NLS-1$
+ private static String DEFAULT_PAGE_Message = Messages.getString( "wizard.title.defineColumnMapping" ); //$NON-NLS-1$
+ private static String PATH_SEPERATOR = "/"; //$NON-NLS-1$
+ private static String ATTRIBUTE_MARK = "@"; //$NON-NLS-1$
private static String[] dataTypeDisplayNames = new String[]{
- Messages.getString( "datatypes.dateTime" ), //$NON-NLS-1$
- Messages.getString( "datatypes.decimal" ), //$NON-NLS-1$
- Messages.getString( "datatypes.float" ), //$NON-NLS-1$
- Messages.getString( "datatypes.integer" ), //$NON-NLS-1$
- Messages.getString( "datatypes.date" ),//$NON-NLS-1$
- Messages.getString( "datatypes.time" ),//$NON-NLS-1$
- Messages.getString( "datatypes.string" ),//$NON-NLS-1$
- Messages.getString( "datatypes.boolean" )//$NON-NLS-1$
+ Messages.getString( "datatypes.dateTime" ), //$NON-NLS-1$
+ Messages.getString( "datatypes.decimal" ), //$NON-NLS-1$
+ Messages.getString( "datatypes.float" ), //$NON-NLS-1$
+ Messages.getString( "datatypes.integer" ), //$NON-NLS-1$
+ Messages.getString( "datatypes.date" ), //$NON-NLS-1$
+ Messages.getString( "datatypes.time" ), //$NON-NLS-1$
+ Messages.getString( "datatypes.string" ), //$NON-NLS-1$
+ Messages.getString( "datatypes.boolean" ) //$NON-NLS-1$
};
private static Logger logger = Logger.getLogger( ColumnMappingPage.class.getName( ) );
@@ -128,7 +138,7 @@
*/
public ColumnMappingPage( )
{
- this( Messages.getString( "wizard.title.newDataSet" ) );
+ this( Messages.getString( "wizard.title.newDataSet" ) ); //$NON-NLS-1$
Arrays.sort( dataTypeDisplayNames );
}
@@ -139,7 +149,7 @@
{
super( pageName );
this.setTitle( pageName );
- DEFAULT_PAGE_Message = Messages.getString( "wizard.title.defineColumnMapping" );
+ DEFAULT_PAGE_Message = Messages.getString( "wizard.title.defineColumnMapping" ); //$NON-NLS-1$
this.setMessage( DEFAULT_PAGE_Message );
this.columnMap = new HashMap( );
this.columnMappingList = new ArrayList( );
@@ -187,7 +197,7 @@
}
catch ( OdaException e )
{
- setMessage( Messages.getString( "error.columnMapping.createPage" ),
+ setMessage( Messages.getString( "error.columnMapping.createPage" ), //$NON-NLS-1$
ERROR );
logger.log( Level.INFO, e.getMessage( ), e );
}
@@ -233,7 +243,7 @@
*/
protected void refresh( DataSetDesign dataSetDesign )
{
- DEFAULT_PAGE_Message = Messages.getString( "xPathChoosePage.messages.xmlColumnMapping" );
+ DEFAULT_PAGE_Message = Messages.getString( "xPathChoosePage.messages.xmlColumnMapping" ); //$NON-NLS-1$
if ( XMLInformationHolder.hasDestroyed( ) )
XMLInformationHolder.start( dataSetDesign );
this.setMessage( DEFAULT_PAGE_Message );
@@ -247,7 +257,7 @@
*/
public Control createPageControl( Composite parent )
{
- DEFAULT_PAGE_Message = Messages.getString( "wizard.title.defineColumnMapping" );
+ DEFAULT_PAGE_Message = Messages.getString( "wizard.title.defineColumnMapping" ); //$NON-NLS-1$
Composite composite = new Composite( parent, SWT.NONE );
GridLayout layout = new GridLayout( );
@@ -286,9 +296,9 @@
btnComposite.setLayout( btnLayout );
btnAddOne = new Button( btnComposite, SWT.NONE );
- btnAddOne.setText( ">" ); //$NON-NLS-1$
+ btnAddOne.setText( RIGHT_ANGLE_BRACKET );
// TODO to externalize into message file
- btnAddOne.setToolTipText( Messages.getString( "ColumnMappingPage.AddSingleButton.tooltip" ) );
+ btnAddOne.setToolTipText( Messages.getString( "ColumnMappingPage.AddSingleButton.tooltip" ) ); //$NON-NLS-1$
btnAddOne.setEnabled( false );
btnAddOne.addSelectionListener( new SelectionAdapter( ) {
@@ -302,7 +312,7 @@
TreeItem[] selectedMultiItems = availableXmlTree.getSelection( );
if ( selectedMultiItems == null )
{
- setMessage( Messages.getString( "error.columnMapping.SelectedTreeItem.notNull" ),
+ setMessage( Messages.getString( "error.columnMapping.SelectedTreeItem.notNull" ), //$NON-NLS-1$
ERROR );
btnAddOne.setEnabled( false );
btnAddAll.setEnabled( false );
@@ -353,7 +363,7 @@
btnAddAll = new Button( btnComposite, SWT.NONE );
btnAddAll.setText( ">>" ); //$NON-NLS-1$
// TODO to externalize into message file
- btnAddAll.setToolTipText( Messages.getString( "ColumnMappingPage.AddAllButton.tooltip" ) );
+ btnAddAll.setToolTipText( Messages.getString( "ColumnMappingPage.AddAllButton.tooltip" ) ); //$NON-NLS-1$
btnAddAll.setEnabled( true );
btnAddAll.addSelectionListener( new SelectionAdapter( ) {
@@ -375,7 +385,7 @@
/* Only one node is selected at a time */
if ( !handleSelectedItem( selectedMultiItems[0] ) )
{
- setMessage( Messages.getString( "error.columnMapping.columnElement.create" ),
+ setMessage( Messages.getString( "error.columnMapping.columnElement.create" ), //$NON-NLS-1$
ERROR );
}
}
@@ -387,7 +397,7 @@
TreeItem selectedItem = selectedMultiItems[i];
if ( !handleSelectedItem( selectedItem ) )
{
- setMessage( Messages.getString( "error.columnMapping.columnElement.create" ),
+ setMessage( Messages.getString( "error.columnMapping.columnElement.create" ), //$NON-NLS-1$
ERROR );
break;
}
@@ -409,8 +419,8 @@
private void createPreviewButton( Composite parent )
{
btnPreview = new Button( parent, SWT.PUSH );
- btnPreview.setText( Messages.getString( "menu.button.preview" ) );
- btnPreview.setToolTipText( Messages.getString( "ColumnMappingTable.previewButton.tooltip" ) );
+ btnPreview.setText( Messages.getString( "menu.button.preview" ) ); //$NON-NLS-1$
+ btnPreview.setToolTipText( Messages.getString( "ColumnMappingTable.previewButton.tooltip" ) ); //$NON-NLS-1$
btnPreview.addSelectionListener( new SelectionAdapter( ) {
/*
@@ -459,7 +469,7 @@
tableViewerGroup = new Group( composite2, SWT.NONE
| SWT.H_SCROLL | SWT.V_SCROLL );
tableViewerGroup.setLayout( new GridLayout( ) );
- tableViewerGroup.setText( Messages.getString( "xPathChoosePage.messages.xmlColumnMapping" ) );
+ tableViewerGroup.setText( Messages.getString( "xPathChoosePage.messages.xmlColumnMapping" ) ); //$NON-NLS-1$
tableViewerGroup.setLayoutData( new GridData( GridData.FILL_BOTH ) );
tableViewerGroup.setEnabled( true );
@@ -474,15 +484,15 @@
TableColumn column = new TableColumn( columnMappingTable.getViewer( )
.getTable( ), SWT.LEFT );
- column.setText( COLUMN_NAME ); //$NON-NLS-1$
+ column.setText( COLUMN_NAME );
column.setWidth( 100 );
column = new TableColumn( columnMappingTable.getViewer( ).getTable( ),
SWT.LEFT );
- column.setText( XPATH_NAME ); //$NON-NLS-1$
+ column.setText( XPATH_NAME );
column.setWidth( 100 );
column = new TableColumn( columnMappingTable.getViewer( ).getTable( ),
SWT.LEFT );
- column.setText( TYPE_NAME ); //$NON-NLS-1$
+ column.setText( TYPE_NAME );
column.setWidth( 60 );
columnMappingTable.getViewer( )
@@ -550,7 +560,7 @@
catch ( OdaException e )
{
logger.log( Level.INFO, e.getMessage( ), e );
- setMessage( Messages.getString( "error.columnMapping.ATreeNode.getChildren" ),
+ setMessage( Messages.getString( "error.columnMapping.ATreeNode.getChildren" ), //$NON-NLS-1$
ERROR );
}
}
@@ -700,7 +710,7 @@
} );
- treeGroup.setText( Messages.getString( "xPathChoosePage.messages.xmlStructure" ) );
+ treeGroup.setText( Messages.getString( "xPathChoosePage.messages.xmlStructure" ) ); //$NON-NLS-1$
}
/**
@@ -763,7 +773,7 @@
} );
columnMappingTable.getEditButton( )
- .setToolTipText( Messages.getString( "ColumnMappingTable.editButton.tooltip" ) );
+ .setToolTipText( Messages.getString( "ColumnMappingTable.editButton.tooltip" ) ); //$NON-NLS-1$
columnMappingTable.getRemoveButton( )
.addSelectionListener( new SelectionListener( ) {
@@ -781,7 +791,7 @@
} );
// TODO to externalize into message file
columnMappingTable.getRemoveButton( )
- .setToolTipText( Messages.getString( "ColumnMappingTable.removeButton.tooltip" ) );
+ .setToolTipText( Messages.getString( "ColumnMappingTable.removeButton.tooltip" ) ); //$NON-NLS-1$
columnMappingTable.getRemoveMenuItem( )
.addSelectionListener( new SelectionListener( ) {
@@ -828,7 +838,7 @@
} );
// TODO to externalize into message file
columnMappingTable.getUpButton( )
- .setToolTipText( Messages.getString( "ColumnMappingTable.upButton.tooltip" ) );
+ .setToolTipText( Messages.getString( "ColumnMappingTable.upButton.tooltip" ) ); //$NON-NLS-1$
columnMappingTable.getDownButton( )
.addSelectionListener( new SelectionListener( ) {
@@ -845,7 +855,7 @@
} );
// TODO to externalize into message file
columnMappingTable.getDownButton( )
- .setToolTipText( Messages.getString( "ColumnMappingTable.downButton.tooltip" ) );
+ .setToolTipText( Messages.getString( "ColumnMappingTable.downButton.tooltip" ) ); //$NON-NLS-1$
}
/**
@@ -904,7 +914,7 @@
}
if ( appendix > 0 )
{
- editedColumnName = editedColumnName + "_" + appendix;
+ editedColumnName = editedColumnName + UNDERSCORE + appendix;
}
columnElement.setColumnName( editedColumnName );
}
@@ -925,7 +935,7 @@
catch ( OdaException e1 )
{
logger.log( Level.INFO, e1.getMessage( ), e1 );
- setMessage( Messages.getString( "error.columnMapping.columnElement.edit" ),
+ setMessage( Messages.getString( "error.columnMapping.columnElement.edit" ), //$NON-NLS-1$
ERROR );
}
}
@@ -958,7 +968,7 @@
.getTable( )
.getItem( index )
.getData( );
- String elementName = "";
+ String elementName = EMPTY_STRING;
if ( element instanceof ColumnMappingElement )
{
ColumnMappingElement entry = (ColumnMappingElement) element;
@@ -989,7 +999,7 @@
removeSingleColumnItem( 0 );
}
String str = XMLRelationInfoUtil.replaceInfo( this.tableName,
- "",
+ EMPTY_STRING,
XMLInformationHolder.getPropertyValue( Constants.CONST_PROP_RELATIONINFORMATION ) );
XMLInformationHolder.setPropertyValue( Constants.CONST_PROP_RELATIONINFORMATION,
str );
@@ -1105,7 +1115,7 @@
}
catch ( OdaException e )
{
- setMessage( Messages.getString( "error.columnMapping.createPage" ),
+ setMessage( Messages.getString( "error.columnMapping.createPage" ), //$NON-NLS-1$
ERROR );
}
enableAllTableSideButtons( false );
@@ -1118,7 +1128,7 @@
{
btnAddOne.setEnabled( false );
btnAddAll.setEnabled( false );
- this.setMessage( Messages.getString( "error.columnMapping.tableMappingXPathNotExist" ),
+ this.setMessage( Messages.getString( "error.columnMapping.tableMappingXPathNotExist" ), //$NON-NLS-1$
ERROR );
}
else
@@ -1131,7 +1141,7 @@
catch ( Exception e )
{
logger.log( Level.INFO, e.getMessage( ), e );
- setMessage( Messages.getString( "error.columnMapping.createPage" ),
+ setMessage( Messages.getString( "error.columnMapping.createPage" ), //$NON-NLS-1$
ERROR );
}
}
@@ -1168,7 +1178,7 @@
}
else if ( type == ATreeNode.ELEMENT_TYPE )
{
- if ( treeNode.getParent( )!= null && "ROOT".equals( treeNode.getParent( ).getValue( )) )
+ if ( treeNode.getParent( )!= null && ROOT.equals( treeNode.getParent( ).getValue( )) )
{
treeItem.setImage( TreeNodeDataUtil.getSourceFileImage( ) );
}
@@ -1191,9 +1201,9 @@
generateXpathFromATreeNode( aTreeNode ) );
if ( populateString != null )
{
- if ( populateString.equals( "" ) )
+ if ( populateString.equals( EMPTY_STRING ) )
{
- FontData fontData = new FontData( "", 8, SWT.BOLD );
+ FontData fontData = new FontData( EMPTY_STRING, 8, SWT.BOLD );
treeItem.setFont( new Font( null, fontData ) );
availableXmlTree.setSelection( new TreeItem[]{
@@ -1209,8 +1219,8 @@
if ( treeNode.getChildren( ) != null
&& treeNode.getChildren( ).length > 0 )
{
- if ( level > ( ( selectedTreeItemText == null || selectedTreeItemText.split( "/" ).length < 5 )
- ? 5 : selectedTreeItemText.split( "/" ).length ) )
+ if ( level > ( ( selectedTreeItemText == null || selectedTreeItemText.split( PATH_SEPERATOR ).length < 5 )
+ ? 5 : selectedTreeItemText.split( PATH_SEPERATOR ).length ) )
new TreeItem( treeItem, 0 );
else
{
@@ -1227,7 +1237,7 @@
*/
private String getRootPathWithOutFilter( )
{
- return selectedTreeItemText.replaceAll( "\\Q[\\E.*\\Q]\\E", "" );
+ return selectedTreeItemText.replaceAll( "\\Q[\\E.*\\Q]\\E", EMPTY_STRING ); //$NON-NLS-1$
}
// expand the tree
@@ -1254,9 +1264,9 @@
.getTable( ), dataTypeDisplayNames, SWT.READ_ONLY );
columnMappingTable.getViewer( ).setCellEditors( editors );
columnMappingTable.getViewer( ).setColumnProperties( new String[]{
- COLUMN_NAME, //$NON-NLS-1$
- XPATH_NAME, //$NON-NLS-1$
- TYPE_NAME, //$NON-NLS-1$
+ COLUMN_NAME,
+ XPATH_NAME,
+ TYPE_NAME,
} );
columnMappingTable.getViewer( )
@@ -1328,22 +1338,22 @@
{
if ( !this.columnMappingList.isEmpty( ) )
{
- String tablePath = "[" + selectedTreeItemText + "]";
+ String tablePath = LEFT_SQUARE_BRACKET + selectedTreeItemText + RIGHT_SQUARE_BRACKET;
String queryString = tableName +
RelationInformation.CONST_TABLE_COLUMN_DELIMITER +
tablePath +
RelationInformation.CONST_TABLE_COLUMN_DELIMITER;
- String rowStr = "";
+ String rowStr = EMPTY_STRING;
Iterator rowObj = this.columnMappingList.iterator( );
while ( rowObj.hasNext( ) )
{
ColumnMappingElement element = (ColumnMappingElement) rowObj.next( );
- rowStr = "{" +
- element.getColumnName( ) + ";" +
- element.getTypeStandardString( ) + ";" +
- element.getXPath( ) + "}";
+ rowStr = LEFT_CURLY_BRACKET +
+ element.getColumnName( ) + SEMICOLON +
+ element.getTypeStandardString( ) + SEMICOLON +
+ element.getXPath( ) + RIGHT_CURLY_BRACKET;
if ( rowObj.hasNext( ) )
- rowStr = rowStr + ",";
+ rowStr = rowStr + COMMA;
queryString = queryString + rowStr;
}
return queryString;
@@ -1378,17 +1388,17 @@
Object element = ti.getData( );
- String c1 = "", c2 = "", c3 = ""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ String c1 = EMPTY_STRING, c2 = EMPTY_STRING, c3 = EMPTY_STRING;
if ( element instanceof ColumnMappingElement )
{
ColumnMappingElement colElement = (ColumnMappingElement) element;
- c1 = colElement.getColumnName( ) == null ? ""
+ c1 = colElement.getColumnName( ) == null ? EMPTY_STRING
: colElement.getColumnName( );
- c2 = colElement.getXPath( ) == null ? ""
+ c2 = colElement.getXPath( ) == null ? EMPTY_STRING
: colElement.getXPath( );
- c3 = colElement.getType( ) == null ? "" : colElement.getType( );
+ c3 = colElement.getType( ) == null ? EMPTY_STRING : colElement.getType( );
}
ti.setText( 0, c1 );
ti.setText( 1, c2 );
@@ -1433,7 +1443,7 @@
{
case 0 :
{
- value = (String) ( (ColumnMappingElement) element ).getColumnName( ); //$NON-NLS-1$
+ value = (String) ( (ColumnMappingElement) element ).getColumnName( );
break;
}
case 1 :
@@ -1443,7 +1453,7 @@
}
case 2 :
{
- value = (String) ( (ColumnMappingElement) element ).getType( ); //$NON-NLS-1$
+ value = (String) ( (ColumnMappingElement) element ).getType( );
break;
}
}
@@ -1452,13 +1462,13 @@
{
logger.log( Level.INFO, ex.getMessage( ), ex );
ExceptionHandler.showException( getShell( ),
- Messages.getString( "error.label" ),
+ Messages.getString( "error.label" ), //$NON-NLS-1$
ex.getMessage( ),
ex );
}
if ( value == null )
{
- value = ""; //$NON-NLS-1$
+ value = EMPTY_STRING;
}
return value;
}
@@ -1636,7 +1646,7 @@
while ( !isUniqueName( columnName, columnElement ) )
{
index++;
- String alias = columnName + "_" + index;
+ String alias = columnName + UNDERSCORE + index;
if ( isUniqueName( alias, columnElement ) )
{
columnElement.setColumnName( alias );
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/ColumnMappingTableViewer.java b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/ColumnMappingTableViewer.java
index 657991d..c159927 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/ColumnMappingTableViewer.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/ColumnMappingTableViewer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Actuate Corporation.
+ * Copyright (c) 2005, 2008 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -38,7 +38,7 @@
/**
* Table viewer of column mapping
*
- * @version $Revision: 1.6 $ $Date: 2007/12/29 03:59:28 $
+ * @version $Revision: 1.7 $ $Date: 2008/03/24 10:13:32 $
*/
public final class ColumnMappingTableViewer
{
@@ -86,7 +86,7 @@
btnData.widthHint = 50;
btnData.heightHint = 20;
btnEdit = new Button( btnComposite, SWT.WRAP );
- btnEdit.setText( Messages.getString( "menu.button.edit" ) );
+ btnEdit.setText( Messages.getString( "menu.button.edit" ) ); //$NON-NLS-1$
btnEdit.setLayoutData( btnData );
btnEdit.setEnabled( false );
btnEdit.addSelectionListener( new SelectionListener( ) {
@@ -105,7 +105,7 @@
btnData.widthHint = 50;
btnData.heightHint = 20;
btnRemove = new Button( btnComposite, SWT.WRAP );
- btnRemove.setText( Messages.getString( "menu.button.remove" ) );
+ btnRemove.setText( Messages.getString( "menu.button.remove" ) ); //$NON-NLS-1$
btnRemove.setLayoutData( btnData );
btnRemove.setEnabled( false );
btnRemove.addSelectionListener( new SelectionListener( ) {
@@ -124,12 +124,12 @@
blankLabel.setLayoutData( btnData );
btnUp = new Button( btnComposite, SWT.WRAP );
- btnUp.setText( Messages.getString( "menu.button.up" ) );
+ btnUp.setText( Messages.getString( "menu.button.up" ) ); //$NON-NLS-1$
btnUp.setLayoutData( btnData );
btnUp.setEnabled( false );
btnDown = new Button( btnComposite, SWT.WRAP );
- btnDown.setText( Messages.getString( "menu.button.down" ) );
+ btnDown.setText( Messages.getString( "menu.button.down" ) ); //$NON-NLS-1$
btnDown.setLayoutData( btnData );
btnDown.setEnabled( false );
btnDown.addSelectionListener( new SelectionListener( ) {
@@ -156,10 +156,10 @@
}
} );
itmRemove = new MenuItem( menu, SWT.NONE );
- itmRemove.setText( Messages.getString( "menu.menuItem.remove" ) ); //$NON-NLS-1$
+ itmRemove.setText( Messages.getString( "menu.menuItem.remove" ) ); //$NON-NLS-1$
itmRemoveAll = new MenuItem( menu, SWT.NONE );
- itmRemoveAll.setText( Messages.getString( "menu.menuItem.removeAll" ) ); //$NON-NLS-1$
+ itmRemoveAll.setText( Messages.getString( "menu.menuItem.removeAll" ) ); //$NON-NLS-1$
viewer.getTable( ).setMenu( menu );
}
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/DataSetDesignPopulator.java b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/DataSetDesignPopulator.java
index f1bafeb..ac521cf 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/DataSetDesignPopulator.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/DataSetDesignPopulator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 Actuate Corporation.
+ * Copyright (c) 2004, 2008 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -32,7 +32,9 @@
public class DataSetDesignPopulator
{
- public static void populateResultSet( DataSetDesign dataSetDesign )
+ private static final String EMPTY_STRING = ""; //$NON-NLS-1$
+
+ public static void populateResultSet( DataSetDesign dataSetDesign )
{
IConnection conn = null;
try
@@ -48,11 +50,11 @@
}
properties.setProperty( Constants.CONST_PROP_FILELIST,
- xmlFile == null ? "" : xmlFile );
+ xmlFile == null ? EMPTY_STRING : xmlFile );
String xmlEncoding = XMLInformationHolder.getPropertyValue( Constants.CONST_PROP_ENCODINGLIST );
properties.setProperty( Constants.CONST_PROP_ENCODINGLIST,
- xmlEncoding == null ? "" : xmlEncoding );
+ xmlEncoding == null ? EMPTY_STRING : xmlEncoding );
conn.open( properties );
IQuery query = conn.newQuery( null );
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/DataTypeUtil.java b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/DataTypeUtil.java
index ad0d7de..e117dc3 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/DataTypeUtil.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/DataTypeUtil.java
@@ -1,6 +1,6 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 Actuate Corporation.
+ * Copyright (c) 2004, 2008 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -28,23 +28,23 @@
static
{
- displayNameDataTypeMapping.put( Messages.getString("datatypes.dateTime"),new Integer( DataTypes.TIMESTAMP ) );
- displayNameDataTypeMapping.put( Messages.getString("datatypes.decimal"),new Integer( DataTypes.BIGDECIMAL ) );
- displayNameDataTypeMapping.put( Messages.getString("datatypes.float"),new Integer( DataTypes.DOUBLE ) );
- displayNameDataTypeMapping.put( Messages.getString("datatypes.integer"), new Integer( DataTypes.INT ));
- displayNameDataTypeMapping.put( Messages.getString("datatypes.date"), new Integer( DataTypes.DATE ) );
- displayNameDataTypeMapping.put( Messages.getString("datatypes.time"), new Integer( DataTypes.TIME ) );
- displayNameDataTypeMapping.put( Messages.getString("datatypes.string"), new Integer( DataTypes.STRING ) );
- displayNameDataTypeMapping.put( Messages.getString("datatypes.boolean"), new Integer( DataTypes.BOOLEAN ) );
+ displayNameDataTypeMapping.put( Messages.getString("datatypes.dateTime"),new Integer( DataTypes.TIMESTAMP ) ); //$NON-NLS-1$
+ displayNameDataTypeMapping.put( Messages.getString("datatypes.decimal"),new Integer( DataTypes.BIGDECIMAL ) ); //$NON-NLS-1$
+ displayNameDataTypeMapping.put( Messages.getString("datatypes.float"),new Integer( DataTypes.DOUBLE ) ); //$NON-NLS-1$
+ displayNameDataTypeMapping.put( Messages.getString("datatypes.integer"), new Integer( DataTypes.INT )); //$NON-NLS-1$
+ displayNameDataTypeMapping.put( Messages.getString("datatypes.date"), new Integer( DataTypes.DATE ) ); //$NON-NLS-1$
+ displayNameDataTypeMapping.put( Messages.getString("datatypes.time"), new Integer( DataTypes.TIME ) ); //$NON-NLS-1$
+ displayNameDataTypeMapping.put( Messages.getString("datatypes.string"), new Integer( DataTypes.STRING ) ); //$NON-NLS-1$
+ displayNameDataTypeMapping.put( Messages.getString("datatypes.boolean"), new Integer( DataTypes.BOOLEAN ) ); //$NON-NLS-1$
- dataTypeDisplayNameMapping.put( new Integer( DataTypes.TIMESTAMP ), Messages.getString("datatypes.dateTime") );
- dataTypeDisplayNameMapping.put( new Integer( DataTypes.BIGDECIMAL ), Messages.getString("datatypes.decimal"));
- dataTypeDisplayNameMapping.put( new Integer( DataTypes.DOUBLE ), Messages.getString("datatypes.float"));
- dataTypeDisplayNameMapping.put( new Integer( DataTypes.INT ),Messages.getString("datatypes.integer"));
- dataTypeDisplayNameMapping.put( new Integer( DataTypes.DATE ),Messages.getString("datatypes.date"));
- dataTypeDisplayNameMapping.put( new Integer( DataTypes.TIME ), Messages.getString("datatypes.time"));
- dataTypeDisplayNameMapping.put( new Integer( DataTypes.STRING ), Messages.getString("datatypes.string"));
- dataTypeDisplayNameMapping.put( new Integer( DataTypes.BOOLEAN ), Messages.getString("datatypes.boolean"));
+ dataTypeDisplayNameMapping.put( new Integer( DataTypes.TIMESTAMP ), Messages.getString("datatypes.dateTime") ); //$NON-NLS-1$
+ dataTypeDisplayNameMapping.put( new Integer( DataTypes.BIGDECIMAL ), Messages.getString("datatypes.decimal")); //$NON-NLS-1$
+ dataTypeDisplayNameMapping.put( new Integer( DataTypes.DOUBLE ), Messages.getString("datatypes.float")); //$NON-NLS-1$
+ dataTypeDisplayNameMapping.put( new Integer( DataTypes.INT ),Messages.getString("datatypes.integer")); //$NON-NLS-1$
+ dataTypeDisplayNameMapping.put( new Integer( DataTypes.DATE ),Messages.getString("datatypes.date")); //$NON-NLS-1$
+ dataTypeDisplayNameMapping.put( new Integer( DataTypes.TIME ), Messages.getString("datatypes.time")); //$NON-NLS-1$
+ dataTypeDisplayNameMapping.put( new Integer( DataTypes.STRING ), Messages.getString("datatypes.string")); //$NON-NLS-1$
+ dataTypeDisplayNameMapping.put( new Integer( DataTypes.BOOLEAN ), Messages.getString("datatypes.boolean")); //$NON-NLS-1$
}
/**
@@ -59,7 +59,7 @@
if( o != null )
return o.toString( );
else
- return Messages.getString("datatypes.string");
+ return Messages.getString("datatypes.string"); //$NON-NLS-1$
}
/**
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/ResultSetTableViewer.java b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/ResultSetTableViewer.java
index b96e6b5..47b6f51 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/ResultSetTableViewer.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/ResultSetTableViewer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Actuate Corporation.
+ * Copyright (c) 2005, 2008 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -39,7 +39,7 @@
* Table viewer of result set, it contains refresh action to get the results of
* xml file.
*
- * @version $Revision: 1.7 $ $Date: 2007/09/12 18:49:43 $
+ * @version $Revision: 1.8 $ $Date: 2007/12/29 03:59:28 $
*/
public final class ResultSetTableViewer
{
@@ -49,6 +49,8 @@
private TableColumn column;
private final int MAX_ROW = 500;
+ private static final String EMPTY_STRING = ""; //$NON-NLS-1$
+
/**
* result set table viewer
*/
@@ -103,11 +105,11 @@
}
properties.setProperty( Constants.CONST_PROP_FILELIST, xmlFile == null
- ? "" : xmlFile );
+ ? EMPTY_STRING : xmlFile );
String xmlEncoding = XMLInformationHolder.getPropertyValue( Constants.CONST_PROP_ENCODINGLIST );
properties.setProperty( Constants.CONST_PROP_ENCODINGLIST,
- xmlEncoding == null ? "" : xmlEncoding );
+ xmlEncoding == null ? EMPTY_STRING : xmlEncoding );
try
{
conn.open( properties );
@@ -116,7 +118,7 @@
int maxRow = Integer.parseInt( XMLInformationHolder.getPropertyValue( Constants.CONST_PROP_MAX_ROW ) != null
? XMLInformationHolder.getPropertyValue( Constants.CONST_PROP_MAX_ROW )
- : "-1" ); //$NON-NLS-1$
+ : "-1" ); //$NON-NLS-1$
query.setMaxRows( maxRow );
query.prepare( XMLInformationHolder.getPropertyValue( Constants.CONST_PROP_RELATIONINFORMATION ) );
rs = query.executeQuery( );
@@ -125,7 +127,7 @@
catch ( Exception ex )
{
ExceptionHandler.showException( this.getControl( ).getShell( ),
- Messages.getString( "error.label" ),
+ Messages.getString( "error.label" ), //$NON-NLS-1$
ex.getMessage( ),
ex );
}
@@ -157,7 +159,7 @@
viewer.removeAll( );
for ( int i = 0; i < viewer.getColumnCount( ); i++ )
{
- viewer.getColumn( i ).setText( "" );
+ viewer.getColumn( i ).setText( EMPTY_STRING );
}
while ( viewer.getColumnCount( ) > 0 )
@@ -248,8 +250,8 @@
{
MessageDialog.openInformation( this.getControl( )
.getShell( ),
- Messages.getString( "ColumnMappingDialog.prompt.dialog.title" ),
- Messages.getString( "ColumnMappingDialog.prompt.maxRow" ) );
+ Messages.getString( "ColumnMappingDialog.prompt.dialog.title" ), //$NON-NLS-1$
+ Messages.getString( "ColumnMappingDialog.prompt.maxRow" ) ); //$NON-NLS-1$
rowCount = MAX_ROW;
}
}
@@ -260,7 +262,7 @@
}
column = new TableColumn( viewer, SWT.LEFT );
- column.setText( " " ); //$NON-NLS-1$
+ column.setText( " " ); //$NON-NLS-1$
column.setResizable( false );
column.setWidth( 20 );
for ( int i = 0; i < count; i++ )
@@ -269,7 +271,7 @@
column = new TableColumn( viewer, SWT.LEFT );
else
column = viewer.getColumn( i + 1 );
- column.setText( columnName[i] ); //$NON-NLS-1$
+ column.setText( columnName[i] );
column.setWidth( 100 );
addColumnSortListener( column, i+1 );
}
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/TreeNodeDataUtil.java b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/TreeNodeDataUtil.java
index 2fec156..8c22ffd 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/TreeNodeDataUtil.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/TreeNodeDataUtil.java
@@ -1,4 +1,13 @@
-
+/*******************************************************************************
+ * Copyright (c) 2004, 2008 Actuate Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Actuate Corporation - initial API and implementation
+ *******************************************************************************/
package org.eclipse.datatools.enablement.oda.xml.ui.wizards;
import java.net.URL;
@@ -16,10 +25,15 @@
public class TreeNodeDataUtil
{
- private static Image sourceFileImage, xmlElementImage, columnImage;
- private static String SOURCE_FILE_ICON = "xPathChoosePage.FileNameIcon";
- private static String XML_ELEMENT_ICON = "xPathChoosePage.XMLElementIcon";
- private static String COLUMN_ICON = "xPathChoosePage.ColumnIcon";
+ private static final String ICONS_XML_COLUMN_GIF_CONSTANT = "icons/XML_column.gif"; //$NON-NLS-1$
+ private static final String XML_ELEMENT_GIF_LOCATION = "icons/XML_element.gif"; //$NON-NLS-1$
+ private static final String XML_FILE_GIF_LOCATION = "icons/XML_file.gif"; //$NON-NLS-1$
+ private static final String FORWARD_SLASH = "/"; //$NON-NLS-1$
+
+ private static Image sourceFileImage, xmlElementImage, columnImage;
+ private static String SOURCE_FILE_ICON = "xPathChoosePage.FileNameIcon"; //$NON-NLS-1$
+ private static String XML_ELEMENT_ICON = "xPathChoosePage.XMLElementIcon"; //$NON-NLS-1$
+ private static String COLUMN_ICON = "xPathChoosePage.ColumnIcon"; //$NON-NLS-1$
static
{
@@ -27,14 +41,14 @@
{
ImageRegistry reg = JFaceResources.getImageRegistry( );
reg.put( SOURCE_FILE_ICON,
- ImageDescriptor.createFromURL( new URL(UiPlugin.getDefault().getBundle().getEntry("/"),
- "icons/XML_file.gif" )) );//$NON-NLS-1$
+ ImageDescriptor.createFromURL( new URL(UiPlugin.getDefault().getBundle().getEntry(FORWARD_SLASH),
+ XML_FILE_GIF_LOCATION )) );
reg.put( XML_ELEMENT_ICON,
- ImageDescriptor.createFromURL( new URL(UiPlugin.getDefault().getBundle().getEntry("/"),
- "icons/XML_element.gif" )) );//$NON-NLS-1$
+ ImageDescriptor.createFromURL( new URL(UiPlugin.getDefault().getBundle().getEntry(FORWARD_SLASH),
+ XML_ELEMENT_GIF_LOCATION )) );
reg.put( COLUMN_ICON,
- ImageDescriptor.createFromURL( new URL(UiPlugin.getDefault().getBundle().getEntry("/"),
- "icons/XML_column.gif" )) );//$NON-NLS-1$
+ ImageDescriptor.createFromURL( new URL(UiPlugin.getDefault().getBundle().getEntry(FORWARD_SLASH),
+ ICONS_XML_COLUMN_GIF_CONSTANT )) );
sourceFileImage = JFaceResources.getImage( SOURCE_FILE_ICON );
xmlElementImage = JFaceResources.getImage( XML_ELEMENT_ICON );
columnImage = JFaceResources.getImage( COLUMN_ICON );
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/TreePopulationUtil.java b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/TreePopulationUtil.java
index 38ef3fd..ea706b9 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/TreePopulationUtil.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/TreePopulationUtil.java
@@ -1,6 +1,6 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 Actuate Corporation.
+ * Copyright (c) 2004, 2008 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -13,7 +13,6 @@
import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.datatools.enablement.oda.xml.util.ui.ATreeNode;
-import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
@@ -24,7 +23,10 @@
final class TreePopulationUtil
{
- /**
+ private static final String ROOT = "ROOT"; //$NON-NLS-1$
+ private static final String ATTRIBUTE_MARKER = "@"; //$NON-NLS-1$
+
+ /**
* populate tree items
* @param tree
* @param node
@@ -48,7 +50,7 @@
TreeNodeData treeNode = new TreeNodeData( aTreeNode );
if( aTreeNode.getType( ) == ATreeNode.ELEMENT_TYPE )
{
- if ( aTreeNode.getParent() != null && "ROOT".equals( aTreeNode.getParent( ).getValue( )) )
+ if ( aTreeNode.getParent() != null && ROOT.equals( aTreeNode.getParent( ).getValue( )) )
{
treeItem.setImage( TreeNodeDataUtil.getSourceFileImage( ) );
}
@@ -66,7 +68,7 @@
treeItem.setData( treeNode );
int type = treeNode.getTreeNode().getType( );
if ( type == ATreeNode.ATTRIBUTE_TYPE )
- treeItem.setText( "@" + treeNode.getTreeNode().getValue( ).toString( ) );
+ treeItem.setText( ATTRIBUTE_MARKER + treeNode.getTreeNode().getValue( ).toString( ) );
else
treeItem.setText( treeNode.getTreeNode().getValue( ).toString( ) );
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/XMLConnection.java b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/XMLConnection.java
index a439e77..9b63b90 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/XMLConnection.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/XMLConnection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2006 Actuate Corporation.
+ * Copyright (c) 2004, 2008 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -19,7 +19,8 @@
public class XMLConnection
{
- //conncetion instantce
+ private static final String EMPTY_STRING = ""; //$NON-NLS-1$
+ //conncetion instantce
private Connection conn;
//query info
private String relationInfo;
@@ -56,7 +57,7 @@
*/
String getRelationInformation( )
{
- return relationInfo == null ? "" : relationInfo;
+ return relationInfo == null ? EMPTY_STRING : relationInfo;
}
/**
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/XMLDataPreviewDialog.java b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/XMLDataPreviewDialog.java
index aeb49fb..93be6ff 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/XMLDataPreviewDialog.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/XMLDataPreviewDialog.java
@@ -1,4 +1,13 @@
-
+/*******************************************************************************
+ * Copyright (c) 2004, 2008 Actuate Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Actuate Corporation - initial API and implementation
+ *******************************************************************************/
package org.eclipse.datatools.enablement.oda.xml.ui.wizards;
import org.eclipse.datatools.enablement.oda.xml.ui.i18n.Messages;
@@ -77,7 +86,7 @@
protected void configureShell( Shell shell )
{
super.configureShell( shell );
- shell.setText( Messages.getString( "XMLDataPreviewDialog.title" ) );
+ shell.setText( Messages.getString( "XMLDataPreviewDialog.title" ) ); //$NON-NLS-1$
}
/**
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/XMLInformationHolder.java b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/XMLInformationHolder.java
index b586f82..872192f 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/XMLInformationHolder.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/XMLInformationHolder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 Actuate Corporation.
+ * Copyright (c) 2004, 2008 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -26,8 +26,9 @@
public class XMLInformationHolder
{
- private static Properties prop;
- private static String EMPTY_STRING = ""; // //$NON-NLS-1$
+ private static Properties prop;
+ private static final String EMPTY_STRING = ""; //$NON-NLS-1$
+ private static final String MINUS_ONE = "-1"; //$NON-NLS-1$
/**
*
@@ -114,7 +115,7 @@
.getProperty( Constants.CONST_PROP_MAX_ROW );
setPropertyValue( Constants.CONST_PROP_MAX_ROW, maxRow != null
- ? maxRow : "-1" );
+ ? maxRow : MINUS_ONE );
}
if ( dataSetDesign.getDataSourceDesign( ) != null )
{
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/XMLSelectionPageHelper.java b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/XMLSelectionPageHelper.java
index d498ba7..96c72c0 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/XMLSelectionPageHelper.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/XMLSelectionPageHelper.java
@@ -1,6 +1,6 @@
/*
*************************************************************************
- * Copyright (c) 2005, 2007 Actuate Corporation.
+ * Copyright (c) 2005, 2008 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -59,7 +59,9 @@
Messages.getString( "wizard.defaultMessage.selectFolder" ); //$NON-NLS-1$
private static final String EMPTY_STRING = ""; //$NON-NLS-1$
-
+ private final String[] XML_FILTER = new String[]{"*.xml", "*.*"} ; //$NON-NLS-1$ //$NON-NLS-2$
+ private final String[] XSD_FILTER = new String[]{"*.xsd", "*.*"} ; //$NON-NLS-1$ //$NON-NLS-2$
+
XMLSelectionPageHelper( WizardPage page )
{
m_wizardPage = page;
@@ -221,9 +223,7 @@
FileDialog dialog = new FileDialog( PlatformUI.getWorkbench( )
.getDisplay( ).getActiveShell( ), SWT.OPEN );
- dialog.setFilterExtensions( new String[]{
- "*.xml", "*.*" //$NON-NLS-1$ //$NON-NLS-2$
- } );
+ dialog.setFilterExtensions( XML_FILTER );
String folderLocationValue = getFolderLocationString( );
if ( folderLocationValue != null
&& folderLocationValue.trim( ).length( ) > 0 )
@@ -266,9 +266,7 @@
FileDialog dialog = new FileDialog( PlatformUI.getWorkbench( )
.getDisplay( )
.getActiveShell( ), SWT.OPEN );
- dialog.setFilterExtensions( new String[]{
- "*.xsd", "*.*" //$NON-NLS-1$ //$NON-NLS-2$
- } );
+ dialog.setFilterExtensions( XSD_FILTER );
String schemaLocationValue = getSchemaLocationString( );
if ( schemaLocationValue != null
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/XPathChoosePage.java b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/XPathChoosePage.java
index 4b17598..c41186d 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/XPathChoosePage.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/XPathChoosePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 Actuate Corporation.
+ * Copyright (c) 2004, 2008 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -57,8 +57,9 @@
public class XPathChoosePage extends DataSetWizardPage
{
- private static String DEFAULT_MESSAGE = Messages.getString( "wizard.defaultMessage.selectXPath" );
- private static final String PATH_SEPERATOR = "/";
+ private static String DEFAULT_MESSAGE = Messages.getString( "wizard.defaultMessage.selectXPath" ); //$NON-NLS-1$
+ private static final String PATH_SEPERATOR = "/"; //$NON-NLS-1$
+ private static final String EMPTY_STRING = ""; //$NON-NLS-1$
private transient Tree availableXmlTree;
private transient Composite centerComposite;
@@ -89,7 +90,7 @@
*/
public XPathChoosePage( )
{
- this( Messages.getString( "wizard.title.newDataSet" ) );
+ this( Messages.getString( "wizard.title.newDataSet" ) ); //$NON-NLS-1$
}
/**
@@ -138,7 +139,7 @@
rootPath = XMLRelationInfoUtil.getXPathExpression( queryText,
tableName );
else
- rootPath = "";
+ rootPath = EMPTY_STRING;
backupRootPath( );
if ( rootPath != null && rootPath.length( ) > 0 )
@@ -158,7 +159,7 @@
*/
protected void refresh( DataSetDesign dataSetDesign )
{
- DEFAULT_MESSAGE = Messages.getString( "xPathChoosePage.messages.elementSelection.label" );
+ DEFAULT_MESSAGE = Messages.getString( "xPathChoosePage.messages.elementSelection.label" ); //$NON-NLS-1$
if ( XMLInformationHolder.hasDestroyed( ) )
XMLInformationHolder.start( dataSetDesign );
@@ -182,7 +183,7 @@
*/
public Control createPageControl( Composite parent )
{
- DEFAULT_MESSAGE = Messages.getString( "wizard.defaultMessage.selectXPath" );
+ DEFAULT_MESSAGE = Messages.getString( "wizard.defaultMessage.selectXPath" ); //$NON-NLS-1$
this.setMessage( DEFAULT_MESSAGE );
Composite composite = new Composite( parent, SWT.NONE );
@@ -256,7 +257,7 @@
} );
- treeGroup.setText( Messages.getString( "xPathChoosePage.messages.xmlStructure" ) );
+ treeGroup.setText( Messages.getString( "xPathChoosePage.messages.xmlStructure" ) ); //$NON-NLS-1$
}
/**
@@ -275,7 +276,7 @@
GridLayout layout = new GridLayout( );
layout.numColumns = 2;
rightGroup.setLayout( layout );
- rightGroup.setText( Messages.getString( "xPathChoosePage.messages.elementSelection.label" ) );
+ rightGroup.setText( Messages.getString( "xPathChoosePage.messages.elementSelection.label" ) ); //$NON-NLS-1$
rightGroup.setLayoutData( data );
GridData buttonGd = new GridData( );
@@ -298,11 +299,10 @@
customButton.setSelection( true );
customPathLabel = new Label( rightGroup, SWT.WRAP );
customPathLabel.setLayoutData( labelGd );
- customPathLabel.setText( Messages.getString( "xPathChoosePage.messages.elementSelection.item.custom" ) );
+ customPathLabel.setText( Messages.getString( "xPathChoosePage.messages.elementSelection.item.custom" ) ); //$NON-NLS-1$
setLabelValuesAndListeners( rightGroup );
- Label blankLabel = new Label( rightGroup, SWT.NONE );
GridData txtGridData = new GridData();
txtGridData.widthHint = 200;
xmlPathField = new Combo( rightGroup, SWT.DROP_DOWN );
@@ -357,7 +357,7 @@
xpathList = getSelectedXPathList( );
if ( xpathList.size( ) < 2 )
{
- setMessage( Messages.getString( "error.xpath.getPathList" ), ERROR );
+ setMessage( Messages.getString( "error.xpath.getPathList" ), ERROR ); //$NON-NLS-1$
}
resetButtonsAndLabels( true );
}
@@ -464,12 +464,12 @@
{
if ( visible )
{
- absolutePathLabel.setText( Messages.getFormattedString( "xPathChoosePage.messages.elementSelection.item.absolutePath",
+ absolutePathLabel.setText( Messages.getFormattedString( "xPathChoosePage.messages.elementSelection.item.absolutePath", //$NON-NLS-1$
new String[]{
selectedItem.getText( ),
(String) xpathList.get( 0 )
} ) );
- anyLocationLabel.setText( Messages.getFormattedString( "xPathChoosePage.messages.elementSelection.item.anyLocation",
+ anyLocationLabel.setText( Messages.getFormattedString( "xPathChoosePage.messages.elementSelection.item.anyLocation", //$NON-NLS-1$
new String[]{
selectedItem.getText( ),
(String) xpathList.get( 1 )
@@ -477,8 +477,8 @@
}
else
{
- absolutePathLabel.setText( Messages.getString( "xPathChoosePage.messages.elementSelection.disable.absolutePath" ) );
- anyLocationLabel.setText( Messages.getString( "xPathChoosePage.messages.elementSelection.disable.anyLocation" ) );
+ absolutePathLabel.setText( Messages.getString( "xPathChoosePage.messages.elementSelection.disable.absolutePath" ) ); //$NON-NLS-1$
+ anyLocationLabel.setText( Messages.getString( "xPathChoosePage.messages.elementSelection.disable.anyLocation" ) ); //$NON-NLS-1$
}
absolutePathButton.setEnabled( visible );
absolutePathLabel.setEnabled( visible );
@@ -583,9 +583,9 @@
|| treeNode.getChildren( ) == null
|| treeNode.getChildren( ).length == 0 )
{
- OdaException ex = new OdaException( Messages.getString( "dataset.error.populateXMLTree" ) );
+ OdaException ex = new OdaException( Messages.getString( "dataset.error.populateXMLTree" ) ); //$NON-NLS-1$
ExceptionHandler.showException( getShell( ),
- Messages.getString( "error.label" ),
+ Messages.getString( "error.label" ), //$NON-NLS-1$
ex.getMessage( ),
ex );
}
@@ -617,7 +617,7 @@
catch ( OdaException e )
{
ExceptionHandler.showException( getShell( ),
- Messages.getString( "error.label" ),
+ Messages.getString( "error.label" ), //$NON-NLS-1$
e.getMessage( ),
e );
}
@@ -634,7 +634,7 @@
catch ( Exception e )
{
ExceptionHandler.showException( getShell( ),
- Messages.getString( "error.label" ),
+ Messages.getString( "error.label" ), //$NON-NLS-1$
e.getMessage( ),
e );
}
@@ -649,18 +649,18 @@
if ( !isRootPathValid( ) )
{
setPageComplete( false );
- this.setMessage( Messages.getFormattedString( "error.invalidXpath",
+ this.setMessage( Messages.getFormattedString( "error.invalidXpath", //$NON-NLS-1$
new Object[]{
- rootPath == null ? "" : rootPath
+ rootPath == null ? EMPTY_STRING : rootPath
} ), IMessageProvider.ERROR );
}
else
{
if ( initRootPath != null
- && !initRootPath.equals( "" )
+ && !initRootPath.equals( EMPTY_STRING )
&& !initRootPath.equals( rootPath ) )
{
- setMessage( Messages.getString( "xPathChoosePage.messages.xpathChange" ),
+ setMessage( Messages.getString( "xPathChoosePage.messages.xpathChange" ), //$NON-NLS-1$
INFORMATION );
}
else
@@ -757,9 +757,9 @@
return true;
if ( !isRootPathValid( ) )
{
- this.setMessage( Messages.getFormattedString( "error.invalidXpath",
+ this.setMessage( Messages.getFormattedString( "error.invalidXpath", //$NON-NLS-1$
new Object[]{
- rootPath == null ? "" : rootPath
+ rootPath == null ? EMPTY_STRING : rootPath
} ), IMessageProvider.ERROR );
return false;
}
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/XmlDataSetSelectionPage.java b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/XmlDataSetSelectionPage.java
index 7fb25a5..4186e51 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/XmlDataSetSelectionPage.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml.ui/src/org/eclipse/datatools/enablement/oda/xml/ui/wizards/XmlDataSetSelectionPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 Actuate Corporation.
+ * Copyright (c) 2004, 2008 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -49,7 +49,9 @@
public class XmlDataSetSelectionPage extends DataSetWizardPage
{
- private static String DEFAULT_MESSAGE = Messages.getString( "wizard.defaultMessage.selectFile" ); //$NON-NLS-1$
+ private static final String MINUS_ONE = "-1"; //$NON-NLS-1$
+ private static final String EMPTY_STRING = ""; //$NON-NLS-1$
+ private static String DEFAULT_MESSAGE = Messages.getString( "wizard.defaultMessage.selectFile" ); //$NON-NLS-1$
private static final int ERROR_FOLDER = 1;
private static final int ERROR_EMPTY_PATH = 2;
@@ -68,13 +70,15 @@
private final int NEGATIVE_ROW_NUMBER = -4;
private int maxRow = UNUSED_ROW_CACHE;
+
+ private final String[] XML_FILTER = new String[]{"*.xml", "*.*"}; //$NON-NLS-1$ //$NON-NLS-2$
/**
* @param string
*/
public XmlDataSetSelectionPage( )
{
- this( Messages.getString( "wizard.title.newDataSet" ) );
+ this( Messages.getString( "wizard.title.newDataSet" ) ); //$NON-NLS-1$
}
/**
@@ -137,7 +141,7 @@
if ( xmlFile == null || xmlFile.trim( ).length( ) == 0 )
{
this.useDataSourceXMLDataSelected = true;
- this.folderLocation.setText( "" );
+ this.folderLocation.setText( EMPTY_STRING );
enableFolderLocation( false );
}
else
@@ -207,7 +211,7 @@
GridData data = new GridData( );
Label previewLabel = new Label( numOfLinesGroup, SWT.NONE );
- previewLabel.setText( Messages.getString( "label.preview" ) );
+ previewLabel.setText( Messages.getString( "label.preview" ) ); //$NON-NLS-1$
previewLabel.setData( data );
numberText = new Text( numOfLinesGroup, SWT.BORDER );
@@ -228,7 +232,7 @@
}
} );
final Label label = new Label( numOfLinesGroup, SWT.BEGINNING );
- label.setText( Messages.getString( "xmlDataSetSelectionPage.messages.lineofdata" ) );
+ label.setText( Messages.getString( "xmlDataSetSelectionPage.messages.lineofdata" ) ); //$NON-NLS-1$
}
/**
@@ -246,7 +250,7 @@
useXMLDataSourceButton = new Button( composite, SWT.RADIO );
useXMLDataSourceButton.setSelection( true );
- useXMLDataSourceButton.setText( Messages.getString( "label.useXMLFileFromDataSource" ) );
+ useXMLDataSourceButton.setText( Messages.getString( "label.useXMLFileFromDataSource" ) ); //$NON-NLS-1$
useXMLDataSourceButton.setLayoutData( data );
@@ -259,7 +263,7 @@
if ( useDataSourceXMLDataSelected )
{
enableFolderLocation( false );
- fileLocation = "";
+ fileLocation = EMPTY_STRING;
}
else
{
@@ -281,7 +285,7 @@
sourceData.verticalIndent = 8;
enterXMLSourceButton = new Button( composite, SWT.RADIO );
enterXMLSourceButton.setLayoutData( sourceData );
- enterXMLSourceButton.setText( Messages.getString( "lable.selectXmlFile" ) );
+ enterXMLSourceButton.setText( Messages.getString( "lable.selectXmlFile" ) ); //$NON-NLS-1$
}
/**
@@ -310,7 +314,7 @@
if ( maxRow == INVALID_ROW_NUMBER || maxRow == NEGATIVE_ROW_NUMBER )
{
setPageComplete( false );
- setDetailsMessage( Messages.getString( "error.dataset.maxRowNumberError" ),
+ setDetailsMessage( Messages.getString( "error.dataset.maxRowNumberError" ), //$NON-NLS-1$
IMessageProvider.ERROR );
}
else
@@ -401,9 +405,7 @@
FileDialog dialog = new FileDialog( PlatformUI.getWorkbench( )
.getDisplay( )
.getActiveShell( ), SWT.OPEN );
- dialog.setFilterExtensions( new String[]{
- "*.xml", "*.*"
- } );
+ dialog.setFilterExtensions( XML_FILTER );
if ( folderLocation.getText( ) != null
&& folderLocation.getText( ).trim( ).length( ) > 0 )
{
@@ -449,7 +451,7 @@
}
else
{
- setDetailsMessage( Messages.getString( "error.selectFolder" ),
+ setDetailsMessage( Messages.getString( "error.selectFolder" ), //$NON-NLS-1$
IMessageProvider.ERROR );
result = ERROR_FOLDER;
}
@@ -457,7 +459,7 @@
}
else if( !useDataSourceXMLDataSelected )
{
- setDetailsMessage( Messages.getString( "error.emptyPath" ),
+ setDetailsMessage( Messages.getString( "error.emptyPath" ), //$NON-NLS-1$
IMessageProvider.ERROR );
result = ERROR_EMPTY_PATH;
}
@@ -472,11 +474,11 @@
{
if( this.useDataSourceXMLDataSelected )
{
- this.fileLocation = "";
+ this.fileLocation = EMPTY_STRING;
}
else
{
- this.fileLocation = this.folderLocation.getText( ) == null ? ""
+ this.fileLocation = this.folderLocation.getText( ) == null ? EMPTY_STRING
: this.folderLocation.getText( );
}
XMLInformationHolder.setPropertyValue( Constants.CONST_PROP_XML_FILE, fileLocation );
@@ -563,18 +565,18 @@
if ( result == ERROR_FOLDER )
doNext = MessageDialog.openQuestion( getShell( ),
DEFAULT_MESSAGE,
- Messages.getFormattedString( "xmlDataSetSelectionPage.warning.errorReadXMLFile",
+ Messages.getFormattedString( "xmlDataSetSelectionPage.warning.errorReadXMLFile", //$NON-NLS-1$
new Object[]{
fileLocation,
- Messages.getString( "error.selectFolder" )
+ Messages.getString( "error.selectFolder" ) //$NON-NLS-1$
} ) );
else if ( result == ERROR_EMPTY_PATH )
doNext = MessageDialog.openQuestion( getShell( ),
DEFAULT_MESSAGE,
- Messages.getFormattedString( "xmlDataSetSelectionPage.warning.errorReadXMLFile",
+ Messages.getFormattedString( "xmlDataSetSelectionPage.warning.errorReadXMLFile", //$NON-NLS-1$
new Object[]{
fileLocation,
- Messages.getString( "error.emptyPath" )
+ Messages.getString( "error.emptyPath" ) //$NON-NLS-1$
} ) );
if ( isValid( ) && doNext )
{
@@ -615,8 +617,8 @@
private static Properties getPageProperties( )
{
Properties prop = new Properties( );
- prop.setProperty( Constants.CONST_PROP_XML_FILE, "" );
- prop.setProperty( Constants.CONST_PROP_MAX_ROW, "-1" );
+ prop.setProperty( Constants.CONST_PROP_XML_FILE, EMPTY_STRING );
+ prop.setProperty( Constants.CONST_PROP_MAX_ROW, MINUS_ONE );
return prop;
}
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/Constants.java b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/Constants.java
index 07029c4..fd2fbd5 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/Constants.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/Constants.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 Actuate Corporation.
+ * Copyright (c) 2004, 2008 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -22,18 +22,18 @@
public static final int DATA_SOURCE_MAJOR_VERSION = 1;
public static final int DATA_SOURCE_MINOR_VERSION = 0;
- public static final String DATA_SOURCE_PRODUCT_NAME = Messages.getString("Constants.DriverName");
+ public static final String DATA_SOURCE_PRODUCT_NAME = Messages.getString("Constants.DriverName"); //$NON-NLS-1$
public static final int CACHED_RESULT_SET_LENGTH = 10000;
- public static final String APPCONTEXT_INPUTSTREAM = "org.eclipse.datatools.enablement.oda.xml.inputStream";
- public static final String APPCONTEXT_CLOSEINPUTSTREAM = "org.eclipse.datatools.enablement.oda.xml.closeInputStream";
- public static final String APPCONTEXT_MEMORY_CACHE_SIZE = "org.eclipse.datatools.enablement.oda.xml.memoryCacheSize";
+ public static final String APPCONTEXT_INPUTSTREAM = "org.eclipse.datatools.enablement.oda.xml.inputStream"; //$NON-NLS-1$
+ public static final String APPCONTEXT_CLOSEINPUTSTREAM = "org.eclipse.datatools.enablement.oda.xml.closeInputStream"; //$NON-NLS-1$
+ public static final String APPCONTEXT_MEMORY_CACHE_SIZE = "org.eclipse.datatools.enablement.oda.xml.memoryCacheSize"; //$NON-NLS-1$
//The connection proporty that is used to give the relation information string
//to the driver.
- public static final String CONST_PROP_RELATIONINFORMATION = "RELATIONINFORMATION";
+ public static final String CONST_PROP_RELATIONINFORMATION = "RELATIONINFORMATION";//$NON-NLS-1$
//The connection property that gives the file name(s).Currently we only
//support single file.
- public static final String CONST_PROP_FILELIST = "FILELIST";
- public static final String CONST_PROP_ENCODINGLIST = "ENCODINGLIST";
+ public static final String CONST_PROP_FILELIST = "FILELIST"; //$NON-NLS-1$
+ public static final String CONST_PROP_ENCODINGLIST = "ENCODINGLIST";//$NON-NLS-1$
}
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/i18n/messages.properties b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/i18n/messages.properties
index 16235d3..8eb34e4 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/i18n/messages.properties
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/i18n/messages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2004, 2007 Actuate Corporation.
+# Copyright (c) 2004, 2008 Actuate Corporation.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -22,4 +22,7 @@
RelationInformation.InvalidFilterDefinition=The filter definition is invalid.
DateUtil.ConvertFails=Convert to date fails. Source:
dataTypes.typeNameInvalid=Data Type Name Invalid:
+dateFormatISO8601.inconvertibleValueError=Cannot convert the value of
+exception.invalidArgument=Invalid argument type.
+exception.nullDataSourceContent=Data source content is null.
ui.invalidXSDFile=The provided xsd file is invalid.
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/impl/Connection.java b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/impl/Connection.java
index 8f81195..ebd0571 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/impl/Connection.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/impl/Connection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 Actuate Corporation.
+ * Copyright (c) 2004, 2008 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -33,6 +33,8 @@
*/
public class Connection implements IConnection
{
+ private static final String TRUE_LITERAL = "true"; //$NON-NLS-1$
+
//The file which server as data source.
private XMLCreatorContent xmlContent;
@@ -72,7 +74,7 @@
}
}
else
- throw new OdaException( Messages.getString( "Connection.PropertiesMissing" ) );
+ throw new OdaException( Messages.getString( "Connection.PropertiesMissing" ) ); //$NON-NLS-1$
String encoding = (String) connProperties.get( Constants.CONST_PROP_ENCODINGLIST);
xmlContent.setEncoding(encoding);
@@ -116,7 +118,7 @@
Object closeInputStream = appContext.get(Constants.APPCONTEXT_CLOSEINPUTSTREAM);
if( closeInputStream != null )
{
- if( closeInputStream.toString().equalsIgnoreCase("true"))
+ if( closeInputStream.toString().equalsIgnoreCase( TRUE_LITERAL ) )
closeInputStreamFromAppContext( );
}
}
@@ -156,7 +158,7 @@
public void setAppContext( Object context ) throws OdaException
{
if ( !( context instanceof Map ) )
- throw new OdaException( Messages.getString( "Connection.InvalidAppContext" ) );
+ throw new OdaException( Messages.getString( "Connection.InvalidAppContext" ) );//$NON-NLS-1$
this.appContext = (Map) context;
// The following code are for backward compatibility only.Once we
@@ -164,7 +166,7 @@
// support original BIRT ODA XML Driver this code block should be
// removed.
// ///////////////////////////////////////////////////////////////////
- String legacyInputStreamKey = "org.eclipse.birt.report.data.oda.xml.inputStream";
+ String legacyInputStreamKey = "org.eclipse.birt.report.data.oda.xml.inputStream"; //$NON-NLS-1$
if ( this.appContext.get( legacyInputStreamKey ) != null )
{
this.appContext.put( Constants.APPCONTEXT_INPUTSTREAM,
@@ -172,7 +174,7 @@
this.appContext.remove( legacyInputStreamKey );
}
- String legacyCloseInputStreamKey = "org.eclipse.birt.report.data.oda.xml.closeInputStream";
+ String legacyCloseInputStreamKey = "org.eclipse.birt.report.data.oda.xml.closeInputStream"; //$NON-NLS-1$
if ( this.appContext.get( legacyCloseInputStreamKey ) != null )
{
this.appContext.put( Constants.APPCONTEXT_CLOSEINPUTSTREAM,
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/impl/DataSetMetaData.java b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/impl/DataSetMetaData.java
index ac477d2..2a71bf3 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/impl/DataSetMetaData.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/impl/DataSetMetaData.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2006 Actuate Corporation.
+ * Copyright (c) 2004, 2008 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -22,7 +22,8 @@
*/
public class DataSetMetaData implements IDataSetMetaData
{
- //
+ private static final String DOT = "."; //$NON-NLS-1$
+
private IConnection connection = null;
/**
@@ -86,7 +87,7 @@
*/
public String getDataSourceProductVersion( ) throws OdaException
{
- return String.valueOf(this.getDataSourceMajorVersion()) + "." +
+ return String.valueOf(this.getDataSourceMajorVersion()) + DOT +
String.valueOf(this.getDataSourceMinorVersion());
}
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/impl/Query.java b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/impl/Query.java
index ffce1ea..b3f2294 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/impl/Query.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/impl/Query.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 Actuate Corporation.
+ * Copyright (c) 2004, 2008 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -30,7 +30,7 @@
*/
public class Query implements IQuery
{
- public static final String QUERYTEXT_TABLE_NAME_DEFN_DELIMITER = "#-TNAME-#";
+ public static final String QUERYTEXT_TABLE_NAME_DEFN_DELIMITER = "#-TNAME-#"; //$NON-NLS-1$
//The RelationInformation
private RelationInformation relationInformation;
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/impl/ResultSet.java b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/impl/ResultSet.java
index 288d04f..2818937 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/impl/ResultSet.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/impl/ResultSet.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 Actuate Corporation.
+ * Copyright (c) 2004, 2008 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -31,7 +31,11 @@
*/
public class ResultSet implements IResultSet
{
- //The ResultSetMetaData of this resultSet.
+ private static final String FALSE_LITERAL = "false"; //$NON-NLS-1$
+ private static final String TRUE_LITERAL = "true"; //$NON-NLS-1$
+ private static final String SINGLE_SPACE = " "; //$NON-NLS-1$
+
+ //The ResultSetMetaData of this resultSet.
private ResultSetMetaData rsMetaData;
//the max number of rows can be fetched from this result set.
@@ -432,7 +436,7 @@
{
try
{
- stringValue = stringValue.replaceAll("\\QT\\E"," ").split("\\QZ\\E")[0];
+ stringValue = stringValue.replaceAll("\\QT\\E", SINGLE_SPACE).split("\\QZ\\E")[0];//$NON-NLS-1$ //$NON-NLS-2$
return Timestamp.valueOf( stringValue );
}
catch( IllegalArgumentException e )
@@ -546,9 +550,9 @@
testClosed( );
if ( stringValue != null )
{
- if ( stringValue.equalsIgnoreCase( "true" ) )
+ if ( stringValue.equalsIgnoreCase( TRUE_LITERAL ) )
return Boolean.TRUE;
- else if ( stringValue.equalsIgnoreCase( "false" ) )
+ else if ( stringValue.equalsIgnoreCase( FALSE_LITERAL ) )
return Boolean.FALSE;
else
{
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/MappingPathElementTree.java b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/MappingPathElementTree.java
index 3b74064..25bea8c 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/MappingPathElementTree.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/MappingPathElementTree.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 Actuate Corporation.
+ * Copyright (c) 2004, 2008 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -37,8 +37,10 @@
*/
public class MappingPathElementTree
{
- static final String DOUBLE_SLASH_REPLACEMENT = "<>";
- static final String ASTERISK = "*";
+ static final String DOUBLE_SLASH_REPLACEMENT = "<>"; //$NON-NLS-1$
+ private static final String EMPTY_STRING = ""; //$NON-NLS-1$
+ private static final String FORWARD_SLASH = "/"; //$NON-NLS-1$
+ private static final String DOUBLE_SLASH = "//"; //$NON-NLS-1$
// the TreeNode corresponding with the first path element in the mapping
// path of the table
@@ -77,18 +79,18 @@
continue;
}
- if ( relativePath.equals( "" ) ) // column path is the same with table path
+ if ( relativePath.equals( EMPTY_STRING ) ) // column path is the same with table path
{
lastTreeNodeForTablePath.addColumnIndex( i );
}
- else if ( relativePath.startsWith( "../" ) || relativePath.equals( ".." ))
+ else if ( relativePath.startsWith( "../" ) || relativePath.equals( ".." ))//$NON-NLS-1$ //$NON-NLS-2$
// A nested column, unaccessible down from the table path
{
int doubleDotCount = 0;
- String[] splits = relativePath.split( "/" );
+ String[] splits = relativePath.split( FORWARD_SLASH );
for (int j = 0; j < splits.length; j++)
{
- if (splits[j].equals( ".." ))
+ if (splits[j].equals( ".." ))//$NON-NLS-1$
{
doubleDotCount++;
}
@@ -98,8 +100,8 @@
doubleDotCount );
// remove all the prefix ../..
- String path = relativePath.replaceFirst( "\\Q..\\E(\\Q/..\\E)*",
- "" );
+ String path = relativePath.replaceFirst( "\\Q..\\E(\\Q/..\\E)*", //$NON-NLS-1$
+ EMPTY_STRING );
indexNestedColumnMap.put( new Integer( i ),
new NestedColumn( doubleDotCount, path ) );
@@ -154,7 +156,7 @@
*/
private Set getPossibleEndNodes( String absolutePath )
{
- String[] splits = absolutePath.split( "/" );
+ String[] splits = absolutePath.split( FORWARD_SLASH );
Set result = new HashSet( );
if ( splits.length == 0 )
{
@@ -331,13 +333,13 @@
return new int[0];
}
- String pureRelativePath = "";
+ String pureRelativePath = EMPTY_STRING;
if ( !columnAbsolutePath.equals( tableAbsolutePath ) )
{
pureRelativePath = columnAbsolutePath.substring( tableAbsolutePath.length( ) );
}
- String[] splits = pureRelativePath.split( "/" );
+ String[] splits = pureRelativePath.split( FORWARD_SLASH );
Set columnEndNodes = new HashSet( );
if ( splits.length == 1 ) // columnAbsolutePath.equals(tableAbsolutePath )
{
@@ -406,8 +408,8 @@
{
return false;
}
- String[] tableSplits = tablePath.split( "/" );
- String[] columnSplits = columnPath.split( "/" );
+ String[] tableSplits = tablePath.split( FORWARD_SLASH );
+ String[] columnSplits = columnPath.split( FORWARD_SLASH );
if ( tableSplits.length == 0 )
{
@@ -426,26 +428,26 @@
return false;
}
- StringBuffer ancestorPath = new StringBuffer( "" );
+ StringBuffer ancestorPath = new StringBuffer( EMPTY_STRING );
for ( int i = 1; i < tableSplits.length - doubleDotCount; i++ )
{
if ( !tableSplits[i].equals( columnSplits[i] ) )
{
return false;
}
- ancestorPath.append( "/" ).append( tableSplits[i] );
+ ancestorPath.append( FORWARD_SLASH ).append( tableSplits[i] );
}
//just up, no down
if (columnPath.equals( ancestorPath.toString( ) ))
{
- return nc.getPurePath( ).equals( "" );
+ return nc.getPurePath( ).equals( EMPTY_STRING );
}
String relativePath = columnPath.substring( ancestorPath.length( ) );
String pureMappingPath = nc.getPurePath( );
- if (pureMappingPath.equals( "" ))
+ if (pureMappingPath.equals( EMPTY_STRING ))
{
//mapping just up, no down
return false;
@@ -519,11 +521,11 @@
private void initFromTablePath( String tablePath )
{
// used to differentiate "//" and "/"
- tablePath = tablePath.replaceAll( "//", "/"+ DOUBLE_SLASH_REPLACEMENT + "/" );
+ tablePath = tablePath.replaceAll( DOUBLE_SLASH, FORWARD_SLASH+ DOUBLE_SLASH_REPLACEMENT + FORWARD_SLASH );
- String[] splits = tablePath.split( "/" );
+ String[] splits = tablePath.split( FORWARD_SLASH );
- root = new ElementNode( "/" );
+ root = new ElementNode( FORWARD_SLASH );
assert splits.length > 1;
@@ -550,14 +552,14 @@
String relativePath, int columnIndex )
{
// used to differentiate "//" and "/"
- String dummy = relativePath.replaceAll( "//", "/" + DOUBLE_SLASH_REPLACEMENT + "/" );
+ String dummy = relativePath.replaceAll( DOUBLE_SLASH, FORWARD_SLASH + DOUBLE_SLASH_REPLACEMENT + FORWARD_SLASH );
- String[] splits = dummy.split( "/" );
+ String[] splits = dummy.split( FORWARD_SLASH );
TreeNode currentNode = fromNode;
int j = (splits.length > 0 // splits of "/" is String[0]
- && splits[0].equals( "" )) ? 1 : 0; //splits of "/A/B" be [][A][B], splits of "A/B" be [A][B]
+ && splits[0].equals( EMPTY_STRING )) ? 1 : 0; //splits of "/A/B" be [][A][B], splits of "A/B" be [A][B]
for ( ; j < splits.length; j++ )
{
currentNode = ( (ChildrenAllowedTreeNode) currentNode ).addChild( splits[j] );
@@ -573,12 +575,12 @@
public static boolean isValidTableMappingPath(String tablePath)
{
return (tablePath != null
- && tablePath.startsWith( "/" ) //tablePath must start with "/"
- && !tablePath.equals( "/" ) //tablePath can not be "/"
- && tablePath.indexOf( "///" ) == -1
+ && tablePath.startsWith( FORWARD_SLASH ) //tablePath must start with "/"
+ && !tablePath.equals( FORWARD_SLASH ) //tablePath can not be "/"
+ && tablePath.indexOf( "///" ) == -1 //$NON-NLS-1$
&& !containParentAxisAfterAnyElement(tablePath)
//if contain attribute path element, that must be the last element in the path
- && !tablePath.matches( ".*\\Q/@\\E.*\\Q/\\E.+" ));
+ && !tablePath.matches( ".*\\Q/@\\E.*\\Q/\\E.+" )); //$NON-NLS-1$
}
/**
@@ -589,10 +591,10 @@
private static boolean isValidColumnMappingPath(String columnPath)
{
return columnPath != null
- && columnPath.indexOf( "///" ) == -1
+ && columnPath.indexOf( "///" ) == -1 //$NON-NLS-1$
&& !containParentAxisAfterAnyElement(columnPath)
//if contain attribute path element, that must be the last element in the path
- && !columnPath.matches( ".*\\Q/@\\E.*\\Q/\\E.+" );
+ && !columnPath.matches( ".*\\Q/@\\E.*\\Q/\\E.+" );//$NON-NLS-1$
}
/**
@@ -603,8 +605,8 @@
*/
private static boolean containParentAxisAfterAnyElement(String mappingPath)
{
- return mappingPath.matches( ".*\\Q//../\\E.*" )
- || mappingPath.matches( ".*\\Q//..\\E$" );
+ return mappingPath.matches( ".*\\Q//../\\E.*" ) //$NON-NLS-1$
+ || mappingPath.matches( ".*\\Q//..\\E$" ); //$NON-NLS-1$
}
}
@@ -692,7 +694,11 @@
abstract class ChildrenAllowedTreeNode extends TreeNode
{
- private AnyNumberElementPlaceholderNode anyNumberElementChild = null;
+ protected static final String EMPTY_STRING = ""; //$NON-NLS-1$
+ protected static final String ASTERISK = "*"; //$NON-NLS-1$
+ protected static final String ATTR_MARKER = "@"; //$NON-NLS-1$
+
+ private AnyNumberElementPlaceholderNode anyNumberElementChild = null;
private OneElementPlaceholderNode oneElementChild = null;
@@ -728,7 +734,7 @@
hasChild = true;
return anyNumberElementChild;
}
- else if (pathElement.equals( MappingPathElementTree.ASTERISK ))
+ else if (pathElement.equals( ASTERISK ))
{
if (oneElementChild == null)
{
@@ -738,7 +744,7 @@
hasChild = true;
return oneElementChild;
}
- else if ( pathElement.startsWith( "@" ) )
+ else if ( pathElement.startsWith( ATTR_MARKER ) )
{
TreeNode existNode = (TreeNode)attrChildren.get( pathElement );
if (existNode == null)
@@ -753,7 +759,7 @@
else
{
TreeNode existNode = null;
- String pureElement = pathElement.replaceAll( "\\Q[\\E\\d+\\Q]\\E$", "" );
+ String pureElement = pathElement.replaceAll( "\\Q[\\E\\d+\\Q]\\E$", EMPTY_STRING );//$NON-NLS-1$
Set elementNodes = (Set)elementChildren.get( pureElement );
if (elementNodes == null)
{
@@ -779,21 +785,17 @@
return existNode;
}
}
-
protected boolean hasChild( )
{
return hasChild;
}
-
-
protected TreeNode getAnyNumberElementChild( )
{
return anyNumberElementChild;
}
-
/**
* @param pathElement: one of pathElement in the absolute path generated during xml file parsing
* @return all the children which matches pathElement
@@ -810,7 +812,7 @@
{
result.add( oneElementChild );
}
- if (pathElement.startsWith( "@"))
+ if (pathElement.startsWith( ATTR_MARKER ))
{
TreeNode node = (TreeNode)attrChildren.get( pathElement );
if (node != null)
@@ -820,7 +822,7 @@
}
else
{
- String pureElement = pathElement.replaceAll( "\\Q[\\E\\d+\\Q]\\E$", "" );
+ String pureElement = pathElement.replaceAll( "\\Q[\\E\\d+\\Q]\\E$", EMPTY_STRING ); //$NON-NLS-1$
Set elementNodes = (Set)elementChildren.get( pureElement );
if (elementNodes != null)
{
@@ -884,14 +886,14 @@
{
assert pathElement != null;
// has index prediction
- if ( this.getPathElemntName( ).matches( ".*\\Q[\\E\\d+\\Q]\\E$" ) )
+ if ( this.getPathElemntName( ).matches( ".*\\Q[\\E\\d+\\Q]\\E$" ) )//$NON-NLS-1$
{
return getPathElemntName( ).equals( pathElement );
}
else
{
return this.getPathElemntName( )
- .equals( pathElement.replaceAll( "\\Q[\\E\\d+\\Q]\\E$", "" ) );
+ .equals( pathElement.replaceAll( "\\Q[\\E\\d+\\Q]\\E$", EMPTY_STRING ) );//$NON-NLS-1$
}
}
}
@@ -905,7 +907,7 @@
// node name makes no sense for AnyElementPlaceholderNode
AnyNumberElementPlaceholderNode( )
{
- super( "" );
+ super( EMPTY_STRING );
}
/**
@@ -917,7 +919,7 @@
boolean matches( String pathElement )
{
// matches any xml element, but not attribute
- return !pathElement.startsWith( "@" );
+ return !pathElement.startsWith( ATTR_MARKER );
}
protected TreeNode addChild( String pathElement )
@@ -944,7 +946,7 @@
{
OneElementPlaceholderNode( )
{
- super("");
+ super(EMPTY_STRING);
}
/**
@@ -956,7 +958,7 @@
boolean matches( String pathElement )
{
// matches any xml element, but not attribute
- return !pathElement.startsWith( "@" );
+ return !pathElement.startsWith( ATTR_MARKER );
}
}
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/RelationInformation.java b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/RelationInformation.java
index 3decabf..d914556 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/RelationInformation.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/RelationInformation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 Actuate Corporation.
+ * Copyright (c) 2004, 2008 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -29,11 +29,15 @@
*/
public class RelationInformation
{
- //
- public static final String CONST_TABLE_DELIMITER = "#-#";
- public static final String CONST_TABLE_COLUMN_DELIMITER = "#:#";
- public static final String CONST_COLUMN_METAINFO_DELIMITER = ";";
- public static final String CONST_COLUMN_DELIMITER = ",";
+ private static final String EMPTY_STRING = ""; //$NON-NLS-1$
+ private static final String DOUBLE_QUOTE = "\""; //$NON-NLS-1$
+ private static final String SINGLE_QUOTE = "'"; //$NON-NLS-1$
+ private static final String FORWARD_SLASH = "/"; //$NON-NLS-1$
+
+ public static final String CONST_TABLE_DELIMITER = "#-#"; //$NON-NLS-1$
+ public static final String CONST_TABLE_COLUMN_DELIMITER = "#:#"; //$NON-NLS-1$
+ public static final String CONST_COLUMN_METAINFO_DELIMITER = ";"; //$NON-NLS-1$
+ public static final String CONST_COLUMN_DELIMITER = ","; //$NON-NLS-1$
//
private HashMap tableInfos;
@@ -57,7 +61,7 @@
private void initialize( String relationString ) throws OdaException
{
if( relationString == null|| relationString.length() == 0)
- throw new OdaException( Messages.getString("RelationInformation.InputStringCannotBeNull"));
+ throw new OdaException( Messages.getString("RelationInformation.InputStringCannotBeNull"));//$NON-NLS-1$
String[] tables = relationString.split( CONST_TABLE_DELIMITER );
for ( int i = 0; i < tables.length; i++ )
@@ -88,7 +92,7 @@
//columnInfos[0]: column name
//columnInfos[1]: column type
//columnInfos[2]: column XPath
- String columnXpath = "";
+ String columnXpath = EMPTY_STRING;
for ( int m = 0; m < columnInfos.length; m++ )
columnInfos[m] = columnInfos[m].trim( );
if( columnInfos.length == 3 )
@@ -97,7 +101,7 @@
}
HashMap map = null;
//if it is a filter expression
- if ( columnXpath.matches( ".*\\Q[@\\E.*\\Q=\\E.*" ) )
+ if ( columnXpath.matches( ".*\\Q[@\\E.*\\Q=\\E.*" ) )//$NON-NLS-1$
{
map = populateFilterInfo(filterColumnInfos, tableInfo,
columns, columnXpath);
@@ -113,19 +117,19 @@
tableInfo.addColumn( (ColumnInfo )filterColumnInfos.get( j ));
}
- if ( tableRawRoot.matches(".*\\Q[@\\E.*\\Q=\\E.*"))
+ if ( tableRawRoot.matches(".*\\Q[@\\E.*\\Q=\\E.*")) //$NON-NLS-1$
{
String tableRootWithFilter = SaxParserUtil.removeRedundantParentAxis( tableRawRoot );
String value = RelationInformation.getFilterValue( tableRootWithFilter );
String filterColumnXpath = tableRootWithFilter.replaceAll(
- "\\Q=\\E.*", "]");
- int backRef = tableRootWithFilter.split( "/" ).length - filterColumnXpath.split( "/" ).length;
- String tableFilterPart = tableRawRoot.replaceAll( ".*\\Q[\\E", "" ).replaceAll( "\\Q=\\E.*", "" );
+ "\\Q=\\E.*", "]"); //$NON-NLS-1$//$NON-NLS-2$
+ int backRef = tableRootWithFilter.split( FORWARD_SLASH ).length - filterColumnXpath.split( FORWARD_SLASH ).length;
+ String tableFilterPart = tableRawRoot.replaceAll( ".*\\Q[\\E", EMPTY_STRING ).replaceAll( "\\Q=\\E.*", EMPTY_STRING );//$NON-NLS-1$//$NON-NLS-2$
for( int n = 0; n < backRef; n++ )
{
- tableFilterPart = "../"+tableFilterPart;
+ tableFilterPart = "../"+tableFilterPart;//$NON-NLS-1$
}
String tempColumnName = SaxParserUtil.createTableRootTempColumnNameForFilter( );
@@ -133,7 +137,7 @@
tableInfo.addFilter(tempColumnName, value);
tableInfo.addColumn(new ColumnInfo( columns.length + filterColumnInfos.size( ) + 1, tempColumnName,
- "String", tableFilterPart,
+ "String", tableFilterPart, //$NON-NLS-1$
null));
}
tableInfo.bulidMappingPathTree( );
@@ -159,12 +163,12 @@
//get the filter value
String value = getFilterValue(columnXpath);
- columnXpath = columnXpath.replaceAll( "\\Q=\\E.*","" );
+ columnXpath = columnXpath.replaceAll( "\\Q=\\E.*", EMPTY_STRING ); //$NON-NLS-1$
//Replace the last "[a" with "/a"
- int index = columnXpath.lastIndexOf( "[@" );
+ int index = columnXpath.lastIndexOf( "[@" ); //$NON-NLS-1$
String before = columnXpath.substring( 0, index);
String after = columnXpath.substring( index + 1 );
- String relativePath = before + "/" + after;
+ String relativePath = before + FORWARD_SLASH + after;
String tempColumnName = SaxParserUtil
@@ -179,7 +183,7 @@
filterColumnInfos.add( new ColumnInfo( columns.length
+ filterColumnInfos.size( ) + 1,
tempColumnName,
- "String",
+ "String", //$NON-NLS-1$
relativePath,
null) );
return map;
@@ -193,17 +197,17 @@
*/
static String getFilterValue(String columnXpath) throws OdaException
{
- String value = columnXpath.replaceAll( ".*\\Q[@\\E.*\\Q=\\E",
- "" )
+ String value = columnXpath.replaceAll( ".*\\Q[@\\E.*\\Q=\\E", //$NON-NLS-1$
+ EMPTY_STRING )
.trim( );
- value = value.replaceAll( "\\Q]\\E.*", "" ).trim( );
+ value = value.replaceAll( "\\Q]\\E.*", EMPTY_STRING ).trim( ); //$NON-NLS-1$
//by now, the value should be something like "ABC" or 'ABC'
- if ( ( value.startsWith( "'" ) && value.endsWith( "'" ) )
- || ( value.startsWith( "\"" ) && value.endsWith( "\"" ) ) )
+ if ( ( value.startsWith( SINGLE_QUOTE ) && value.endsWith( SINGLE_QUOTE ) )
+ || ( value.startsWith( DOUBLE_QUOTE ) && value.endsWith( DOUBLE_QUOTE ) ) )
value = value.substring( 1, value.length( ) - 1 );
else
- throw new OdaException( Messages.getString( "RelationInformation.InvalidFilterDefinition" ));
+ throw new OdaException( Messages.getString( "RelationInformation.InvalidFilterDefinition" ));//$NON-NLS-1$
return value;
}
@@ -218,9 +222,9 @@
*/
public String getTableOriginalColumnPath( String tableName, String columnName )
{
- Object tableInfo = this.tableInfos.get( tableName == null ? "":tableName.trim( ) );
+ Object tableInfo = this.tableInfos.get( tableName == null ? EMPTY_STRING:tableName.trim( ) );
if( tableInfo != null )
- return ( (TableInfo) tableInfo ).getOriginalPath( columnName == null? "":columnName.trim( ) );
+ return ( (TableInfo) tableInfo ).getOriginalPath( columnName == null? EMPTY_STRING:columnName.trim( ) );
else
return null;
}
@@ -234,9 +238,9 @@
*/
public String getTableColumnType( String tableName, String columnName )
{
- Object tableInfo = this.tableInfos.get( tableName == null ? "":tableName.trim( ) );
+ Object tableInfo = this.tableInfos.get( tableName == null ? EMPTY_STRING:tableName.trim( ) );
if( tableInfo!= null )
- return ( (TableInfo)tableInfo ).getType( columnName == null? "":columnName.trim( ) );
+ return ( (TableInfo)tableInfo ).getType( columnName == null? EMPTY_STRING:columnName.trim( ) );
else
return null;
}
@@ -249,7 +253,7 @@
*/
public String[] getTableColumnNames( String tableName )
{
- Object tableInfo = this.tableInfos.get( tableName == null ? "":tableName.trim( ) );
+ Object tableInfo = this.tableInfos.get( tableName == null ? EMPTY_STRING:tableName.trim( ) );
if( tableInfo!= null )
return ( (TableInfo)tableInfo ).getColumnNames( );
else
@@ -263,7 +267,7 @@
*/
String[] getTableRealColumnNames( String tableName )
{
- Object tableInfo = this.tableInfos.get( tableName == null ? "":tableName.trim( ) );
+ Object tableInfo = this.tableInfos.get( tableName == null ? EMPTY_STRING:tableName.trim( ) );
if( tableInfo!= null )
return ( (TableInfo)tableInfo ).getRealColumnNames( );
else
@@ -278,7 +282,7 @@
*/
public String[] getTableNestedXMLColumnNames( String tableName )
{
- Object tableInfo = this.tableInfos.get( tableName == null ? "":tableName.trim( ) );
+ Object tableInfo = this.tableInfos.get( tableName == null ? EMPTY_STRING:tableName.trim( ) );
if( tableInfo!= null )
return ( (TableInfo)tableInfo ).getNestedXMLColumnNames( );
else
@@ -293,7 +297,7 @@
*/
public MappingPathElementTree getTableMappingPathElementTree( String tableName )
{
- Object tableInfo = this.tableInfos.get( tableName == null ? "":tableName.trim( ) );
+ Object tableInfo = this.tableInfos.get( tableName == null ? EMPTY_STRING:tableName.trim( ) );
if( tableInfo!= null )
return ( (TableInfo)tableInfo ).getMappingPathTree( );
else
@@ -308,7 +312,7 @@
*/
public String getTableRootPath( String tableName )
{
- Object tableInfo = this.tableInfos.get( tableName == null ? "":tableName.trim( ) );
+ Object tableInfo = this.tableInfos.get( tableName == null ? EMPTY_STRING:tableName.trim( ) );
if( tableInfo!= null )
return ( (TableInfo)tableInfo ).getRootPath( );
else
@@ -323,7 +327,7 @@
*/
public String getTableOriginalRootPath( String tableName )
{
- Object tableInfo = this.tableInfos.get( tableName == null ? "":tableName.trim( ) );
+ Object tableInfo = this.tableInfos.get( tableName == null ? EMPTY_STRING:tableName.trim( ) );
if( tableInfo!= null )
return ( (TableInfo)tableInfo ).getOriginalRootPath( );
else
@@ -338,7 +342,7 @@
*/
public HashMap getTableFilter( String tableName )
{
- Object tableInfo = this.tableInfos.get( tableName == null ? "":tableName.trim( ) );
+ Object tableInfo = this.tableInfos.get( tableName == null ? EMPTY_STRING:tableName.trim( ) );
if( tableInfo!= null )
return ( (TableInfo)tableInfo ).getFilter( );
else
@@ -361,7 +365,7 @@
*/
public HashMap getTableColumnFilter( String tableName, String columnName )
{
- Object tableInfo = this.tableInfos.get( tableName == null ? "":tableName.trim( ) );
+ Object tableInfo = this.tableInfos.get( tableName == null ? EMPTY_STRING:tableName.trim( ) );
if( tableInfo!= null )
return ( (TableInfo)tableInfo ).getColumnFilters(columnName);
else
@@ -376,7 +380,9 @@
*/
class TableInfo
{
- //The name of the table.
+ private static final String EMPTY_STRING = ""; //$NON-NLS-1$
+
+ //The name of the table.
private String tableName;
//The hashmap which host columnInfos
@@ -405,7 +411,7 @@
{
this.tableName = tableName;
this.originalRootPath = rootPath;
- this.rootPath = SaxParserUtil.removeRedundantParentAxis( originalRootPath.replaceAll("\\Q[@\\E.*\\Q=\\E.*\\Q]\\E", ""));
+ this.rootPath = SaxParserUtil.removeRedundantParentAxis( originalRootPath.replaceAll("\\Q[@\\E.*\\Q=\\E.*\\Q]\\E", EMPTY_STRING));//$NON-NLS-1$
this.columnInfos = new HashMap( );
this.filterInfos = new HashMap( );
}
@@ -628,7 +634,8 @@
*/
class ColumnInfo
{
- //
+ private static final String EMPTY_STRING = ""; //$NON-NLS-1$
+
private int index;
private String name;
private String type;
@@ -652,12 +659,12 @@
this.name = name;
this.type = type;
if ( !DataTypes.isValidType( type ) )
- throw new OdaException( Messages.getString( "RelationInformation.InvalidDataTypeName" ) );
+ throw new OdaException( Messages.getString( "RelationInformation.InvalidDataTypeName" ) );//$NON-NLS-1$
this.originalPath = originalPath;
//the result of removing attribution filters
- String purePath = originalPath.replaceAll( "\\Q[@\\E.*\\Q=\\E.*\\Q]\\E", "" )
- .replaceAll( "\\Q[@\\E.*\\Q]\\E", "" ).trim( );
+ String purePath = originalPath.replaceAll( "\\Q[@\\E.*\\Q=\\E.*\\Q]\\E", EMPTY_STRING )//$NON-NLS-1$
+ .replaceAll( "\\Q[@\\E.*\\Q]\\E", EMPTY_STRING ).trim( );//$NON-NLS-1$
this.path = SaxParserUtil.removeRedundantParentAxis( purePath );
this.filters = filters;
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/SaxParser.java b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/SaxParser.java
index ab0216a..319b323 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/SaxParser.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/SaxParser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 Actuate Corporation.
+ * Copyright (c) 2004, 2008 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -33,7 +33,10 @@
*/
public class SaxParser extends DefaultHandler implements Runnable
{
- private XMLDataInputStream inputStream;
+ private static final String SAX_PARSER ="org.apache.xerces.parsers.SAXParser"; //$NON-NLS-1$
+ private static final String EMPTY_STRING = ""; //$NON-NLS-1$
+
+ private XMLDataInputStream inputStream;
//The XPathHolder instance that hold the information of element currently
//being proceed
@@ -82,7 +85,7 @@
spConsumer = consumer;
start = true;
alive = true;
- currentCacheValue = "";
+ currentCacheValue = EMPTY_STRING;
currentElementRecoder = new HashMap();
stopCurrentThread = false;
cachedValues = new HashMap( );
@@ -152,7 +155,7 @@
*/
private void parse( Object xmlReader ) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
{
- Method parse = this.getMethod( "parse",
+ Method parse = this.getMethod( "parse",//$NON-NLS-1$
xmlReader.getClass( ),
new Class[]{
InputSource.class
@@ -173,7 +176,7 @@
*/
private void setErrorHandler( Object xmlReader ) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
{
- Method setErrorHandler = this.getMethod( "setErrorHandler",
+ Method setErrorHandler = this.getMethod( "setErrorHandler",//$NON-NLS-1$
xmlReader.getClass( ),
new Class[]{
ErrorHandler.class
@@ -190,7 +193,7 @@
*/
private void setContentHandler( Object xmlReader ) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
{
- Method setContentHandler = this.getMethod( "setContentHandler",
+ Method setContentHandler = this.getMethod( "setContentHandler",//$NON-NLS-1$
xmlReader.getClass( ),
new Class[]{
ContentHandler.class
@@ -215,13 +218,13 @@
{
Object xmlReader = Thread.currentThread( )
.getContextClassLoader( )
- .loadClass( "org.apache.xerces.parsers.SAXParser" )
+ .loadClass( SAX_PARSER )
.newInstance( );
return xmlReader;
}
catch ( ClassNotFoundException e )
{
- return Class.forName( "org.apache.xerces.parsers.SAXParser" )
+ return Class.forName( SAX_PARSER )
.newInstance( );
}
@@ -305,7 +308,7 @@
{
this.currentElementRecoder.put(parentPath+UtilConstants.XPATH_SLASH+elementName, new Integer(((Integer)this.currentElementRecoder.get(parentPath+UtilConstants.XPATH_SLASH+elementName)).intValue()+1 ));
}
- pathHolder.push( elementName+"["+((Integer)this.currentElementRecoder.get(parentPath+UtilConstants.XPATH_SLASH+elementName)).intValue()+"]" );
+ pathHolder.push( elementName+"["+((Integer)this.currentElementRecoder.get(parentPath+UtilConstants.XPATH_SLASH+elementName)).intValue()+"]" );//$NON-NLS-1$ //$NON-NLS-2$
spConsumer.detectNewRow( pathHolder.getPath( ), true );
for ( int i = 0; i < atts.getLength( ); i++ )
@@ -325,7 +328,7 @@
private String getAttributePath( Attributes atts, int i )
{
return pathHolder.getPath( )
- + "/@"
+ + "/@" //$NON-NLS-1$
+ atts.getQName( i );
}
@@ -347,7 +350,7 @@
String path = pathHolder.getPath();
Object[] keys = this.currentElementRecoder.keySet().toArray();
- if (!path.equals( "" ))
+ if (!path.equals( EMPTY_STRING ))
{
for(int i= 0; i < keys.length; i++)
{
@@ -369,7 +372,7 @@
public void characters( char ch[], int start, int length )
{
currentCacheValue = new String( ch, start, length );
- if ( !currentCacheValue.trim( ).equals( "" ) )
+ if ( !currentCacheValue.trim( ).equals( EMPTY_STRING ) )
{
if ( cachedValues.containsKey( pathHolder.getPath( ) ) )
currentCacheValue = (String) cachedValues.get( pathHolder.getPath( ) )
@@ -479,7 +482,8 @@
*/
class XPathHolder
{
- private List holder;
+ private static final String FORWARD_SLASH = "/"; //$NON-NLS-1$
+ private List holder;
private StringBuffer pathBuffer;
public XPathHolder( )
@@ -521,6 +525,6 @@
{
assert path != null;
holder.add( path );
- this.pathBuffer.append("/").append( path );
+ this.pathBuffer.append( FORWARD_SLASH ).append( path );
}
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/SaxParserUtil.java b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/SaxParserUtil.java
index da06195..e17a7cd 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/SaxParserUtil.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/SaxParserUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 Actuate Corporation.
+ * Copyright (c) 2004, 2008 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -19,8 +19,13 @@
*/
public class SaxParserUtil
{
- public static final String TEMPCOLUMNNAMEPREFIX = "-$TEMP_XML_COLUMN$-";
- public static final String ROOTTEMPCOLUMNNAMEPREFIX = "-$TEMP_XML_COLUMN_ROOT$-";
+ public static final String TEMPCOLUMNNAMEPREFIX = "-$TEMP_XML_COLUMN$-";//$NON-NLS-1$
+ public static final String ROOTTEMPCOLUMNNAMEPREFIX = "-$TEMP_XML_COLUMN_ROOT$-";//$NON-NLS-1$
+
+ private static final String EMPTY_STRING = ""; //$NON-NLS-1$
+ private static final String FORWARD_SLASH = "/"; //$NON-NLS-1$
+ private static final String DOUBLE_SLASH = "//"; //$NON-NLS-1$
+ private static final String ANGLE_BRACKET = "<>"; //$NON-NLS-1$
private SaxParserUtil()
{
@@ -36,15 +41,15 @@
public static String removeRedundantParentAxis( String path )
{
if (path == null
- || path.equals( "" )
- || path.indexOf( ".." ) == -1 // not contain ..
- || path.indexOf( "///" ) != -1) //invalid path
+ || path.equals( EMPTY_STRING )
+ || path.indexOf( ".." ) == -1 // not contain .. //$NON-NLS-1$
+ || path.indexOf( "///" ) != -1) //invalid path //$NON-NLS-1$
{
return path;
}
//to differentiate "//" and "/"
- String[] splits = path.replaceAll( "//", "/<>/" ).split("/");
+ String[] splits = path.replaceAll( DOUBLE_SLASH, "/<>/" ).split( FORWARD_SLASH ); //$NON-NLS-1$
if (splits.length <= 1) // "/" or just one path element
{
return path;
@@ -53,14 +58,14 @@
pathElements.add( splits[0] );
for (int i = 1; i < splits.length; i++)
{
- if (splits[i].equals( ".." ))
+ if (splits[i].equals( ".." )) //$NON-NLS-1$
{
if (pathElements.size( ) > 0)
{
Object last = pathElements.get( pathElements.size( ) - 1 );
- if (last.equals( "" )
- ||last.equals( ".." )
- || last.equals( "<>" ))
+ if (last.equals( EMPTY_STRING )
+ ||last.equals( ".." ) //$NON-NLS-1$
+ || last.equals( ANGLE_BRACKET ))
{
//not a redundant one
pathElements.add( splits[i] );
@@ -81,13 +86,13 @@
pathElements.add( splits[i] );
}
}
- StringBuffer result = new StringBuffer("");
+ StringBuffer result = new StringBuffer(EMPTY_STRING);
- if (pathElements.get( 0 ).equals( "" ) //start with "/", because Spits of "/A/B" be [][A][B]
- && !pathElements.get( 1 ).equals( "<>" ) // but not start with "//"
+ if (pathElements.get( 0 ).equals( EMPTY_STRING ) //start with "/", because Spits of "/A/B" be [][A][B]
+ && !pathElements.get( 1 ).equals( ANGLE_BRACKET ) // but not start with "//"
)
{
- result.append( "/" );
+ result.append( FORWARD_SLASH );
}
else
{
@@ -95,14 +100,14 @@
}
for (int i = 1; i <= pathElements.size( ) - 1; i++)
{
- if (pathElements.get( i ).equals( "<>" ))
+ if (pathElements.get( i ).equals( ANGLE_BRACKET ))
{
//restore to "//"
- result.append( "//" );
+ result.append( DOUBLE_SLASH );
}
else
{
- result.append( "/" ).append( pathElements.get( i ) );
+ result.append( FORWARD_SLASH ).append( pathElements.get( i ) );
}
}
return result.toString( );
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/UtilConstants.java b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/UtilConstants.java
index ac19353..2cd2810 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/UtilConstants.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/UtilConstants.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 Actuate Corporation.
+* Copyright (c) 2004, 2008 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,13 +18,13 @@
private UtilConstants()
{}
- public static final String XPATH_WITH_ATTR_PATTERN = ".*\\Q[@\\E.*\\Q]\\E.*";
- public static final String XPATH_ELEM_WITH_INDEX_REF_PATTERN = ".*\\Q[\\E\\d+\\Q]\\E.*";
- public static final String XPATH_ELEM_WITH_INDEX_WILDCARD = ".*\\Q[*]\\E.*";
- public static final String XPATH_ELEM_INDEX_WILDCARD_PATTERN = "\\Q[*]\\E";
- public static final String XPATH_ELEM_INDEX_PATTERN = "\\Q[\\E\\d+\\Q]\\E";
- public static final String XPATH_DOUBLE_SLASH = "//";
- public static final String XPATH_SLASH = "/";
-
+ public static final String XPATH_WITH_ATTR_PATTERN = ".*\\Q[@\\E.*\\Q]\\E.*"; //$NON-NLS-1$
+ public static final String XPATH_ELEM_WITH_INDEX_REF_PATTERN = ".*\\Q[\\E\\d+\\Q]\\E.*"; //$NON-NLS-1$
+ public static final String XPATH_ELEM_WITH_INDEX_WILDCARD = ".*\\Q[*]\\E.*"; //$NON-NLS-1$
+ public static final String XPATH_ELEM_INDEX_WILDCARD_PATTERN = "\\Q[*]\\E"; //$NON-NLS-1$
+ public static final String XPATH_ELEM_INDEX_PATTERN = "\\Q[\\E\\d+\\Q]\\E"; //$NON-NLS-1$
+ public static final String XPATH_DOUBLE_SLASH = "//"; //$NON-NLS-1$
+ public static final String XPATH_SLASH = "/"; //$NON-NLS-1$
+
public static final int COLUMN_REFNUMBER_RELATIVE = -1;
}
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/date/DateFormatFactory.java b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/date/DateFormatFactory.java
index 3a3dbb5..986a474 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/date/DateFormatFactory.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/date/DateFormatFactory.java
@@ -1,6 +1,6 @@
/*
*************************************************************************
- * Copyright (c) 2006, 2007 Actuate Corporation.
+ * Copyright (c) 2006, 2008 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -31,7 +31,8 @@
public class DateFormatFactory
{
- private static final int NO_TIME_STYLE = -999;
+ private static final int NO_TIME_STYLE = -999;
+ private static final String FORWARD_SLASH = "/"; //$NON-NLS-1$
// TLS HashMap from locale/style key to DateFormat instance
private static ThreadLocal tlsCache = new ThreadLocal( ) {
@@ -48,27 +49,27 @@
{
HashMap value = new HashMap( );
String[] dateFormatPattern = {
- "yyyy-MM-dd HH:mm:ss.S z",
- "yyyy-MM-dd HH:mm:ss.Sz",
- "yyyy-MM-dd HH:mm:ss.S",
- "yyyy-MM-dd HH:mm:ss z",
- "yyyy-MM-dd HH:mm:ssz",
- "yyyy-MM-dd HH:mm:ss",
- "yyyy-MM-dd HH:mm z",
- "yyyy-MM-dd HH:mmz",
- "yyyy-MM-dd HH:mm",
- "yyyy-MM-dd",
- "yyyy-MM",
- "yyyy",
- "HH:mm:ss.S z",
- "HH:mm:ss.Sz",
- "HH:mm:ss.S",
- "HH:mm:ss z",
- "HH:mm:ssz",
- "HH:mm:ss",
- "HH:mm z",
- "HH:mmz",
- "HH:mm"
+ "yyyy-MM-dd HH:mm:ss.S z", //$NON-NLS-1$
+ "yyyy-MM-dd HH:mm:ss.Sz", //$NON-NLS-1$
+ "yyyy-MM-dd HH:mm:ss.S", //$NON-NLS-1$
+ "yyyy-MM-dd HH:mm:ss z", //$NON-NLS-1$
+ "yyyy-MM-dd HH:mm:ssz", //$NON-NLS-1$
+ "yyyy-MM-dd HH:mm:ss", //$NON-NLS-1$
+ "yyyy-MM-dd HH:mm z", //$NON-NLS-1$
+ "yyyy-MM-dd HH:mmz", //$NON-NLS-1$
+ "yyyy-MM-dd HH:mm", //$NON-NLS-1$
+ "yyyy-MM-dd", //$NON-NLS-1$
+ "yyyy-MM", //$NON-NLS-1$
+ "yyyy", //$NON-NLS-1$
+ "HH:mm:ss.S z", //$NON-NLS-1$
+ "HH:mm:ss.Sz", //$NON-NLS-1$
+ "HH:mm:ss.S", //$NON-NLS-1$
+ "HH:mm:ss z", //$NON-NLS-1$
+ "HH:mm:ssz", //$NON-NLS-1$
+ "HH:mm:ss", //$NON-NLS-1$
+ "HH:mm z", //$NON-NLS-1$
+ "HH:mmz", //$NON-NLS-1$
+ "HH:mm" //$NON-NLS-1$
};
SimpleDateFormat simpleDateFormatter = null;
PatternKey patterKey = null;
@@ -96,7 +97,7 @@
// Create key string for cache lookup
String keyStr = locale.getName( )
- + "/" + Integer.toString( dateStyle ) + "/"
+ + FORWARD_SLASH + Integer.toString( dateStyle ) + FORWARD_SLASH
+ Integer.toString( timeStyle );
HashMap tlsMap = (HashMap) tlsCache.get( );
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/date/DateFormatISO8601.java b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/date/DateFormatISO8601.java
index 6390338..5957462 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/date/DateFormatISO8601.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/date/DateFormatISO8601.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 Actuate Corporation.
+ * Copyright (c) 2004, 2008 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,6 +14,7 @@
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
+import org.eclipse.datatools.enablement.oda.xml.i18n.Messages;
@@ -55,7 +56,7 @@
// for the String can not be parsed, throws a BirtException
if ( resultDate == null )
{
- throw new ParseException( "an not convert the value of " + source,
+ throw new ParseException( Messages.getString("dateFormatISO8601.inconvertibleValueError") + source, //$NON-NLS-1$
0 );
}
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/ui/ATreeNode.java b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/ui/ATreeNode.java
index 538f33f..a1e814e 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/ui/ATreeNode.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/ui/ATreeNode.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 Actuate Corporation.
+ * Copyright (c) 2004, 2008 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -59,37 +59,37 @@
{
try
{
- xmlTypeToDataType.put( "string",
+ xmlTypeToDataType.put( "string", //$NON-NLS-1$
DataTypes.getTypeString( DataTypes.STRING ) );
- xmlTypeToDataType.put( "byte",
+ xmlTypeToDataType.put( "byte", //$NON-NLS-1$
DataTypes.getTypeString( DataTypes.INT ) );
- xmlTypeToDataType.put( "decimal",
+ xmlTypeToDataType.put( "decimal", //$NON-NLS-1$
DataTypes.getTypeString( DataTypes.BIGDECIMAL ) );
- xmlTypeToDataType.put( "double",
+ xmlTypeToDataType.put( "double", //$NON-NLS-1$
DataTypes.getTypeString( DataTypes.DOUBLE ) );
- xmlTypeToDataType.put( "float",
+ xmlTypeToDataType.put( "float", //$NON-NLS-1$
DataTypes.getTypeString( DataTypes.DOUBLE ) );
- xmlTypeToDataType.put( "int",
+ xmlTypeToDataType.put( "int", //$NON-NLS-1$
DataTypes.getTypeString( DataTypes.INT ) );
- xmlTypeToDataType.put( "integer",
+ xmlTypeToDataType.put( "integer", //$NON-NLS-1$
DataTypes.getTypeString( DataTypes.INT ) );
- xmlTypeToDataType.put( "negativeInteger",
+ xmlTypeToDataType.put( "negativeInteger", //$NON-NLS-1$
DataTypes.getTypeString( DataTypes.INT ) );
- xmlTypeToDataType.put( "nonNegativeInteger",
+ xmlTypeToDataType.put( "nonNegativeInteger", //$NON-NLS-1$
DataTypes.getTypeString( DataTypes.INT ) );
- xmlTypeToDataType.put( "nonPositiveInteger",
+ xmlTypeToDataType.put( "nonPositiveInteger", //$NON-NLS-1$
DataTypes.getTypeString( DataTypes.INT ) );
- xmlTypeToDataType.put( "positiveInteger",
+ xmlTypeToDataType.put( "positiveInteger", //$NON-NLS-1$
DataTypes.getTypeString( DataTypes.INT ) );
- xmlTypeToDataType.put( "short",
+ xmlTypeToDataType.put( "short", //$NON-NLS-1$
DataTypes.getTypeString( DataTypes.INT ) );
- xmlTypeToDataType.put( "date",
+ xmlTypeToDataType.put( "date", //$NON-NLS-1$
DataTypes.getTypeString( DataTypes.DATE ) );
- xmlTypeToDataType.put( "dateTime",
+ xmlTypeToDataType.put( "dateTime", //$NON-NLS-1$
DataTypes.getTypeString( DataTypes.TIMESTAMP ) );
- xmlTypeToDataType.put( "time",
+ xmlTypeToDataType.put( "time", //$NON-NLS-1$
DataTypes.getTypeString( DataTypes.TIME ) );
- xmlTypeToDataType.put( "boolean",
+ xmlTypeToDataType.put( "boolean", //$NON-NLS-1$
DataTypes.getTypeString( DataTypes.BOOLEAN ) );
}
catch ( OdaException e )
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/ui/SchemaPopulationUtil.java b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/ui/SchemaPopulationUtil.java
index c34610c..d63d411 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/ui/SchemaPopulationUtil.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/ui/SchemaPopulationUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 Actuate Corporation.
+ * Copyright (c) 2004, 2008 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -43,7 +43,9 @@
*/
public class SchemaPopulationUtil
{
- /**
+ private static final String XSD_EXTENSION = ".XSD"; //$NON-NLS-1$
+
+ /**
* Get the schema tree's root node
* @param xsdFileName
* @param xmlFileName
@@ -59,7 +61,7 @@
throws OdaException, MalformedURLException, URISyntaxException
{
if ( xsdFileName != null
- && xsdFileName.toUpperCase( ).endsWith( ".XSD" ) )
+ && xsdFileName.toUpperCase( ).endsWith( XSD_EXTENSION ) )
{
if ( xmlFileName != null && xmlFileName.trim( ).length( ) > 0 )
return XSDFileSchemaTreePopulator.getSchemaTree( xsdFileName,
@@ -92,7 +94,10 @@
final class XMLFileSchemaTreePopulator implements ISaxParserConsumer
{
- //
+ private static final String FORWARD_SLASH = "/"; //$NON-NLS-1$
+ private static final String EMPTY_STRING = ""; //$NON-NLS-1$
+ private static final String ROOT_LITERAL = "ROOT"; //$NON-NLS-1$
+
private int rowCount;
private ATreeNode root;
private SaxParser sp;
@@ -108,7 +113,7 @@
{
this.rowCount = 0;
this.root = new ATreeNode( );
- this.root.setValue( "ROOT" );
+ this.root.setValue( ROOT_LITERAL );
this.numberOfElementsAccessiable = numberOfElementsAccessiable == 0
? Integer.MAX_VALUE : numberOfElementsAccessiable;
}
@@ -124,7 +129,7 @@
if ( isAttribute( path ) )
try
{
- this.insertNode( path.replaceAll( "\\Q[\\E\\d+\\Q]\\E", "" ).trim( ) );
+ this.insertNode( path.replaceAll( "\\Q[\\E\\d+\\Q]\\E", EMPTY_STRING ).trim( ) ); //$NON-NLS-1$
}
catch ( OdaException e )
{
@@ -143,7 +148,7 @@
{
if( isAttribute( path ) )
return;
- String treamedPath = path.replaceAll( "\\Q[\\E\\d+\\Q]\\E", "" ).trim( );
+ String treamedPath = path.replaceAll( "\\Q[\\E\\d+\\Q]\\E", EMPTY_STRING ).trim( ); //$NON-NLS-1$
try
{
this.insertNode( treamedPath );
@@ -177,7 +182,7 @@
*/
private boolean isAttribute( String path )
{
- return path.matches( ".*\\Q@\\E.*" );
+ return path.matches( ".*\\Q@\\E.*" ); //$NON-NLS-1$
}
/*
@@ -254,14 +259,14 @@
boolean isAttribute = isAttribute( treatedPath );
// Remove the leading "/" then split the path.
- String[] path = treatedPath.replaceFirst( "/", "" ).split( "/" );
+ String[] path = treatedPath.replaceFirst( FORWARD_SLASH, EMPTY_STRING ).split( FORWARD_SLASH );
// If the path specified an attribute then re-build the path array so
// that it can divid element and
// its attribute to two array items.
if ( isAttribute )
{
- String[] temp = path[path.length - 1].split( "\\Q@\\E" );
+ String[] temp = path[path.length - 1].split( "\\Q@\\E" ); //$NON-NLS-1$
assert temp.length == 2;
path[path.length-1] = temp[1];
@@ -319,6 +324,7 @@
*/
final class XSDFileSchemaTreePopulator
{
+ private static final String ROOT_LITERAL = "ROOT"; //$NON-NLS-1$
/**
* Return the root node of a schema tree.
@@ -357,7 +363,7 @@
XSNamedMap map = loadSchema( schemafileName, xmlEncoding );
ATreeNode xsdRoot = new ATreeNode( );
- xsdRoot.setValue( "ROOT" );
+ xsdRoot.setValue( ROOT_LITERAL );
for ( int i = 0; i < map.getLength( ); i++ )
{
XSElementDecl element = (XSElementDecl) map.item( i );
@@ -375,7 +381,7 @@
.equals( ( (ATreeNode) xmlRoot.getChildren( )[0] ).getValue( ) ) )
{
xsdRoot = new ATreeNode( );
- xsdRoot.setValue( "ROOT" );
+ xsdRoot.setValue( ROOT_LITERAL );
xsdRoot.addChild( node );
break;
}
@@ -429,13 +435,13 @@
}
catch ( IOException e )
{
- throw new OdaException( Messages.getString( "ui.invalidXSDFile" ) );
+ throw new OdaException( Messages.getString( "ui.invalidXSDFile" ) ); //$NON-NLS-1$
}
input.setEncoding( xmlEncoding );
XSModel xsModel = xsLoader.load( input );
if ( xsModel == null )
- throw new OdaException( Messages.getString( "ui.invalidXSDFile" ) );
+ throw new OdaException( Messages.getString( "ui.invalidXSDFile" ) ); //$NON-NLS-1$
return xsModel.getComponents( XSConstants.ELEMENT_DECLARATION );
}
@@ -456,7 +462,7 @@
XSNamedMap map = loadSchema( xsdFileName, xmlEncoding );
ATreeNode root = new ATreeNode( );
- root.setValue( "ROOT" );
+ root.setValue( ROOT_LITERAL );
for ( int i = 0; i < map.getLength( ); i++ )
{
XSElementDecl element = (XSElementDecl) map.item( i );
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/ui/XPathPopulationUtil.java b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/ui/XPathPopulationUtil.java
index a0a26fb..6b967bf 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/ui/XPathPopulationUtil.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/ui/XPathPopulationUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2006 Actuate Corporation.
+ * Copyright (c) 2004, 2008 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -23,9 +23,11 @@
final public class XPathPopulationUtil
{
- private static final String XPATH_WILDCARD = "*";
- private static final String XPATH_ATTR_HEADER_WITH_SLASH = "/@";
- private static final String XPATH_ATTR_HEADER_WITH_SQUARE_PATTERN = "\\Q[@\\E";
+ private static final String XPATH_WILDCARD = "*"; //$NON-NLS-1$
+ private static final String XPATH_ATTR_HEADER_WITH_SLASH = "/@"; //$NON-NLS-1$
+ private static final String XPATH_ATTR_HEADER_WITH_SQUARE_PATTERN = "\\Q[@\\E"; //$NON-NLS-1$
+ private static final String EMPTY_STRING = ""; //$NON-NLS-1$
+ private static final String FORWARD_SLASH = "/"; //$NON-NLS-1$
/**
* This method is used to populate the possible root path expressions List
@@ -39,7 +41,7 @@
List result = new ArrayList();
result.add( absolutePath );
if( absolutePath.startsWith(UtilConstants.XPATH_SLASH) )
- absolutePath = absolutePath.replaceFirst(UtilConstants.XPATH_SLASH,"");
+ absolutePath = absolutePath.replaceFirst(UtilConstants.XPATH_SLASH, EMPTY_STRING);
String[] xPathFrags = absolutePath.split(UtilConstants.XPATH_SLASH);
for ( int i = 1; i < xPathFrags.length;i++)
@@ -67,7 +69,7 @@
result.add( absolutePath );
if ( absolutePath.startsWith( UtilConstants.XPATH_SLASH ) )
absolutePath = absolutePath.replaceFirst( UtilConstants.XPATH_SLASH,
- "" );
+ EMPTY_STRING );
String[] xPathFrags = absolutePath.split( UtilConstants.XPATH_SLASH );
if ( xPathFrags.length > 0 )
{
@@ -114,17 +116,17 @@
assert columnPath != null;
rootPath = SaxParserUtil.removeRedundantParentAxis( rootPath );
- if( rootPath.equals( "//" )||rootPath.equals( "//*" ))
+ if( rootPath.equals( "//" )||rootPath.equals( "//*" )) //$NON-NLS-1$ //$NON-NLS-2$
{
- String[] temp = columnPath.split( "\\Q/\\E" );
+ String[] temp = columnPath.split( "\\Q/\\E" ); //$NON-NLS-1$
if( temp.length <=2 )
return null;
else
{
- String result = "";
+ String result = EMPTY_STRING;
for(int i = 2; i < temp.length; i++)
{
- result+="/"+temp[i];
+ result+= FORWARD_SLASH+temp[i];
}
return result;
}
@@ -132,7 +134,7 @@
if ( isDescendantOrSelf( columnPath, rootPath ) )
{
- return columnPath.replaceFirst("\\Q"+rootPath+"\\E", "");
+ return columnPath.replaceFirst("\\Q"+rootPath+"\\E", EMPTY_STRING); //$NON-NLS-1$ //$NON-NLS-2$
}else
{
return getXPathExpression( rootPath, columnPath );
@@ -170,8 +172,8 @@
*/
private static String getXPathExpression( String rootPath, String columnPath )
{
- String[] rootPathFrags = rootPath.replaceAll(UtilConstants.XPATH_ELEM_INDEX_PATTERN,"").split(UtilConstants.XPATH_SLASH);
- String[] columnPathFrags = columnPath.replaceAll(UtilConstants.XPATH_ELEM_INDEX_PATTERN,"").split(UtilConstants.XPATH_SLASH);
+ String[] rootPathFrags = rootPath.replaceAll(UtilConstants.XPATH_ELEM_INDEX_PATTERN, EMPTY_STRING).split(UtilConstants.XPATH_SLASH);
+ String[] columnPathFrags = columnPath.replaceAll(UtilConstants.XPATH_ELEM_INDEX_PATTERN, EMPTY_STRING).split(UtilConstants.XPATH_SLASH);
//The length of rootPathFrags and columnPathFrags should larger than 2,
//for the simplest path would be /elementName, which, if being splitted by "/",
@@ -285,12 +287,12 @@
*/
private static String populateXpathExpression( String columnPath, String[] rootPathFrags, int startingIndex, int endingIndex )
{
- String result = "";
+ String result = EMPTY_STRING;
int fetchBackLevel = rootPathFrags.length - 3 - (endingIndex - startingIndex);
for( int i = 0; i < fetchBackLevel; i ++)
{
- result += "../";
+ result += "../"; //$NON-NLS-1$
}
return addXPathFragsToAString( columnPath.replaceAll(XPATH_ATTR_HEADER_WITH_SQUARE_PATTERN,XPATH_ATTR_HEADER_WITH_SLASH).split(UtilConstants.XPATH_SLASH), endingIndex+1, result);