// Checking if we are already in the LDAP perspective
if ( ( ldapPerspective != null ) && ( ldapPerspective.equals( currentPerspective ) ) )
{
// As we're already in the LDAP perspective, we only indicate to the user
// the name of the connection that has been created
MessageDialog dialog = new MessageDialog(
window.getShell(),
Messages.getString( "CreateConnectionActionHelper.ConnectionCreated" ), null, //$NON-NLS-1$
NLS
.bind(
Messages.getString( "CreateConnectionActionHelper.ConnectionCalledCreated" ), new String[] { connection.getName() } ), MessageDialog.INFORMATION, //$NON-NLS-1$
new String[]
{ IDialogConstants.OK_LABEL }, MessageDialog.OK );
dialog.open();
}
else
{
// We're not already in the LDAP perspective, we indicate to the user
// the name of the connection that has been created and we ask him
// if we wants to switch to the LDAP perspective
MessageDialog dialog = new MessageDialog(
window.getShell(),
Messages.getString( "CreateConnectionActionHelper.ConnectionCreated" ), null, //$NON-NLS-1$
NLS
.bind(
Messages.getString( "CreateConnectionActionHelper.ConnectionCalledCreatedSwitch" ), new String[] { connection.getName() } ), //$NON-NLS-1$
MessageDialog.INFORMATION, new String[]
{ IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, MessageDialog.OK );
if ( dialog.open() == MessageDialog.OK )
{
// Switching to the LDAP perspective
window.getActivePage().setPerspective( ldapPerspective );
}
}