summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxwu2013-02-06 05:11:42 (EST)
committermwu2013-02-06 05:11:42 (EST)
commitb9c5061381d0e989df8ea269c35df28bb9e7591e (patch)
treedca5f42fd64f49041dd781c326d6ff5766fb88bc
parent6c295438f5f5cd4698ccf4b81c279846aac6a4eb (diff)
downloadorg.eclipse.datatools.enablement.oda-b9c5061381d0e989df8ea269c35df28bb9e7591e.zip
org.eclipse.datatools.enablement.oda-b9c5061381d0e989df8ea269c35df28bb9e7591e.tar.gz
org.eclipse.datatools.enablement.oda-b9c5061381d0e989df8ea269c35df28bb9e7591e.tar.bz2
CheckIn: Fix an issue - Information for 'Test Connection' shouldn't bev201302061811
displayed every time when edit flat file datasource[55568].
-rw-r--r--plugins/org.eclipse.datatools.connectivity.oda.flatfile.ui/src/org/eclipse/datatools/connectivity/oda/flatfile/ui/i18n/messages.properties4
-rw-r--r--plugins/org.eclipse.datatools.connectivity.oda.flatfile.ui/src/org/eclipse/datatools/connectivity/oda/flatfile/ui/wizards/FolderPropertyPage.java2
-rw-r--r--plugins/org.eclipse.datatools.connectivity.oda.flatfile.ui/src/org/eclipse/datatools/connectivity/oda/flatfile/ui/wizards/FolderSelectionPageHelper.java98
-rw-r--r--plugins/org.eclipse.datatools.connectivity.oda.flatfile.ui/src/org/eclipse/datatools/connectivity/oda/flatfile/ui/wizards/FolderSelectionWizardPage.java2
4 files changed, 63 insertions, 43 deletions
diff --git a/plugins/org.eclipse.datatools.connectivity.oda.flatfile.ui/src/org/eclipse/datatools/connectivity/oda/flatfile/ui/i18n/messages.properties b/plugins/org.eclipse.datatools.connectivity.oda.flatfile.ui/src/org/eclipse/datatools/connectivity/oda/flatfile/ui/i18n/messages.properties
index 666ca8a..2e9e212 100644
--- a/plugins/org.eclipse.datatools.connectivity.oda.flatfile.ui/src/org/eclipse/datatools/connectivity/oda/flatfile/ui/i18n/messages.properties
+++ b/plugins/org.eclipse.datatools.connectivity.oda.flatfile.ui/src/org/eclipse/datatools/connectivity/oda/flatfile/ui/i18n/messages.properties
@@ -73,6 +73,8 @@ error.emptyPath=Please enter a path.
error.unexpectedError=An unexpected error happened.
error.invalidConnectionFilePath=The specified connection profile source path, "{0}", does not exist.
error.invalidFlatFilePath=Invalid flat file data source path. Please correct the connection profile.
+error.emptyFolderPath=Please select a folder that contains the flat files.
+error.emptyFileURIPath=Please enter the URI or select a source flat file.
error.errorExist=Error exists in the current page. Would you like to save it anyway?
error.noCSVFiles=The folder, "{0}", does not have any specified files in it.
error.invalidFilePath=The file path is invalid. Would you like to continue?
@@ -96,7 +98,7 @@ warning.columnNotExist=The selected column "{0}" does not exist!
fileURIChanged.warning.reselectColumnsTitle=File URI in the data source is changed.
fileURIChanged.warning.reselectColumnsMessage=File URI in the data source is changed!\nPlease select columns again.
-Connection.warning.untested=Connection has not been tested. Please test connection before saving this data source profile.
+Connection.warning.untested=Please test connection before saving this data source profile.
Connection.error.invalidPath=No valid flat file locations found.
Connection.error.invalidHomeFolder=Invalid flat file home folder <{0}>.
Connection.error.invalidFileURI=Invalid flat file URI path <{0}>.
diff --git a/plugins/org.eclipse.datatools.connectivity.oda.flatfile.ui/src/org/eclipse/datatools/connectivity/oda/flatfile/ui/wizards/FolderPropertyPage.java b/plugins/org.eclipse.datatools.connectivity.oda.flatfile.ui/src/org/eclipse/datatools/connectivity/oda/flatfile/ui/wizards/FolderPropertyPage.java
index b532241..ccbfcef 100644
--- a/plugins/org.eclipse.datatools.connectivity.oda.flatfile.ui/src/org/eclipse/datatools/connectivity/oda/flatfile/ui/wizards/FolderPropertyPage.java
+++ b/plugins/org.eclipse.datatools.connectivity.oda.flatfile.ui/src/org/eclipse/datatools/connectivity/oda/flatfile/ui/wizards/FolderPropertyPage.java
@@ -99,7 +99,7 @@ public class FolderPropertyPage extends DataSourceEditorPage
pageHelper.refreshTypeLineCheckBoxStatus( );
if ( pageHelper != null && isSessionEditable( ) )
- pageHelper.restUIStatus( );
+ pageHelper.resetUIStatus( );
}
/*
diff --git a/plugins/org.eclipse.datatools.connectivity.oda.flatfile.ui/src/org/eclipse/datatools/connectivity/oda/flatfile/ui/wizards/FolderSelectionPageHelper.java b/plugins/org.eclipse.datatools.connectivity.oda.flatfile.ui/src/org/eclipse/datatools/connectivity/oda/flatfile/ui/wizards/FolderSelectionPageHelper.java
index d3a14bf..57f41b9 100644
--- a/plugins/org.eclipse.datatools.connectivity.oda.flatfile.ui/src/org/eclipse/datatools/connectivity/oda/flatfile/ui/wizards/FolderSelectionPageHelper.java
+++ b/plugins/org.eclipse.datatools.connectivity.oda.flatfile.ui/src/org/eclipse/datatools/connectivity/oda/flatfile/ui/wizards/FolderSelectionPageHelper.java
@@ -96,6 +96,9 @@ public class FolderSelectionPageHelper
private static final Integer SELECT_RELATIVE_PATH = 1;
private static final Integer SELECT_ABSOLUTE_PATH = 2;
+
+ private boolean needsCheckURITest = true;
+ private String URIValue = EMPTY_STRING;
FolderSelectionPageHelper( WizardPage page )
{
@@ -423,16 +426,12 @@ public class FolderSelectionPageHelper
public void widgetSelected( SelectionEvent e )
{
switchFileSelectionMode( true );
- verifyFileLocation( );
- if ( !( getFolderLocationString( ).trim( ).length( ) > 0 ) )
- {
- setMessage( DEFAULT_MESSAGE, IMessageProvider.NONE );
- }
+ validatePageStatus( );
}
public void widgetDefaultSelected( SelectionEvent e )
{
- switchFileSelectionMode( true );
+
}
} );
@@ -446,11 +445,7 @@ public class FolderSelectionPageHelper
public void modifyText( ModifyEvent e )
{
- verifyFileLocation( );
- if ( !( getFolderLocationString( ).trim( ).length( ) > 0 ) )
- {
- setMessage( DEFAULT_MESSAGE, IMessageProvider.NONE );
- }
+ validatePageStatus( );
}
} );
@@ -492,16 +487,14 @@ public class FolderSelectionPageHelper
public void widgetSelected( SelectionEvent e )
{
switchFileSelectionMode( false );
- verifyFileURILocation( );
- if ( !( getFileURIString( ).trim( ).length( ) > 0 ) )
- {
- setMessage( DEFAULT_MESSAGE, IMessageProvider.NONE );
- }
+ needsCheckURITest = true;
+ validatePageStatus( );
+ needsCheckURITest = false;
}
public void widgetDefaultSelected( SelectionEvent e )
{
- switchFileSelectionMode( false );
+
}
} );
@@ -516,10 +509,12 @@ public class FolderSelectionPageHelper
public void modifyText( ModifyEvent e )
{
- verifyFileURILocation( );
- if ( !( getFileURIString( ).trim( ).length( ) > 0 ) )
+ if ( !fileURI.getText( ).trim( ).equals( URIValue ) )
{
- setMessage( DEFAULT_MESSAGE, IMessageProvider.NONE );
+ needsCheckURITest = true;
+ validatePageStatus( );
+ needsCheckURITest = false;
+ URIValue = fileURI.getText( ).trim( );
}
}
@@ -639,23 +634,6 @@ public class FolderSelectionPageHelper
}
-
- private void verifyFileURILocation( )
- {
- String fileURIValue = getFileURIString( ).trim( );
- fileURIValue = fileURIValue.length( ) > 0 ? fileURIValue : null;
- if ( fileURIValue == null )
- {
- setMessage( Messages.getString( "error.invalidFlatFilePath" ), IMessageProvider.ERROR ); //$NON-NLS-1$?
- setPageComplete( false );
- }
- else
- {
- setPageComplete( true );
- setMessage( Messages.getString( "Connection.warning.untested" ), IMessageProvider.WARNING ); //$NON-NLS-1$
- }
- }
-
/**
*
* @return
@@ -904,7 +882,7 @@ public class FolderSelectionPageHelper
}
}
- public void restUIStatus( )
+ public void resetUIStatus( )
{
if ( getFileURI( ).length( ) > 0 )
{
@@ -913,9 +891,9 @@ public class FolderSelectionPageHelper
else
{
switchFileSelectionMode( true );
- }
+ }
}
-
+
protected void refreshTypeLineCheckBoxStatus( )
{
if ( columnNameLineCheckBox.getSelection( ) )
@@ -926,4 +904,44 @@ public class FolderSelectionPageHelper
typeLineCheckBox.setEnabled( false );
}
}
+
+ private void validatePageStatus( )
+ {
+ int status = 1;
+ if ( homeFolderChoice.getSelection( ) )
+ {
+ if ( getFolderLocationString( ).trim( ).length( ) == 0 )
+ {
+ setMessage( Messages.getString( "error.emptyFolderPath" ), //$NON-NLS-1$?
+ IMessageProvider.ERROR );
+ status = -1;
+ }
+ else if ( verifyFileLocation( ) == ERROR_INVALID_PATH )
+ {
+ setMessage( Messages.getString( "error.invalidFlatFilePath" ), IMessageProvider.ERROR ); //$NON-NLS-1$?
+ status = -1;
+ }
+ }
+ else if ( fileURIChoice.getSelection( ) )
+ {
+ if ( getFileURIString( ).trim( ).length( ) == 0 )
+ {
+ setMessage( Messages.getString( "error.emptyFileURIPath" ), IMessageProvider.ERROR );
+ status = -1;
+ }
+ else if ( needsCheckURITest )
+ {
+ setMessage( Messages.getString( "Connection.warning.untested" ), IMessageProvider.WARNING ); //$NON-NLS-1$
+ status = 0;
+ }
+ }
+
+ if ( status == 1 )
+ {
+ setMessage( DEFAULT_MESSAGE, IMessageProvider.NONE );
+ }
+
+ setPageComplete( status >= 0 );
+ }
+
}
diff --git a/plugins/org.eclipse.datatools.connectivity.oda.flatfile.ui/src/org/eclipse/datatools/connectivity/oda/flatfile/ui/wizards/FolderSelectionWizardPage.java b/plugins/org.eclipse.datatools.connectivity.oda.flatfile.ui/src/org/eclipse/datatools/connectivity/oda/flatfile/ui/wizards/FolderSelectionWizardPage.java
index cb78db7..ce16240 100644
--- a/plugins/org.eclipse.datatools.connectivity.oda.flatfile.ui/src/org/eclipse/datatools/connectivity/oda/flatfile/ui/wizards/FolderSelectionWizardPage.java
+++ b/plugins/org.eclipse.datatools.connectivity.oda.flatfile.ui/src/org/eclipse/datatools/connectivity/oda/flatfile/ui/wizards/FolderSelectionWizardPage.java
@@ -71,7 +71,7 @@ public class FolderSelectionWizardPage extends DataSourceWizardPage
enableAllControls( getControl(), isSessionEditable() );
if ( pageHelper != null && isSessionEditable() )
- pageHelper.restUIStatus( );
+ pageHelper.resetUIStatus( );
}
/* (non-Javadoc)