Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 27048 invoked from network); 4 Mar 2007 20:15:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Mar 2007 20:15:34 -0000 Received: (qmail 3114 invoked by uid 500); 4 Mar 2007 20:15:43 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 3058 invoked by uid 500); 4 Mar 2007 20:15:42 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 3047 invoked by uid 99); 4 Mar 2007 20:15:42 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 04 Mar 2007 12:15:42 -0800 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 04 Mar 2007 12:15:32 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id 1E99F1A9820; Sun, 4 Mar 2007 12:15:12 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r514464 [2/2] - in /directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui: widgets/ldifeditor/ widgets/search/ wizards/ Date: Sun, 04 Mar 2007 20:15:09 -0000 To: commits@directory.apache.org From: seelmann@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070304201512.1E99F1A9820@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/AttributeOptionsWizardPage.java URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/AttributeOptionsWizardPage.java?view=diff&rev=514464&r1=514463&r2=514464 ============================================================================== --- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/AttributeOptionsWizardPage.java (original) +++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/AttributeOptionsWizardPage.java Sun Mar 4 12:15:08 2007 @@ -38,8 +38,6 @@ import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.Point; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; @@ -51,40 +49,63 @@ import org.eclipse.swt.widgets.Text; +/** + * The AttributeOptionsWizardPageprovides input elements for various options + * and a preview field. + * + * @author Apache Directory Project + * @version $Rev$, $Date$ + */ public class AttributeOptionsWizardPage extends WizardPage { + /** The wizard. */ private AttributeWizard wizard; - private String initialAttributeDescription; + /** The shell */ + private Shell shell; + /** The possible languages. */ private String[] possibleLanguages; - private Map possibleLangToCountriesMap; + /** The possible language to countries map. */ + private Map possibleLangToCountriesMap; - private List parsedLangList; + /** The parsed lang list. */ + private List parsedLangList; - private List parsedOptionList; + /** The parsed option list. */ + private List parsedOptionList; + /** The parsed binary option. */ private boolean parsedBinary; + /** The language group. */ private Group langGroup; - private ArrayList langLineList; + /** The lang line list. */ + private ArrayList langLineList; + /** The options group. */ private Group optionsGroup; - private ArrayList optionLineList; + /** The option line list. */ + private ArrayList optionLineList; + /** The binary option button. */ private Button binaryOptionButton; + /** The preview text. */ private Text previewText; - private int langGroupHeight = -1; - - private int optionGroupHeight = -1; - + /** + * Creates a new instance of AttributeOptionsWizardPage. + * + * @param pageName the page name + * @param initialAttributeDescription the initial attribute description + * @param wizard the wizard + */ public AttributeOptionsWizardPage( String pageName, String initialAttributeDescription, AttributeWizard wizard ) { super( pageName ); @@ -94,10 +115,10 @@ super.setPageComplete( false ); this.wizard = wizard; - this.initialAttributeDescription = initialAttributeDescription; - SortedSet languageSet = new TreeSet(); - Map languageToCountrySetMap = new HashMap(); + // init possible languages and countries + SortedSet languageSet = new TreeSet(); + Map> languageToCountrySetMap = new HashMap>(); Locale[] locales = Locale.getAvailableLocales(); for ( int i = 0; i < locales.length; i++ ) { @@ -105,65 +126,77 @@ languageSet.add( locale.getLanguage() ); if ( !languageToCountrySetMap.containsKey( locale.getLanguage() ) ) { - languageToCountrySetMap.put( locale.getLanguage(), new TreeSet() ); + languageToCountrySetMap.put( locale.getLanguage(), new TreeSet() ); } - SortedSet countrySet = ( SortedSet ) languageToCountrySetMap.get( locale.getLanguage() ); + SortedSet countrySet = languageToCountrySetMap.get( locale.getLanguage() ); countrySet.add( locale.getCountry() ); } - this.possibleLanguages = ( String[] ) languageSet.toArray( new String[languageSet.size()] ); - this.possibleLangToCountriesMap = new HashMap(); - for ( Iterator it = languageToCountrySetMap.keySet().iterator(); it.hasNext(); ) - { - String language = ( String ) it.next(); - SortedSet countrySet = ( SortedSet ) languageToCountrySetMap.get( language ); - String[] countries = ( String[] ) countrySet.toArray( new String[countrySet.size()] ); - this.possibleLangToCountriesMap.put( language, countries ); - } - - String attributeDescription = this.initialAttributeDescription; - if ( attributeDescription == null ) - attributeDescription = ""; - String[] attributeDescriptionComponents = attributeDescription.split( ";" ); - this.parsedLangList = new ArrayList(); - this.parsedOptionList = new ArrayList(); - this.parsedBinary = false; + possibleLanguages = languageSet.toArray( new String[languageSet.size()] ); + possibleLangToCountriesMap = new HashMap(); + for ( Iterator it = languageToCountrySetMap.keySet().iterator(); it.hasNext(); ) + { + String language = it.next(); + SortedSet countrySet = languageToCountrySetMap.get( language ); + String[] countries = countrySet.toArray( new String[countrySet.size()] ); + possibleLangToCountriesMap.put( language, countries ); + } + + // parse options + if ( initialAttributeDescription == null ) + { + initialAttributeDescription = ""; + } + String[] attributeDescriptionComponents = initialAttributeDescription.split( ";" ); + parsedLangList = new ArrayList(); + parsedOptionList = new ArrayList(); + parsedBinary = false; for ( int i = 1; i < attributeDescriptionComponents.length; i++ ) { if ( attributeDescriptionComponents[i].startsWith( "lang-" ) ) { - this.parsedLangList.add( attributeDescriptionComponents[i] ); + parsedLangList.add( attributeDescriptionComponents[i] ); } else if ( attributeDescriptionComponents[i].equals( "binary" ) ) { - this.parsedBinary = true; + parsedBinary = true; } else { - this.parsedOptionList.add( attributeDescriptionComponents[i] ); + parsedOptionList.add( attributeDescriptionComponents[i] ); } } } + /** + * Validates the options. + */ private void validate() { - this.previewText.setText( wizard.getAttributeDescription() ); + previewText.setText( wizard.getAttributeDescription() ); setPageComplete( true ); } + /** + * {@inheritDoc} + */ public void setVisible( boolean visible ) { super.setVisible( visible ); if ( visible ) { - this.validate(); + validate(); } } + /** + * {@inheritDoc} + */ public void createControl( Composite parent ) { + shell = parent.getShell(); Composite composite = new Composite( parent, SWT.NONE ); GridLayout gl = new GridLayout( 2, false ); @@ -171,25 +204,25 @@ composite.setLayoutData( new GridData( GridData.FILL_BOTH ) ); // Lang group - this.langGroup = BaseWidgetUtils.createGroup( composite, "Language tags", 2 ); + langGroup = BaseWidgetUtils.createGroup( composite, "Language tags", 2 ); GridData gd = new GridData( GridData.FILL_HORIZONTAL ); gd.horizontalSpan = 2; langGroup.setLayoutData( gd ); - Composite langComposite = BaseWidgetUtils.createColumnContainer( this.langGroup, 6, 1 ); - this.langLineList = new ArrayList(); + Composite langComposite = BaseWidgetUtils.createColumnContainer( langGroup, 6, 1 ); + langLineList = new ArrayList(); BaseWidgetUtils.createSpacer( composite, 2 ); // Options group with binary option - this.optionsGroup = BaseWidgetUtils.createGroup( composite, "Other options", 2 ); + optionsGroup = BaseWidgetUtils.createGroup( composite, "Other options", 2 ); gd = new GridData( GridData.FILL_HORIZONTAL ); gd.horizontalSpan = 2; optionsGroup.setLayoutData( gd ); - Composite optionsComposite = BaseWidgetUtils.createColumnContainer( this.optionsGroup, 3, 1 ); - this.optionLineList = new ArrayList(); - Composite binaryComposite = BaseWidgetUtils.createColumnContainer( this.optionsGroup, 1, 1 ); - this.binaryOptionButton = BaseWidgetUtils.createCheckbox( binaryComposite, "binary option", 1 ); - this.binaryOptionButton.setSelection( parsedBinary ); + Composite optionsComposite = BaseWidgetUtils.createColumnContainer( optionsGroup, 3, 1 ); + optionLineList = new ArrayList(); + Composite binaryComposite = BaseWidgetUtils.createColumnContainer( optionsGroup, 1, 1 ); + binaryOptionButton = BaseWidgetUtils.createCheckbox( binaryComposite, "binary option", 1 ); + binaryOptionButton.setSelection( parsedBinary ); Label la = new Label( composite, SWT.NONE ); gd = new GridData( GridData.GRAB_VERTICAL ); @@ -197,8 +230,8 @@ la.setLayoutData( gd ); // Preview text - /* this.previewLabel = */BaseWidgetUtils.createLabel( composite, "Preview:", 1 ); - this.previewText = BaseWidgetUtils.createReadonlyText( composite, "", 1 ); + BaseWidgetUtils.createLabel( composite, "Preview:", 1 ); + previewText = BaseWidgetUtils.createReadonlyText( composite, "", 1 ); // fill lang if ( parsedLangList.isEmpty() ) @@ -210,15 +243,15 @@ for ( int i = 0; i < parsedLangList.size(); i++ ) { addLangLine( langComposite, i ); - String l = ( String ) parsedLangList.get( i ); + String l = parsedLangList.get( i ); String[] ls = l.split( "-", 3 ); if ( ls.length > 1 ) { - ( ( LangLine ) langLineList.get( i ) ).languageCombo.setText( ls[1] ); + langLineList.get( i ).languageCombo.setText( ls[1] ); } if ( ls.length > 2 ) { - ( ( LangLine ) langLineList.get( i ) ).countryCombo.setText( ls[2] ); + langLineList.get( i ).countryCombo.setText( ls[2] ); } } } @@ -233,12 +266,12 @@ for ( int i = 0; i < parsedOptionList.size(); i++ ) { addOptionLine( optionsComposite, i ); - ( ( OptionLine ) optionLineList.get( i ) ).optionText.setText( ( String ) parsedOptionList.get( i ) ); + optionLineList.get( i ).optionText.setText( parsedOptionList.get( i ) ); } } // binary listener - this.binaryOptionButton.addSelectionListener( new SelectionAdapter() + binaryOptionButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected( SelectionEvent e ) { @@ -252,45 +285,49 @@ } + /** + * Gets the attribute options. + * + * @return the attribute options + */ String getAttributeOptions() { - if ( this.binaryOptionButton == null || this.binaryOptionButton.isDisposed() ) + if ( binaryOptionButton == null || binaryOptionButton.isDisposed() ) { return ""; } // attribute type StringBuffer sb = new StringBuffer(); - // sb.append(wizard.getAttributeType()); // options // sort and unique options - Comparator comparator = new Comparator() + Comparator comparator = new Comparator() { - public int compare( Object o1, Object o2 ) + public int compare( String s1, String s2 ) { - if ( o1 == null || !( o1 instanceof String ) || o2 == null || !( o2 instanceof String ) ) + if ( s1 == null || s2 == null ) { - throw new ClassCastException( "Must be String" ); + throw new ClassCastException( "Must not be null" ); } - return ( ( String ) o1 ).compareToIgnoreCase( ( String ) o2 ); + return s1.compareToIgnoreCase( s2 ); } }; - SortedSet options = new TreeSet( comparator ); - if ( this.binaryOptionButton.getSelection() ) + SortedSet options = new TreeSet( comparator ); + if ( binaryOptionButton.getSelection() ) { options.add( "binary" ); } - for ( int i = 0; i < this.optionLineList.size(); i++ ) + for ( int i = 0; i < optionLineList.size(); i++ ) { - OptionLine optionLine = ( OptionLine ) this.optionLineList.get( i ); + OptionLine optionLine = optionLineList.get( i ); if ( !"".equals( optionLine.optionText.getText() ) ) { options.add( optionLine.optionText.getText() ); } - if ( this.optionLineList.size() > 1 ) + if ( optionLineList.size() > 1 ) { optionLine.optionDeleteButton.setEnabled( true ); } @@ -299,9 +336,9 @@ optionLine.optionDeleteButton.setEnabled( false ); } } - for ( int i = 0; i < this.langLineList.size(); i++ ) + for ( int i = 0; i < langLineList.size(); i++ ) { - LangLine langLine = ( LangLine ) this.langLineList.get( i ); + LangLine langLine = langLineList.get( i ); String l = langLine.languageCombo.getText(); String c = langLine.countryCombo.getText(); @@ -315,7 +352,7 @@ options.add( s ); } - if ( this.langLineList.size() > 1 ) + if ( langLineList.size() > 1 ) { langLine.deleteButton.setEnabled( true ); } @@ -326,9 +363,9 @@ } // append options - for ( Iterator it = options.iterator(); it.hasNext(); ) + for ( Iterator it = options.iterator(); it.hasNext(); ) { - String option = ( String ) it.next(); + String option = it.next(); sb.append( ';' ); sb.append( option ); } @@ -337,10 +374,15 @@ } + /** + * Adds an option line at the given index. + * + * @param optionComposite the option composite + * @param index the index + */ private void addOptionLine( Composite optionComposite, int index ) { - - OptionLine[] optionLines = ( OptionLine[] ) optionLineList.toArray( new OptionLine[optionLineList.size()] ); + OptionLine[] optionLines = optionLineList.toArray( new OptionLine[optionLineList.size()] ); if ( optionLines.length > 0 ) { @@ -377,9 +419,18 @@ OptionLine optionLine = createOptionLine( optionComposite ); optionLineList.add( optionLine ); } + + shell.layout( true, true ); } + /** + * Creates the option line. + * + * @param optionComposite the option composite + * + * @return the option line + */ private OptionLine createOptionLine( final Composite optionComposite ) { OptionLine optionLine = new OptionLine(); @@ -390,72 +441,46 @@ optionLine.optionAddButton = new Button( optionComposite, SWT.PUSH ); optionLine.optionAddButton.setText( " + " ); - optionLine.optionAddButton.addSelectionListener( new SelectionListener() + optionLine.optionAddButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected( SelectionEvent e ) { int index = optionLineList.size(); for ( int i = 0; i < optionLineList.size(); i++ ) { - OptionLine optionLine = ( OptionLine ) optionLineList.get( i ); + OptionLine optionLine = optionLineList.get( i ); if ( optionLine.optionAddButton == e.widget ) { index = i + 1; } } - addOptionLine( optionComposite, index ); - Shell shell = getShell(); - Point shellSize = shell.getSize(); - Point groupSize = optionComposite.computeSize( SWT.DEFAULT, SWT.DEFAULT, true ); - int newOptionGroupHeight = groupSize.y; - shell.setSize( shellSize.x, shellSize.y + newOptionGroupHeight - optionGroupHeight ); - optionComposite.layout( true, true ); - shell.layout( true, true ); - optionGroupHeight = newOptionGroupHeight; + addOptionLine( optionComposite, index ); validate(); } - - - public void widgetDefaultSelected( SelectionEvent e ) - { - } } ); optionLine.optionDeleteButton = new Button( optionComposite, SWT.PUSH ); optionLine.optionDeleteButton.setText( " \u2212 " ); // \u2013 - optionLine.optionDeleteButton.addSelectionListener( new SelectionListener() + optionLine.optionDeleteButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected( SelectionEvent e ) { int index = 0; for ( int i = 0; i < optionLineList.size(); i++ ) { - OptionLine optionLine = ( OptionLine ) optionLineList.get( i ); + OptionLine optionLine = optionLineList.get( i ); if ( optionLine.optionDeleteButton == e.widget ) { index = i; } } - deleteOptionLine( optionComposite, index ); - Shell shell = getShell(); - Point shellSize = shell.getSize(); - Point groupSize = optionComposite.computeSize( SWT.DEFAULT, SWT.DEFAULT, true ); - int newOptionGroupHeight = groupSize.y; - shell.setSize( shellSize.x, shellSize.y + newOptionGroupHeight - optionGroupHeight ); - optionComposite.layout( true, true ); - shell.layout( true, true ); - optionGroupHeight = newOptionGroupHeight; + deleteOptionLine( optionComposite, index ); validate(); } - - - public void widgetDefaultSelected( SelectionEvent e ) - { - } } ); optionLine.optionText.addModifyListener( new ModifyListener() @@ -470,31 +495,56 @@ } + /** + * Deletes the option line at the given index. + * + * @param optionComposite the option composite + * @param index the index + */ private void deleteOptionLine( Composite optionComposite, int index ) { - OptionLine optionLine = ( OptionLine ) optionLineList.remove( index ); + OptionLine optionLine = optionLineList.remove( index ); if ( optionLine != null ) { optionLine.optionText.dispose(); optionLine.optionAddButton.dispose(); optionLine.optionDeleteButton.dispose(); + + if ( !optionComposite.isDisposed() ) + { + shell.layout( true, true ); + } } } + /** + * The class OptionLine is a wrapper for all input elements of an option. + * + * @author Apache Directory Project + * @version $Rev$, $Date$ + */ public class OptionLine { + /** The option text. */ public Text optionText; + /** The option add button. */ public Button optionAddButton; + /** The option delete button. */ public Button optionDeleteButton; } + /** + * Adds a language line at the given index. + * + * @param langComposite the language composite + * @param index the index + */ private void addLangLine( Composite langComposite, int index ) { - - LangLine[] langLines = ( LangLine[] ) langLineList.toArray( new LangLine[langLineList.size()] ); + LangLine[] langLines = langLineList.toArray( new LangLine[langLineList.size()] ); if ( langLines.length > 0 ) { @@ -536,9 +586,18 @@ LangLine langLine = createLangLine( langComposite ); langLineList.add( langLine ); } + + shell.layout( true, true ); } + /** + * Creates a language line. + * + * @param langComposite the language composite + * + * @return the language line + */ private LangLine createLangLine( final Composite langComposite ) { final LangLine langLine = new LangLine(); @@ -554,72 +613,46 @@ langLine.addButton = new Button( langComposite, SWT.PUSH ); langLine.addButton.setText( " + " ); - langLine.addButton.addSelectionListener( new SelectionListener() + langLine.addButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected( SelectionEvent e ) { int index = langLineList.size(); for ( int i = 0; i < langLineList.size(); i++ ) { - LangLine langLine = ( LangLine ) langLineList.get( i ); + LangLine langLine = langLineList.get( i ); if ( langLine.addButton == e.widget ) { index = i + 1; } } - addLangLine( langComposite, index ); - Shell shell = getShell(); - Point shellSize = shell.getSize(); - Point groupSize = langComposite.computeSize( SWT.DEFAULT, SWT.DEFAULT, true ); - int newLangGroupHeight = groupSize.y; - shell.setSize( shellSize.x, shellSize.y + newLangGroupHeight - langGroupHeight ); - langComposite.layout( true, true ); - shell.layout( true, true ); - langGroupHeight = newLangGroupHeight; + addLangLine( langComposite, index ); validate(); } - - - public void widgetDefaultSelected( SelectionEvent e ) - { - } } ); langLine.deleteButton = new Button( langComposite, SWT.PUSH ); langLine.deleteButton.setText( " \u2212 " ); // \u2013 - langLine.deleteButton.addSelectionListener( new SelectionListener() + langLine.deleteButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected( SelectionEvent e ) { int index = 0; for ( int i = 0; i < langLineList.size(); i++ ) { - LangLine langLine = ( LangLine ) langLineList.get( i ); + LangLine langLine = langLineList.get( i ); if ( langLine.deleteButton == e.widget ) { index = i; } } - deleteLangLine( langComposite, index ); - Shell shell = getShell(); - Point shellSize = shell.getSize(); - Point groupSize = langComposite.computeSize( SWT.DEFAULT, SWT.DEFAULT, true ); - int newLangGroupHeight = groupSize.y; - shell.setSize( shellSize.x, shellSize.y + newLangGroupHeight - langGroupHeight ); - langComposite.layout( true, true ); - shell.layout( true, true ); - langGroupHeight = newLangGroupHeight; + deleteLangLine( langComposite, index ); validate(); } - - - public void widgetDefaultSelected( SelectionEvent e ) - { - } } ); langLine.languageCombo.addModifyListener( new ModifyListener() @@ -636,8 +669,8 @@ String oldValue = langLine.countryCombo.getText(); if ( possibleLangToCountriesMap.containsKey( langLine.languageCombo.getText() ) ) { - langLine.countryCombo.setItems( ( String[] ) possibleLangToCountriesMap - .get( langLine.languageCombo.getText() ) ); + langLine.countryCombo.setItems( possibleLangToCountriesMap.get( langLine.languageCombo + .getText() ) ); } else { @@ -660,9 +693,15 @@ } + /** + * Deletes the language line at the given index. + * + * @param langComposite the language composite + * @param index the index + */ private void deleteLangLine( Composite langComposite, int index ) { - LangLine langLine = ( LangLine ) langLineList.remove( index ); + LangLine langLine = langLineList.remove( index ); if ( langLine != null ) { langLine.langLabel.dispose(); @@ -671,21 +710,39 @@ langLine.countryCombo.dispose(); langLine.addButton.dispose(); langLine.deleteButton.dispose(); + + if ( !langComposite.isDisposed() ) + { + shell.layout( true, true ); + } } } + /** + * The class LangLine is a wrapper for all input elements of a language tag. + * + * @author Apache Directory Project + * @version $Rev$, $Date$ + */ public class LangLine { + + /** The lang label. */ public Label langLabel; + /** The language combo. */ public Combo languageCombo; + /** The minus label. */ public Label minusLabel; + /** The country combo. */ public Combo countryCombo; + /** The add button. */ public Button addButton; + /** The delete button. */ public Button deleteButton; } Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/AttributeTypeWizardPage.java URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/AttributeTypeWizardPage.java?view=diff&rev=514464&r1=514463&r2=514464 ============================================================================== --- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/AttributeTypeWizardPage.java (original) +++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/AttributeTypeWizardPage.java Sun Mar 4 12:15:08 2007 @@ -28,7 +28,13 @@ import org.apache.directory.ldapstudio.browser.core.model.IAttribute; import org.apache.directory.ldapstudio.browser.core.model.IEntry; import org.apache.directory.ldapstudio.browser.ui.widgets.BaseWidgetUtils; - +import org.apache.directory.ldapstudio.browser.ui.widgets.ListContentProposalProvider; +import org.eclipse.jface.fieldassist.ComboContentAdapter; +import org.eclipse.jface.fieldassist.ContentProposalAdapter; +import org.eclipse.jface.fieldassist.DecoratedField; +import org.eclipse.jface.fieldassist.FieldDecoration; +import org.eclipse.jface.fieldassist.FieldDecorationRegistry; +import org.eclipse.jface.fieldassist.IControlCreator; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; @@ -40,40 +46,71 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; +/** + * The AttributeTypeWizardPage provides a combo to select the attribute type, + * some filter and a preview field. + * + * @author Apache Directory Project + * @version $Rev$, $Date$ + */ public class AttributeTypeWizardPage extends WizardPage { + /** The parent wizard. */ private AttributeWizard wizard; + /** The initial show subschema attributes only. */ private boolean initialShowSubschemaAttributesOnly; + /** The initial hide existing attributes. */ private boolean initialHideExistingAttributes; - private String initialAttributeDescription; - - private IEntry initialEntry; - + /** The parsed attribute type. */ private String parsedAttributeType; + /** The possible attribute types. */ private String[] possibleAttributeTypes; + /** The possible attribute types applicable to the entry's schema only. */ private String[] possibleAttributeTypesSubschemaOnly; + /** The possible attribute types applicable to the entry's schema only, existing attributes are hidden. */ private String[] possibleAttributeTypesSubschemaOnlyAndExistingHidden; + + /** The attribute type combo field. */ + private DecoratedField attributeTypeComboField; + /** The attribute type combo. */ private Combo attributeTypeCombo; + /** The attribute type content proposal adapter */ + private ContentProposalAdapter attributeTypeCPA; + + /** The show subschem attributes only button. */ private Button showSubschemAttributesOnlyButton; + /** The hide existing attributes button. */ private Button hideExistingAttributesButton; + /** The preview text. */ private Text previewText; + /** + * Creates a new instance of AttributeTypeWizardPage. + * + * @param pageName the page name + * @param initialEntry the initial entry + * @param initialAttributeDescription the initial attribute description + * @param initialShowSubschemaAttributesOnly the initial show subschema attributes only + * @param initialHideExistingAttributes the initial hide existing attributes + * @param wizard the wizard + */ public AttributeTypeWizardPage( String pageName, IEntry initialEntry, String initialAttributeDescription, boolean initialShowSubschemaAttributesOnly, boolean initialHideExistingAttributes, AttributeWizard wizard ) { @@ -84,82 +121,114 @@ super.setPageComplete( false ); this.wizard = wizard; - this.initialEntry = initialEntry; - this.initialAttributeDescription = initialAttributeDescription; this.initialShowSubschemaAttributesOnly = initialShowSubschemaAttributesOnly; this.initialHideExistingAttributes = initialHideExistingAttributes; - this.possibleAttributeTypes = this.initialEntry.getConnection().getSchema().getAttributeTypeDescriptionNames(); - Arrays.sort( this.possibleAttributeTypes ); - this.possibleAttributeTypesSubschemaOnly = this.initialEntry.getSubschema().getAllAttributeNames(); - Arrays.sort( this.possibleAttributeTypesSubschemaOnly ); + possibleAttributeTypes = initialEntry.getConnection().getSchema().getAttributeTypeDescriptionNames(); + Arrays.sort( possibleAttributeTypes ); + possibleAttributeTypesSubschemaOnly = initialEntry.getSubschema().getAllAttributeNames(); + Arrays.sort( possibleAttributeTypesSubschemaOnly ); - Set set = new HashSet( Arrays.asList( this.initialEntry.getSubschema().getAllAttributeNames() ) ); - IAttribute[] existingAttributes = this.initialEntry.getAttributes(); + Set set = new HashSet( Arrays.asList( initialEntry.getSubschema().getAllAttributeNames() ) ); + IAttribute[] existingAttributes = initialEntry.getAttributes(); for ( int i = 0; existingAttributes != null && i < existingAttributes.length; i++ ) { set.remove( existingAttributes[i].getDescription() ); } - this.possibleAttributeTypesSubschemaOnlyAndExistingHidden = ( String[] ) set.toArray( new String[set.size()] ); - Arrays.sort( this.possibleAttributeTypesSubschemaOnlyAndExistingHidden ); + possibleAttributeTypesSubschemaOnlyAndExistingHidden = ( String[] ) set.toArray( new String[set.size()] ); + Arrays.sort( possibleAttributeTypesSubschemaOnlyAndExistingHidden ); - String attributeDescription = this.initialAttributeDescription; + String attributeDescription = initialAttributeDescription; if ( attributeDescription == null ) + { attributeDescription = ""; + } String[] attributeDescriptionComponents = attributeDescription.split( ";" ); - this.parsedAttributeType = attributeDescriptionComponents[0]; - + parsedAttributeType = attributeDescriptionComponents[0]; } + /** + * Validates this page. + */ private void validate() { - this.previewText.setText( wizard.getAttributeDescription() ); - this.setPageComplete( !"".equals( this.attributeTypeCombo.getText() ) ); + previewText.setText( wizard.getAttributeDescription() ); + setPageComplete( !"".equals( attributeTypeCombo.getText() ) ); } + /** + * {@inheritDoc} + */ public void setVisible( boolean visible ) { super.setVisible( visible ); if ( visible ) { - this.validate(); + validate(); } } + /** + * {@inheritDoc} + */ public void createControl( Composite parent ) { - Composite composite = new Composite( parent, SWT.NONE ); GridLayout gl = new GridLayout( 2, false ); composite.setLayout( gl ); composite.setLayoutData( new GridData( GridData.FILL_BOTH ) ); BaseWidgetUtils.createLabel( composite, "Attribute type:", 1 ); - this.attributeTypeCombo = BaseWidgetUtils.createCombo( composite, possibleAttributeTypes, -1, 1 ); - this.attributeTypeCombo.setText( parsedAttributeType ); +// attributeTypeCombo = BaseWidgetUtils.createCombo( composite, possibleAttributeTypes, -1, 1 ); +// attributeTypeCombo.setText( parsedAttributeType ); + + // attribute combo with field decoration + final FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration( + FieldDecorationRegistry.DEC_CONTENT_PROPOSAL ); + attributeTypeComboField = new DecoratedField( composite, SWT.NONE, new IControlCreator() + { + public Control createControl( Composite parent, int style ) + { + Combo combo = BaseWidgetUtils.createCombo( parent, new String[0], -1, 1 ); + combo.setVisibleItemCount( 20 ); + return combo; + } + } ); + attributeTypeComboField.addFieldDecoration( fieldDecoration, SWT.TOP | SWT.LEFT, true ); + attributeTypeComboField.getLayoutControl().setLayoutData( + new GridData( SWT.FILL, SWT.CENTER, true, false ) ); + attributeTypeCombo = ( Combo ) attributeTypeComboField.getControl(); + attributeTypeCombo.setItems( possibleAttributeTypes ); + attributeTypeCombo.setText( parsedAttributeType ); + + // content proposal adapter + attributeTypeCPA = new ContentProposalAdapter (attributeTypeCombo, new ComboContentAdapter(), + new ListContentProposalProvider( attributeTypeCombo.getItems() ), null, null ); + attributeTypeCPA.setFilterStyle( ContentProposalAdapter.FILTER_NONE ); + attributeTypeCPA.setProposalAcceptanceStyle( ContentProposalAdapter.PROPOSAL_REPLACE ); BaseWidgetUtils.createSpacer( composite, 1 ); - this.showSubschemAttributesOnlyButton = BaseWidgetUtils.createCheckbox( composite, - "Show subschema attributes only", 1 ); - this.showSubschemAttributesOnlyButton.setSelection( initialShowSubschemaAttributesOnly ); + showSubschemAttributesOnlyButton = BaseWidgetUtils.createCheckbox( composite, "Show subschema attributes only", + 1 ); + showSubschemAttributesOnlyButton.setSelection( initialShowSubschemaAttributesOnly ); BaseWidgetUtils.createSpacer( composite, 1 ); - this.hideExistingAttributesButton = BaseWidgetUtils.createCheckbox( composite, "Hide existing attributes", 1 ); - this.hideExistingAttributesButton.setSelection( initialHideExistingAttributes ); + hideExistingAttributesButton = BaseWidgetUtils.createCheckbox( composite, "Hide existing attributes", 1 ); + hideExistingAttributesButton.setSelection( initialHideExistingAttributes ); Label l = new Label( composite, SWT.NONE ); GridData gd = new GridData( GridData.FILL_BOTH ); gd.horizontalSpan = 2; l.setLayoutData( gd ); - /* this.previewLabel = */BaseWidgetUtils.createLabel( composite, "Preview:", 1 ); - this.previewText = BaseWidgetUtils.createReadonlyText( composite, "", 1 ); + BaseWidgetUtils.createLabel( composite, "Preview:", 1 ); + previewText = BaseWidgetUtils.createReadonlyText( composite, "", 1 ); // attribute type listener - this.attributeTypeCombo.addModifyListener( new ModifyListener() + attributeTypeCombo.addModifyListener( new ModifyListener() { public void modifyText( ModifyEvent e ) { @@ -168,7 +237,7 @@ } ); // filter listener - this.showSubschemAttributesOnlyButton.addSelectionListener( new SelectionAdapter() + showSubschemAttributesOnlyButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected( SelectionEvent e ) { @@ -176,7 +245,7 @@ validate(); } } ); - this.hideExistingAttributesButton.addSelectionListener( new SelectionAdapter() + hideExistingAttributesButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected( SelectionEvent e ) { @@ -190,43 +259,51 @@ } + /** + * Updates the filter. + */ private void updateFilter() { // enable/disable filter buttons - this.hideExistingAttributesButton.setEnabled( this.showSubschemAttributesOnlyButton.getSelection() ); - if ( this.possibleAttributeTypesSubschemaOnly.length == 0 ) + hideExistingAttributesButton.setEnabled( showSubschemAttributesOnlyButton.getSelection() ); + if ( possibleAttributeTypesSubschemaOnly.length == 0 ) { - this.showSubschemAttributesOnlyButton.setSelection( false ); - this.showSubschemAttributesOnlyButton.setEnabled( false ); + showSubschemAttributesOnlyButton.setSelection( false ); + showSubschemAttributesOnlyButton.setEnabled( false ); } - if ( this.possibleAttributeTypesSubschemaOnlyAndExistingHidden.length == 0 ) + if ( possibleAttributeTypesSubschemaOnlyAndExistingHidden.length == 0 ) { - this.hideExistingAttributesButton.setEnabled( false ); - this.hideExistingAttributesButton.setSelection( false ); + hideExistingAttributesButton.setEnabled( false ); + hideExistingAttributesButton.setSelection( false ); } - // update filters - String value = this.attributeTypeCombo.getText(); - if ( this.hideExistingAttributesButton.getSelection() && this.showSubschemAttributesOnlyButton.getSelection() ) + // update combo items and proposals + String value = attributeTypeCombo.getText(); + if ( hideExistingAttributesButton.getSelection() && showSubschemAttributesOnlyButton.getSelection() ) { - this.attributeTypeCombo.setItems( this.possibleAttributeTypesSubschemaOnlyAndExistingHidden ); + attributeTypeCombo.setItems( possibleAttributeTypesSubschemaOnlyAndExistingHidden ); } - else if ( this.showSubschemAttributesOnlyButton.getSelection() ) + else if ( showSubschemAttributesOnlyButton.getSelection() ) { - this.attributeTypeCombo.setItems( this.possibleAttributeTypesSubschemaOnly ); + attributeTypeCombo.setItems( possibleAttributeTypesSubschemaOnly ); } else { - this.attributeTypeCombo.setItems( this.possibleAttributeTypes ); + attributeTypeCombo.setItems( possibleAttributeTypes ); } - this.attributeTypeCombo.setText( value ); + attributeTypeCPA.setContentProposalProvider( new ListContentProposalProvider( attributeTypeCombo.getItems() ) ); + attributeTypeCombo.setText( value ); } + /** + * Gets the attribute type. + * + * @return the attribute type + */ String getAttributeType() { - - if ( this.attributeTypeCombo == null | this.attributeTypeCombo.isDisposed() ) + if ( attributeTypeCombo == null | attributeTypeCombo.isDisposed() ) { return ""; } Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/AttributeWizard.java URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/AttributeWizard.java?view=diff&rev=514464&r1=514463&r2=514464 ============================================================================== --- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/AttributeWizard.java (original) +++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/AttributeWizard.java Sun Mar 4 12:15:08 2007 @@ -36,24 +36,42 @@ import org.eclipse.ui.PlatformUI; +/** + * The AttributeWizard is used to create a new attribute or + * to modify an existing attribute description. + * + * @author Apache Directory Project + * @version $Rev$, $Date$ + */ public class AttributeWizard extends Wizard implements INewWizard { + /** The type page. */ private AttributeTypeWizardPage typePage; + /** The options page. */ private AttributeOptionsWizardPage optionsPage; + /** The initial show subschema attributes only. */ private boolean initialShowSubschemaAttributesOnly; + /** The initial hide existing attributes. */ private boolean initialHideExistingAttributes; + /** The initial attribute description. */ private String initialAttributeDescription; + /** The initial entry. */ private IEntry initialEntry; + /** The final attribute description. */ private String finalAttributeDescription = null; + /** + * Creates a new instance of AttributeWizard with an empty + * attriute description. + */ public AttributeWizard() { super.setWindowTitle( "New Attribute" ); @@ -65,6 +83,15 @@ } + /** + * Creates a new instance of AttributeWizard with the given initial attribute desription + * + * @param title the title + * @param entry the entry + * @param showSubschemaAttributesOnly the show subschema attributes only + * @param hideExistingAttributes the hide existing attributes + * @param attributeDescription the attribute description + */ public AttributeWizard( String title, boolean showSubschemaAttributesOnly, boolean hideExistingAttributes, String attributeDescription, IEntry entry ) { @@ -77,28 +104,38 @@ } + /** + * Gets the id. + * + * @return the id + */ public static String getId() { return AttributeWizard.class.getName(); } + /** + * {@inheritDoc}} + */ public void init( IWorkbench workbench, IStructuredSelection selection ) { } + /** + * {@inheritDoc}} + */ public void addPages() { - if ( this.initialEntry != null ) + if ( initialEntry != null ) { - typePage = new AttributeTypeWizardPage( AttributeTypeWizardPage.class.getName(), this.initialEntry, - this.initialAttributeDescription, this.initialShowSubschemaAttributesOnly, - this.initialHideExistingAttributes, this ); + typePage = new AttributeTypeWizardPage( AttributeTypeWizardPage.class.getName(), initialEntry, + initialAttributeDescription, initialShowSubschemaAttributesOnly, initialHideExistingAttributes, this ); addPage( typePage ); optionsPage = new AttributeOptionsWizardPage( AttributeOptionsWizardPage.class.getName(), - this.initialAttributeDescription, this ); + initialAttributeDescription, this ); addPage( optionsPage ); } else @@ -115,7 +152,7 @@ public void createPageControls( Composite pageContainer ) { super.createPageControls( pageContainer ); - + // set help context ID PlatformUI.getWorkbench().getHelpSystem().setHelp( typePage.getControl(), BrowserUIPlugin.PLUGIN_ID + "." + "tools_attribute_wizard" ); @@ -123,10 +160,18 @@ BrowserUIPlugin.PLUGIN_ID + "." + "tools_attribute_wizard" ); } - + /** + * A dummy wizard page to show the user that no entry is selected. + * + * @author Apache Directory Project + * @version $Rev$, $Date$ + */ class DummyWizardPage extends WizardPage { + /** + * Creates a new instance of DummyWizardPage. + */ protected DummyWizardPage() { super( "" ); @@ -137,6 +182,9 @@ } + /** + * {@inheritDoc} + */ public void createControl( Composite parent ) { Composite composite = new Composite( parent, SWT.NONE ); @@ -149,12 +197,9 @@ } - public boolean performCancel() - { - return true; - } - - + /** + * {@inheritDoc} + */ public boolean performFinish() { finalAttributeDescription = getAttributeDescription(); @@ -162,6 +207,11 @@ } + /** + * Gets the attribute description. + * + * @return the attribute description + */ public String getAttributeDescription() { if ( finalAttributeDescription != null ) Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ExportCsvFromWizardPage.java URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ExportCsvFromWizardPage.java?view=diff&rev=514464&r1=514463&r2=514464 ============================================================================== --- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ExportCsvFromWizardPage.java (original) +++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ExportCsvFromWizardPage.java Sun Mar 4 12:15:08 2007 @@ -31,8 +31,8 @@ public ExportCsvFromWizardPage( String pageName, ExportBaseWizard wizard ) { - super( pageName, wizard, new SearchPageWrapper( SearchPageWrapper.NAME_INVISIBLE | SearchPageWrapper.DN_VISIBLE - | SearchPageWrapper.DN_CHECKED ) ); + super( pageName, wizard, new SearchPageWrapper( SearchPageWrapper.NAME_INVISIBLE | SearchPageWrapper.RETURN_DN_VISIBLE + | SearchPageWrapper.RETURN_DN_CHECKED ) ); super.setImageDescriptor( BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_EXPORT_CSV_WIZARD ) ); } @@ -40,7 +40,7 @@ public boolean isExportDn() { - return spw.isExportDn(); + return spw.isReturnDn(); } } Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ExportDsmlFromWizardPage.java URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ExportDsmlFromWizardPage.java?view=diff&rev=514464&r1=514463&r2=514464 ============================================================================== --- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ExportDsmlFromWizardPage.java (original) +++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ExportDsmlFromWizardPage.java Sun Mar 4 12:15:08 2007 @@ -47,10 +47,10 @@ { super( pageName, wizard, new SearchPageWrapper( SearchPageWrapper.NAME_INVISIBLE - | SearchPageWrapper.ALLATTRIBUTES_VISIBLE - | SearchPageWrapper.OPERATIONALATTRIBUTES_VISIBLE + | SearchPageWrapper.RETURN_ALLATTRIBUTES_VISIBLE + | SearchPageWrapper.RETURN_OPERATIONALATTRIBUTES_VISIBLE | ( ( wizard.getSearch().getReturningAttributes() == null || wizard.getSearch() - .getReturningAttributes().length == 0 ) ? SearchPageWrapper.ALLATTRIBUTES_CHECKED + .getReturningAttributes().length == 0 ) ? SearchPageWrapper.RETURN_ALLATTRIBUTES_CHECKED : SearchPageWrapper.NONE ) ) ); super.setImageDescriptor( BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_EXPORT_DSML_WIZARD ) ); Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ExportExcelFromWizardPage.java URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ExportExcelFromWizardPage.java?view=diff&rev=514464&r1=514463&r2=514464 ============================================================================== --- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ExportExcelFromWizardPage.java (original) +++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ExportExcelFromWizardPage.java Sun Mar 4 12:15:08 2007 @@ -33,12 +33,12 @@ { super( pageName, wizard, new SearchPageWrapper( SearchPageWrapper.NAME_INVISIBLE - | SearchPageWrapper.DN_VISIBLE - | SearchPageWrapper.DN_CHECKED - | SearchPageWrapper.ALLATTRIBUTES_VISIBLE - | SearchPageWrapper.OPERATIONALATTRIBUTES_VISIBLE + | SearchPageWrapper.RETURN_DN_VISIBLE + | SearchPageWrapper.RETURN_DN_CHECKED + | SearchPageWrapper.RETURN_ALLATTRIBUTES_VISIBLE + | SearchPageWrapper.RETURN_OPERATIONALATTRIBUTES_VISIBLE | ( ( wizard.getSearch().getReturningAttributes() == null || wizard.getSearch() - .getReturningAttributes().length == 0 ) ? SearchPageWrapper.ALLATTRIBUTES_CHECKED + .getReturningAttributes().length == 0 ) ? SearchPageWrapper.RETURN_ALLATTRIBUTES_CHECKED : SearchPageWrapper.NONE ) ) ); super.setImageDescriptor( BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_EXPORT_XLS_WIZARD ) ); @@ -47,7 +47,7 @@ public boolean isExportDn() { - return spw.isExportDn(); + return spw.isReturnDn(); } } Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ExportLdifFromWizardPage.java URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ExportLdifFromWizardPage.java?view=diff&rev=514464&r1=514463&r2=514464 ============================================================================== --- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ExportLdifFromWizardPage.java (original) +++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ExportLdifFromWizardPage.java Sun Mar 4 12:15:08 2007 @@ -33,10 +33,10 @@ { super( pageName, wizard, new SearchPageWrapper( SearchPageWrapper.NAME_INVISIBLE - | SearchPageWrapper.ALLATTRIBUTES_VISIBLE - | SearchPageWrapper.OPERATIONALATTRIBUTES_VISIBLE + | SearchPageWrapper.RETURN_ALLATTRIBUTES_VISIBLE + | SearchPageWrapper.RETURN_OPERATIONALATTRIBUTES_VISIBLE | ( ( wizard.getSearch().getReturningAttributes() == null || wizard.getSearch() - .getReturningAttributes().length == 0 ) ? SearchPageWrapper.ALLATTRIBUTES_CHECKED + .getReturningAttributes().length == 0 ) ? SearchPageWrapper.RETURN_ALLATTRIBUTES_CHECKED : SearchPageWrapper.NONE ) ) ); super.setImageDescriptor( BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_EXPORT_LDIF_WIZARD ) ); Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/NewLdifFileWizard.java URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/NewLdifFileWizard.java?view=diff&rev=514464&r1=514463&r2=514464 ============================================================================== --- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/NewLdifFileWizard.java (original) +++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/NewLdifFileWizard.java Sun Mar 4 12:15:08 2007 @@ -33,38 +33,63 @@ import org.eclipse.ui.PartInitException; +/** + * The NewLdifFileWizard is used to add a "New LDIF" action to the platforms + * "New..." menu. It just opens an editor with a dummy LDIF editor input. + * + * @author Apache Directory Project + * @version $Rev$, $Date$ + */ + public class NewLdifFileWizard extends Wizard implements INewWizard { + /** The window. */ private IWorkbenchWindow window; + /** + * Creates a new instance of NewLdifFileWizard. + */ public NewLdifFileWizard() { } + /** + * {@inheritDoc} + */ public void init( IWorkbench workbench, IStructuredSelection selection ) { window = workbench.getActiveWorkbenchWindow(); } + /** + * {@inheritDoc} + */ public void dispose() { window = null; } + /** + * Gets the id. + * + * @return the id + */ public static String getId() { return NewLdifFileWizard.class.getName(); } + /** + * {@inheritDoc} + */ public boolean performFinish() { - IEditorInput input = new NonExistingLdifEditorInput(); String editorId = LdifEditor.getId(); Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/NewSearchWizard.java URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/NewSearchWizard.java?view=diff&rev=514464&r1=514463&r2=514464 ============================================================================== --- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/NewSearchWizard.java (original) +++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/NewSearchWizard.java Sun Mar 4 12:15:08 2007 @@ -30,35 +30,60 @@ import org.eclipse.ui.IWorkbenchWindow; +/** + * The NewSearchWizard is used to add a "New Search" action to the platforms + * "New..." menu. It just opens the platform's search dialog. + * + * @author Apache Directory Project + * @version $Rev$, $Date$ + */ public class NewSearchWizard extends Wizard implements INewWizard { + /** The window. */ private IWorkbenchWindow window; + /** + * Creates a new instance of NewSearchWizard. + */ public NewSearchWizard() { } + /** + * {@inheritDoc} + */ public void init( IWorkbench workbench, IStructuredSelection selection ) { window = workbench.getActiveWorkbenchWindow(); } + /** + * {@inheritDoc} + */ public void dispose() { window = null; } + /** + * Gets the id. + * + * @return the id + */ public static String getId() { return NewSearchWizard.class.getName(); } + /** + * {@inheritDoc} + */ public boolean performFinish() { NewSearchUI.openSearchDialog( window, SearchPage.getId() );