1 20 21 package org.apache.directory.ldapstudio.browser.common.wizards; 22 23 24 import org.apache.directory.ldapstudio.browser.common.BrowserCommonActivator; 25 import org.apache.directory.ldapstudio.browser.common.BrowserCommonConstants; 26 import org.apache.directory.ldapstudio.browser.common.widgets.connection.ConnectionPageModifyListener; 27 import org.apache.directory.ldapstudio.browser.core.model.IConnection; 28 import org.eclipse.jface.wizard.WizardPage; 29 import org.eclipse.swt.SWT; 30 import org.eclipse.swt.layout.GridLayout; 31 import org.eclipse.swt.widgets.Composite; 32 33 34 41 public class NewConnectionAuthWizardPage extends WizardPage implements ConnectionPageModifyListener 42 { 43 44 45 private NewConnectionWizard wizard; 46 47 48 54 public NewConnectionAuthWizardPage( String pageName, NewConnectionWizard wizard ) 55 { 56 super( pageName ); 57 setTitle( "Authentification" ); 58 setDescription( "Please select an authentification method and input authentification data." ); 59 setImageDescriptor( BrowserCommonActivator.getDefault().getImageDescriptor( BrowserCommonConstants.IMG_CONNECTION_WIZARD ) ); 60 setPageComplete( false ); 61 62 this.wizard = wizard; 63 wizard.getCpw().addConnectionPageModifyListener( this ); 64 } 65 66 67 70 public void connectionPageModified() 71 { 72 if ( isCurrentPage() ) 73 { 74 validate(); 75 } 76 } 77 78 79 82 public void setMessage( String message ) 83 { 84 if ( isCurrentPage() ) 85 { 86 super.setMessage( message ); 87 validate(); 88 } 89 } 90 91 92 95 public void setErrorMessage( String errorMessage ) 96 { 97 if ( isCurrentPage() ) 98 { 99 super.setErrorMessage( errorMessage ); 100 validate(); 101 } 102 } 103 104 105 108 public IConnection getRealConnection() 109 { 110 return null; 111 } 112 113 114 117 private void validate() 118 { 119 setPageComplete( getMessage() == null ); 120 getContainer().updateButtons(); 121 } 122 123 124 127 public void createControl( Composite parent ) 128 { 129 Composite composite = new Composite( parent, SWT.NONE ); 130 GridLayout gl = new GridLayout( 1, false ); 131 composite.setLayout( gl ); 132 133 wizard.getCpw().addAuthenticationMethodInput( IConnection.AUTH_SIMPLE, composite ); 134 wizard.getCpw().addSimpleAuthInput( true, "", "", composite ); 135 136 setControl( composite ); 137 } 138 139 } | Popular Tags |