1 20 21 package org.apache.directory.ldapstudio.browser.ui.wizards; 22 23 24 import org.apache.directory.ldapstudio.browser.common.widgets.BaseWidgetUtils; 25 import org.eclipse.jface.wizard.WizardPage; 26 import org.eclipse.swt.SWT; 27 import org.eclipse.swt.events.SelectionAdapter; 28 import org.eclipse.swt.events.SelectionEvent; 29 import org.eclipse.swt.layout.GridData; 30 import org.eclipse.swt.layout.GridLayout; 31 import org.eclipse.swt.widgets.Button; 32 import org.eclipse.swt.widgets.Composite; 33 34 35 public class BatchOperationFinishWizardPage extends WizardPage 36 { 37 38 public final static int EXECUTION_METHOD_NONE = -1; 39 40 public final static int EXECUTION_METHOD_LDIF = 0; 41 42 public final static int EXECUTION_METHOD_ONLINE = 1; 43 44 private Button executeOnlineButton; 45 46 private Button generateLdifButton; 47 48 49 public BatchOperationFinishWizardPage( String pageName, BatchOperationWizard wizard ) 50 { 51 super( pageName ); 52 super.setTitle( "Select Execution Method" ); 53 super 54 .setDescription( "Please select if the batch operation should be executed online or a LDIF should be generated." ); 55 super.setPageComplete( false ); 56 } 57 58 59 private void validate() 60 { 61 setPageComplete( getExecutionMethod() != EXECUTION_METHOD_NONE ); 62 } 63 64 65 public void createControl( Composite parent ) 66 { 67 68 Composite composite = new Composite( parent, SWT.NONE ); 69 GridLayout gl = new GridLayout( 1, false ); 70 composite.setLayout( gl ); 71 composite.setLayoutData( new GridData( GridData.FILL_BOTH ) ); 72 73 generateLdifButton = BaseWidgetUtils.createRadiobutton( composite, "Generate LDIF", 1 ); 74 generateLdifButton.setSelection( true ); 75 generateLdifButton.addSelectionListener( new SelectionAdapter() 76 { 77 public void widgetSelected( SelectionEvent e ) 78 { 79 validate(); 80 } 81 } ); 82 83 executeOnlineButton = BaseWidgetUtils.createRadiobutton( composite, "Excecute online", 1 ); 84 executeOnlineButton.setEnabled( false ); 85 executeOnlineButton.addSelectionListener( new SelectionAdapter() 86 { 87 public void widgetSelected( SelectionEvent e ) 88 { 89 validate(); 90 } 91 } ); 92 93 validate(); 94 95 setControl( composite ); 96 } 97 98 99 public int getExecutionMethod() 100 { 101 if ( executeOnlineButton.getSelection() ) 102 { 103 return EXECUTION_METHOD_ONLINE; 104 } 105 else if ( generateLdifButton.getSelection() ) 106 { 107 return EXECUTION_METHOD_LDIF; 108 } 109 else 110 { 111 return EXECUTION_METHOD_NONE; 112 } 113 } 114 115 } 116 | Popular Tags |