[221779] Improved error handling of an obsolete ODA Database Connection Profile Reference
diff --git a/plugins/org.eclipse.datatools.connectivity.oda.design.ui/src/org/eclipse/datatools/connectivity/oda/design/internal/ui/AdaptableDataSourceProfile.java b/plugins/org.eclipse.datatools.connectivity.oda.design.ui/src/org/eclipse/datatools/connectivity/oda/design/internal/ui/AdaptableDataSourceProfile.java
index 5c9f775..0c56aaf 100644
--- a/plugins/org.eclipse.datatools.connectivity.oda.design.ui/src/org/eclipse/datatools/connectivity/oda/design/internal/ui/AdaptableDataSourceProfile.java
+++ b/plugins/org.eclipse.datatools.connectivity.oda.design.ui/src/org/eclipse/datatools/connectivity/oda/design/internal/ui/AdaptableDataSourceProfile.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
@@ -28,6 +28,7 @@
import org.eclipse.datatools.connectivity.oda.design.ui.designsession.DesignSessionUtil;
import org.eclipse.datatools.connectivity.oda.design.util.DesignUtil;
import org.eclipse.datatools.connectivity.oda.profile.internal.OdaConnectionProfile;
+import org.eclipse.datatools.connectivity.oda.profile.internal.ProfileCategoryUtil;
/**
* Implementation of connection profile for an ODA data source design.
@@ -88,7 +89,7 @@
*/
public boolean hasLinkedProfile()
{
- return ( getWrappedProfile() != null );
+ return hasWrappedProfile();
}
/**
@@ -322,9 +323,8 @@
if( hasLinkedProfile() )
return super.getCategory();
- // TODO - get IConfigurationElement for oda extension's
- // connection profile category
- return null;
+ // get oda extension's connection profile category
+ return ProfileCategoryUtil.getCategory( getProviderId() );
}
}
diff --git a/plugins/org.eclipse.datatools.connectivity.oda.design.ui/src/org/eclipse/datatools/connectivity/oda/design/internal/ui/profile/ProfileSelectionEditorPage.java b/plugins/org.eclipse.datatools.connectivity.oda.design.ui/src/org/eclipse/datatools/connectivity/oda/design/internal/ui/profile/ProfileSelectionEditorPage.java
index 098537f..abf4871 100644
--- a/plugins/org.eclipse.datatools.connectivity.oda.design.ui/src/org/eclipse/datatools/connectivity/oda/design/internal/ui/profile/ProfileSelectionEditorPage.java
+++ b/plugins/org.eclipse.datatools.connectivity.oda.design.ui/src/org/eclipse/datatools/connectivity/oda/design/internal/ui/profile/ProfileSelectionEditorPage.java
@@ -134,6 +134,8 @@
*/
protected DataSourceDesign collectDataSourceDesign( DataSourceDesign design )
{
+ ProfileReferenceBase profileRef = collectEditedProfileRef();
+
// no delegation is specified, perform default update task
if( m_updateDesignTask == null )
{
@@ -143,7 +145,6 @@
{
try
{
- ProfileReferenceBase profileRef = collectEditedProfileRef();
if( profileRef != null )
design = m_updateDesignTask.collectDataSourceDesign( design, this,
profileRef.getProfileInstance() );
@@ -159,8 +160,6 @@
// adds attributes of linked profile, if specified, to the data source design;
// ignores any data source design name change
- ProfileReferenceBase profileRef = collectEditedProfileRef();
-
if( profileRef != null && profileRef.maintainExternalLink() )
{
design.setLinkedProfileName( profileRef.getName() );
diff --git a/plugins/org.eclipse.datatools.connectivity.oda.design.ui/src/org/eclipse/datatools/connectivity/oda/design/internal/ui/profile/db/DbProfileUtil.java b/plugins/org.eclipse.datatools.connectivity.oda.design.ui/src/org/eclipse/datatools/connectivity/oda/design/internal/ui/profile/db/DbProfileUtil.java
index 4c59603..cc49f1a 100644
--- a/plugins/org.eclipse.datatools.connectivity.oda.design.ui/src/org/eclipse/datatools/connectivity/oda/design/internal/ui/profile/db/DbProfileUtil.java
+++ b/plugins/org.eclipse.datatools.connectivity.oda.design.ui/src/org/eclipse/datatools/connectivity/oda/design/internal/ui/profile/db/DbProfileUtil.java
@@ -66,7 +66,10 @@
static ProfilePropertyPage createDbPropertyPage(
OdaConnectionProfile odaDbProfile,
String odaWrapperExtensionId )
- {
+ {
+ if( ! odaDbProfile.hasWrappedProfile() )
+ return null; // cannot create page if no wrapped db profile
+
updateProfileDbProviderInfo( odaDbProfile, odaWrapperExtensionId );
// create the db profile's custom property page contribution
diff --git a/plugins/org.eclipse.datatools.connectivity.oda.profile/src/org/eclipse/datatools/connectivity/oda/profile/internal/OdaConnectionProfile.java b/plugins/org.eclipse.datatools.connectivity.oda.profile/src/org/eclipse/datatools/connectivity/oda/profile/internal/OdaConnectionProfile.java
index 0339b7d..0de8757 100644
--- a/plugins/org.eclipse.datatools.connectivity.oda.profile/src/org/eclipse/datatools/connectivity/oda/profile/internal/OdaConnectionProfile.java
+++ b/plugins/org.eclipse.datatools.connectivity.oda.profile/src/org/eclipse/datatools/connectivity/oda/profile/internal/OdaConnectionProfile.java
@@ -76,15 +76,24 @@
}
/**
+ * Indicates whether this contains a wrapped connection profile instance.
+ * @return true if a wrapped profile instance exists; false otherwise.
+ */
+ public boolean hasWrappedProfile()
+ {
+ return ( m_wrappedProfile != null );
+ }
+
+ /**
* Compares this to the specified connection profile instance.
* @param aProfile the connection profile instance to compare this against
* @return true if the specified instance is equal to this; false otherwise.
*/
public boolean equals( IConnectionProfile aProfile )
{
- if( aProfile == null )
+ if( aProfile == null || ! hasWrappedProfile() )
return false;
- return m_wrappedProfile.getInstanceID().equals( aProfile.getInstanceID() );
+ return getWrappedProfile().getInstanceID().equals( aProfile.getInstanceID() );
}
/**
@@ -96,7 +105,8 @@
public void setOdaWrapperExtensionId( String odaWrapperExtensionId )
{
// oda extension is not a direct provider of the wrapped profile
- if( ! m_wrappedProfile.getProviderId().equals( odaWrapperExtensionId ) )
+ if( hasWrappedProfile() &&
+ ! getWrappedProfile().getProviderId().equals( odaWrapperExtensionId ) )
m_odaWrapperExtensionId = odaWrapperExtensionId;
else
m_odaWrapperExtensionId = null; // no separate ODA wrapper profile provider
@@ -144,7 +154,7 @@
{
if( m_directProviderId != null )
return m_directProviderId;
- return m_wrappedProfile.getProviderId();
+ return hasWrappedProfile() ? getWrappedProfile().getProviderId() : null;
}
/* (non-Javadoc)
@@ -168,7 +178,9 @@
*/
public boolean arePropertiesComplete()
{
- return m_wrappedProfile.arePropertiesComplete();
+ if( hasWrappedProfile() )
+ return getWrappedProfile().arePropertiesComplete();
+ return false;
}
/* (non-Javadoc)
@@ -176,7 +188,9 @@
*/
public boolean arePropertiesComplete( String type )
{
- return m_wrappedProfile.arePropertiesComplete( type );
+ if( hasWrappedProfile() )
+ return getWrappedProfile().arePropertiesComplete( type );
+ return false;
}
/* (non-Javadoc)
@@ -184,8 +198,8 @@
*/
public boolean canWorkOffline()
{
- if( m_wrappedProfile != null )
- return m_wrappedProfile.canWorkOffline();
+ if( hasWrappedProfile() )
+ return getWrappedProfile().canWorkOffline();
return false;
}
@@ -307,8 +321,8 @@
*/
public int getConnectionState()
{
- if( m_wrappedProfile != null )
- return m_wrappedProfile.getConnectionState();
+ if( hasWrappedProfile() )
+ return getWrappedProfile().getConnectionState();
return DISCONNECTED_STATE;
}
@@ -389,7 +403,9 @@
*/
public boolean isAutoConnect()
{
- return m_wrappedProfile.isAutoConnect();
+ if( hasWrappedProfile() )
+ return getWrappedProfile().isAutoConnect();
+ return false;
}
/* (non-Javadoc)
@@ -397,8 +413,8 @@
*/
public boolean isConnected()
{
- if( m_wrappedProfile != null )
- return m_wrappedProfile.getConnectionState() == IConnectionProfile.CONNECTED_STATE;
+ if( hasWrappedProfile() )
+ return getWrappedProfile().getConnectionState() == IConnectionProfile.CONNECTED_STATE;
return false;
}
@@ -431,8 +447,8 @@
*/
public void setConnected( boolean connected )
{
- if( m_wrappedProfile != null )
- m_wrappedProfile.setConnected( connected );
+ if( hasWrappedProfile() )
+ getWrappedProfile().setConnected( connected );
}
/* (non-Javadoc)
@@ -448,8 +464,8 @@
*/
public boolean supportsWorkOfflineMode()
{
- if( m_wrappedProfile != null )
- return m_wrappedProfile.supportsWorkOfflineMode();
+ if( hasWrappedProfile() )
+ return getWrappedProfile().supportsWorkOfflineMode();
return false;
}