You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by fe...@apache.org on 2007/11/05 18:15:02 UTC

svn commit: r592094 [21/35] - in /directory/sandbox/felixk/studio-schemaeditor: ./ META-INF/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/directory/ src/main/java/org/apache/directory/studio/ src/m...

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchView.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchView.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchView.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchView.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,979 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.schemaeditor.view.views;
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.regex.Pattern;
+
+import org.apache.directory.shared.ldap.schema.SchemaObject;
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.apache.directory.studio.schemaeditor.PluginUtils;
+import org.apache.directory.studio.schemaeditor.controller.SchemaHandler;
+import org.apache.directory.studio.schemaeditor.controller.SearchViewController;
+import org.apache.directory.studio.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.schemaeditor.model.ObjectClassImpl;
+import org.apache.directory.studio.schemaeditor.view.ViewUtils;
+import org.apache.directory.studio.schemaeditor.view.editors.attributetype.AttributeTypeEditor;
+import org.apache.directory.studio.schemaeditor.view.editors.attributetype.AttributeTypeEditorInput;
+import org.apache.directory.studio.schemaeditor.view.editors.objectclass.ObjectClassEditor;
+import org.apache.directory.studio.schemaeditor.view.editors.objectclass.ObjectClassEditorInput;
+import org.apache.directory.studio.schemaeditor.view.search.SearchPage;
+import org.apache.directory.studio.schemaeditor.view.search.SearchPage.SearchInEnum;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.viewers.DecoratingLabelProvider;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class represents the Search View.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SearchView extends ViewPart
+{
+    /** The view's ID */
+    public static final String ID = Activator.PLUGIN_ID + ".view.SearchView"; //$NON-NLS-1$
+
+    /** The current Search String */
+    private String searchString;
+
+    // UI fields
+    private Text searchField;
+    private Button searchButton;
+    private Label searchResultsLabel;
+    private Table resultsTable;
+    private TableViewer resultsTableViewer;
+    private Composite searchFieldComposite;
+    private Composite searchFieldInnerComposite;
+    private Label separatorLabel;
+
+    /** The parent composite */
+    private Composite parent;
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
+     */
+    @Override
+    public void createPartControl( Composite parent )
+    {
+        // Help Context for Dynamic Help
+        PlatformUI.getWorkbench().getHelpSystem().setHelp( parent, Activator.PLUGIN_ID + "." + "search_view" );
+
+        this.parent = parent;
+        GridLayout gridLayout = new GridLayout();
+        gridLayout.horizontalSpacing = 0;
+        gridLayout.marginBottom = 0;
+        gridLayout.marginHeight = 0;
+        gridLayout.marginLeft = 0;
+        gridLayout.marginRight = 0;
+        gridLayout.marginTop = 0;
+        gridLayout.marginWidth = 0;
+        gridLayout.verticalSpacing = 0;
+        parent.setLayout( gridLayout );
+
+        // Search Field
+        searchFieldComposite = new Composite( parent, SWT.NONE );
+        gridLayout = new GridLayout();
+        gridLayout.horizontalSpacing = 0;
+        gridLayout.marginBottom = 0;
+        gridLayout.marginHeight = 0;
+        gridLayout.marginLeft = 0;
+        gridLayout.marginRight = 0;
+        gridLayout.marginTop = 0;
+        gridLayout.marginWidth = 0;
+        gridLayout.verticalSpacing = 0;
+        searchFieldComposite.setLayout( gridLayout );
+        searchFieldComposite.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        // This searchFieldCompositeSeparator is used to display correctly the searchFieldComposite,
+        // since an empty composite does not display well.
+        Label searchFieldCompositeSeparator = new Label( searchFieldComposite, SWT.SEPARATOR | SWT.HORIZONTAL );
+        GridData gridData = new GridData( SWT.FILL, SWT.NONE, true, false );
+        gridData.heightHint = 1;
+        searchFieldCompositeSeparator.setLayoutData( gridData );
+        searchFieldCompositeSeparator.setVisible( false );
+
+        // Search Results Label
+        searchResultsLabel = new Label( parent, SWT.NONE );
+        searchResultsLabel.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+        // Separator Label
+        Label separatorLabel2 = new Label( parent, SWT.SEPARATOR | SWT.HORIZONTAL );
+        separatorLabel2.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+        // Create the table 
+        createTableViewer();
+
+        setSearchResultsLabel( null, 0 );
+
+        new SearchViewController( this );
+    }
+
+
+    /**
+     * Create the Search Field Sections.
+     */
+    private void createSearchField()
+    {
+        // Search Inner Composite
+        searchFieldInnerComposite = new Composite( searchFieldComposite, SWT.NONE );
+        GridLayout searchFieldInnerCompositeGridLayout = new GridLayout( 4, false );
+        searchFieldInnerCompositeGridLayout.horizontalSpacing = 1;
+        searchFieldInnerCompositeGridLayout.verticalSpacing = 1;
+        searchFieldInnerCompositeGridLayout.marginHeight = 1;
+        searchFieldInnerCompositeGridLayout.marginWidth = 2;
+        searchFieldInnerComposite.setLayout( searchFieldInnerCompositeGridLayout );
+        searchFieldInnerComposite.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+        // Search Label
+        Label searchFieldLabel = new Label( searchFieldInnerComposite, SWT.NONE );
+        searchFieldLabel.setText( "Search:" );
+        searchFieldLabel.setLayoutData( new GridData( SWT.NONE, SWT.CENTER, false, false ) );
+
+        // Search Text Field
+        searchField = new Text( searchFieldInnerComposite, SWT.BORDER );
+        if ( searchString != null )
+        {
+            searchField.setText( searchString );
+        }
+        searchField.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false ) );
+        searchField.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent e )
+            {
+                validateSearchField();
+            }
+        } );
+        searchField.addKeyListener( new KeyAdapter()
+        {
+            public void keyReleased( KeyEvent e )
+            {
+                if ( e.keyCode == SWT.ARROW_DOWN )
+                {
+                    resultsTable.setFocus();
+                }
+                else if ( ( e.keyCode == Action.findKeyCode( "RETURN" ) ) || ( e.keyCode == 16777296 /* The "Enter" Key at the bottom right of the keyboard */) ) //$NON-NLS-1$ 
+                {
+                    search();
+                }
+            }
+        } );
+
+        // Search Toolbar
+        final ToolBar searchToolBar = new ToolBar( searchFieldInnerComposite, SWT.HORIZONTAL | SWT.FLAT );
+        // Creating the Search In ToolItem
+        final ToolItem searchInToolItem = new ToolItem( searchToolBar, SWT.DROP_DOWN );
+        searchInToolItem.setText( "Search In" );
+        // Adding the action to display the Menu when the item is clicked
+        searchInToolItem.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent event )
+            {
+                Rectangle rect = searchInToolItem.getBounds();
+                Point pt = new Point( rect.x, rect.y + rect.height );
+                pt = searchToolBar.toDisplay( pt );
+
+                Menu menu = createSearchInMenu();
+                menu.setLocation( pt.x, pt.y );
+                menu.setVisible( true );
+            }
+        } );
+
+        new ToolItem( searchToolBar, SWT.SEPARATOR );
+
+        final ToolItem scopeToolItem = new ToolItem( searchToolBar, SWT.DROP_DOWN );
+        scopeToolItem.setText( "Scope" );
+        // Adding the action to display the Menu when the item is clicked
+        scopeToolItem.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent event )
+            {
+                Rectangle rect = scopeToolItem.getBounds();
+                Point pt = new Point( rect.x, rect.y + rect.height );
+                pt = searchToolBar.toDisplay( pt );
+
+                Menu menu = createScopeMenu();
+                menu.setLocation( pt.x, pt.y );
+                menu.setVisible( true );
+            }
+        } );
+        searchToolBar.setLayoutData( new GridData( SWT.NONE, SWT.CENTER, false, false ) );
+
+        // Search Button
+        searchButton = new Button( searchFieldInnerComposite, SWT.PUSH | SWT.DOWN );
+        searchButton.setEnabled( false );
+        searchButton.setImage( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+            PluginConstants.IMG_SEARCH ).createImage() );
+        searchButton.setToolTipText( "Search" );
+        searchButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                search();
+            }
+        } );
+        searchButton.setLayoutData( new GridData( SWT.NONE, SWT.CENTER, false, false ) );
+
+        // Separator Label
+        separatorLabel = new Label( searchFieldComposite, SWT.SEPARATOR | SWT.HORIZONTAL );
+        separatorLabel.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+    }
+
+
+    /**
+     * Creates the Search In Menu
+     *
+     * @return
+     *      the Search In menu
+     */
+    public Menu createSearchInMenu()
+    {
+        final IDialogSettings settings = Activator.getDefault().getDialogSettings();
+
+        // Creating the associated Menu
+        Menu searchInMenu = new Menu( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.POP_UP );
+
+        // Filling the menu
+        // Aliases
+        final MenuItem aliasesMenuItem = new MenuItem( searchInMenu, SWT.CHECK );
+        aliasesMenuItem.setText( "Aliases" );
+        aliasesMenuItem.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                settings.put( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_ALIASES, aliasesMenuItem.getSelection() );
+            }
+        } );
+        // OID
+        final MenuItem oidMenuItem = new MenuItem( searchInMenu, SWT.CHECK );
+        oidMenuItem.setText( "OID" );
+        oidMenuItem.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                settings.put( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_OID, oidMenuItem.getSelection() );
+            }
+        } );
+        // Description
+        final MenuItem descriptionMenuItem = new MenuItem( searchInMenu, SWT.CHECK );
+        descriptionMenuItem.setText( "Description" );
+        descriptionMenuItem.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                settings.put( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_DESCRIPTION, descriptionMenuItem
+                    .getSelection() );
+            }
+        } );
+        // Separator
+        new MenuItem( searchInMenu, SWT.SEPARATOR );
+        // Superior
+        final MenuItem superiorMenuItem = new MenuItem( searchInMenu, SWT.CHECK );
+        superiorMenuItem.setText( "Superior" );
+        superiorMenuItem.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                settings.put( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_SUPERIOR, superiorMenuItem.getSelection() );
+            }
+        } );
+        // Syntax
+        final MenuItem syntaxMenuItem = new MenuItem( searchInMenu, SWT.CHECK );
+        syntaxMenuItem.setText( "Syntax" );
+        syntaxMenuItem.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                settings.put( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_SYNTAX, syntaxMenuItem.getSelection() );
+            }
+        } );
+        // Matching Rules
+        final MenuItem matchingRulesMenuItem = new MenuItem( searchInMenu, SWT.CHECK );
+        matchingRulesMenuItem.setText( "Matching Rules" );
+        matchingRulesMenuItem.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                settings.put( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_MATCHING_RULES, matchingRulesMenuItem
+                    .getSelection() );
+            }
+        } );
+        // Separator
+        new MenuItem( searchInMenu, SWT.SEPARATOR );
+        // Superiors
+        final MenuItem superiorsMenuItem = new MenuItem( searchInMenu, SWT.CHECK );
+        superiorsMenuItem.setText( "Superiors" );
+        superiorsMenuItem.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                settings.put( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_SUPERIORS, superiorsMenuItem.getSelection() );
+            }
+        } );
+        // Mandatory Attributes
+        final MenuItem mandatoryAttributesMenuItem = new MenuItem( searchInMenu, SWT.CHECK );
+        mandatoryAttributesMenuItem.setText( "Mandatory Attributes" );
+        mandatoryAttributesMenuItem.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                settings.put( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_MANDATORY_ATTRIBUTES,
+                    mandatoryAttributesMenuItem.getSelection() );
+            }
+        } );
+        // Optional Attributes
+        final MenuItem optionalAttributesMenuItem = new MenuItem( searchInMenu, SWT.CHECK );
+        optionalAttributesMenuItem.setText( "Optional Attributes" );
+        optionalAttributesMenuItem.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                settings.put( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_OPTIONAL_ATTRIBUTES,
+                    optionalAttributesMenuItem.getSelection() );
+            }
+        } );
+
+        if ( settings.get( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_ALIASES ) == null )
+        {
+            aliasesMenuItem.setSelection( true );
+        }
+        else
+        {
+            aliasesMenuItem.setSelection( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_ALIASES ) );
+        }
+
+        if ( settings.get( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_OID ) == null )
+        {
+            oidMenuItem.setSelection( true );
+        }
+        else
+        {
+
+            oidMenuItem.setSelection( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_OID ) );
+        }
+
+        if ( settings.get( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_DESCRIPTION ) == null )
+        {
+            descriptionMenuItem.setSelection( true );
+        }
+        else
+        {
+            descriptionMenuItem.setSelection( settings
+                .getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_DESCRIPTION ) );
+        }
+
+        superiorMenuItem.setSelection( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_SUPERIOR ) );
+        syntaxMenuItem.setSelection( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_SYNTAX ) );
+        matchingRulesMenuItem.setSelection( settings
+            .getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_MATCHING_RULES ) );
+        superiorsMenuItem.setSelection( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_SUPERIORS ) );
+        mandatoryAttributesMenuItem.setSelection( settings
+            .getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_MANDATORY_ATTRIBUTES ) );
+        optionalAttributesMenuItem.setSelection( settings
+            .getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_OPTIONAL_ATTRIBUTES ) );
+
+        return searchInMenu;
+    }
+
+
+    /**
+     * Creates the Scope Menu
+     *
+     * @return
+     *      the Scope menu
+     */
+    public Menu createScopeMenu()
+    {
+        final IDialogSettings settings = Activator.getDefault().getDialogSettings();
+
+        // Creating the associated Menu
+        Menu scopeMenu = new Menu( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.POP_UP );
+
+        // Filling the menu
+        // Attribute Types And Object Classes
+        final MenuItem attributeTypesAndObjectClassesMenuItem = new MenuItem( scopeMenu, SWT.RADIO );
+        attributeTypesAndObjectClassesMenuItem.setText( "Attribute Types And Object Classes" );
+        attributeTypesAndObjectClassesMenuItem.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                settings.put( PluginConstants.PREFS_SEARCH_PAGE_SCOPE,
+                    PluginConstants.PREFS_SEARCH_PAGE_SCOPE_AT_AND_OC );
+            }
+        } );
+        // Attributes Type Only
+        final MenuItem attributesTypesOnlyMenuItem = new MenuItem( scopeMenu, SWT.RADIO );
+        attributesTypesOnlyMenuItem.setText( "Attribute Types Only" );
+        attributesTypesOnlyMenuItem.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                settings.put( PluginConstants.PREFS_SEARCH_PAGE_SCOPE, PluginConstants.PREFS_SEARCH_PAGE_SCOPE_AT_ONLY );
+            }
+        } );
+        // Object Classes Only
+        final MenuItem objectClassesMenuItem = new MenuItem( scopeMenu, SWT.RADIO );
+        objectClassesMenuItem.setText( "Object Classes Only" );
+        objectClassesMenuItem.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                settings.put( PluginConstants.PREFS_SEARCH_PAGE_SCOPE, PluginConstants.PREFS_SEARCH_PAGE_SCOPE_OC_ONLY );
+            }
+        } );
+
+        if ( settings.get( PluginConstants.PREFS_SEARCH_PAGE_SCOPE ) == null )
+        {
+            attributeTypesAndObjectClassesMenuItem.setSelection( true );
+        }
+        else
+        {
+            switch ( settings.getInt( PluginConstants.PREFS_SEARCH_PAGE_SCOPE ) )
+            {
+                case PluginConstants.PREFS_SEARCH_PAGE_SCOPE_AT_AND_OC:
+                    attributeTypesAndObjectClassesMenuItem.setSelection( true );
+                    break;
+                case PluginConstants.PREFS_SEARCH_PAGE_SCOPE_AT_ONLY:
+                    attributesTypesOnlyMenuItem.setSelection( true );
+                    break;
+                case PluginConstants.PREFS_SEARCH_PAGE_SCOPE_OC_ONLY:
+                    objectClassesMenuItem.setSelection( true );
+                    break;
+            }
+        }
+
+        return scopeMenu;
+    }
+
+
+    /**
+     * Creates the TableViewer.
+     */
+    private void createTableViewer()
+    {
+        // Creating the TableViewer
+        resultsTable = new Table( parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION
+            | SWT.HIDE_SELECTION );
+        GridData gridData = new GridData( SWT.FILL, SWT.FILL, true, true );
+        resultsTable.setLayoutData( gridData );
+        resultsTable.setLinesVisible( true );
+
+        // Creating the TableViewer
+        resultsTableViewer = new TableViewer( resultsTable );
+        resultsTableViewer.setLabelProvider( new DecoratingLabelProvider( new SearchViewLabelProvider(), Activator
+            .getDefault().getWorkbench().getDecoratorManager().getLabelDecorator() ) );
+        resultsTableViewer.setContentProvider( new SearchViewContentProvider() );
+
+        // Adding listeners
+        resultsTable.addKeyListener( new KeyAdapter()
+        {
+            public void keyPressed( KeyEvent e )
+            {
+                if ( ( e.keyCode == Action.findKeyCode( "RETURN" ) )
+                    || ( e.keyCode == 16777296 /* The "Enter" Key at the bottom right of the keyboard */) ) // return key
+                {
+                    openEditor();
+                }
+            }
+        } );
+
+        resultsTableViewer.addDoubleClickListener( new IDoubleClickListener()
+        {
+            public void doubleClick( DoubleClickEvent event )
+            {
+                openEditor();
+            }
+        } );
+    }
+
+
+    /**
+     * Open the editor associated with the current selection in the table.
+     */
+    private void openEditor()
+    {
+        if ( Activator.getDefault().getSchemaHandler() != null )
+        {
+            StructuredSelection selection = ( StructuredSelection ) resultsTableViewer.getSelection();
+
+            if ( !selection.isEmpty() )
+            {
+                Object item = selection.getFirstElement();
+
+                IEditorInput input = null;
+                String editorId = null;
+
+                // Here is the double clicked item
+                if ( item instanceof AttributeTypeImpl )
+                {
+                    input = new AttributeTypeEditorInput( ( AttributeTypeImpl ) item );
+                    editorId = AttributeTypeEditor.ID;
+                }
+                else if ( item instanceof ObjectClassImpl )
+                {
+                    input = new ObjectClassEditorInput( ( ObjectClassImpl ) item );
+                    editorId = ObjectClassEditor.ID;
+                }
+
+                // Let's open the editor
+                if ( input != null )
+                {
+                    try
+                    {
+                        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor( input,
+                            editorId );
+                    }
+                    catch ( PartInitException exception )
+                    {
+                        PluginUtils.logError( "An error occured when opening the editor.", exception );
+                        ViewUtils.displayErrorMessageBox( "Error", "An error occured when opening the editor." );
+                    }
+                }
+            }
+        }
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
+     */
+    public void setFocus()
+    {
+        if ( searchField != null && !searchField.isDisposed() )
+        {
+            searchField.setFocus();
+        }
+        else
+        {
+            resultsTable.setFocus();
+        }
+    }
+
+
+    /**
+     * Shows the Search Field Section.
+     */
+    public void showSearchFieldSection()
+    {
+        createSearchField();
+        parent.layout( true, true );
+        searchField.setFocus();
+        validateSearchField();
+    }
+
+
+    /**
+     * Hides the Search Field Section.
+     */
+    public void hideSearchFieldSection()
+    {
+        if ( searchFieldInnerComposite != null )
+        {
+            searchFieldInnerComposite.dispose();
+            searchFieldInnerComposite = null;
+        }
+        if ( separatorLabel != null )
+        {
+            separatorLabel.dispose();
+            separatorLabel = null;
+        }
+        parent.layout( true, true );
+        resultsTable.setFocus();
+    }
+
+
+    private void validateSearchField()
+    {
+        searchButton.setEnabled( searchField.getText().length() > 0 );
+    }
+
+
+    /**
+     * Sets the Search Input.
+     *
+     * @param searchString
+     *      the search String
+     * @param searchIn
+     *      the search In
+     * @param scope
+     *      the scope
+     */
+    public void setSearchInput( String searchString, SearchInEnum[] searchIn, int scope )
+    {
+        this.searchString = searchString;
+
+        // Saving search String and Search Scope to dialog settings
+        SearchPage.addSearchStringHistory( searchString );
+        SearchPage.saveSearchScope( Arrays.asList( searchIn ) );
+
+        if ( ( searchField != null ) && ( !searchField.isDisposed() ) )
+        {
+            searchField.setText( searchString );
+            validateSearchField();
+        }
+
+        List<SchemaObject> results = search( searchString, searchIn, scope );
+        setSearchResultsLabel( searchString, results.size() );
+        resultsTableViewer.setInput( results );
+    }
+
+
+    /**
+     * Searches the objects corresponding to the search parameters.
+     *
+     * @param searchString
+     *      the search String
+     * @param searchIn
+     *      the search In
+     * @param scope
+     *      the scope
+     */
+    private List<SchemaObject> search( String searchString, SearchInEnum[] searchIn, int scope )
+    {
+        List<SchemaObject> searchResults = new ArrayList<SchemaObject>();
+
+        if ( searchString != null )
+        {
+            String computedSearchString = searchString.replaceAll( "\\*", "\\\\w*" );
+            computedSearchString = computedSearchString.replaceAll( "\\?", ".*" );
+
+            Pattern pattern = Pattern.compile( computedSearchString, Pattern.CASE_INSENSITIVE );
+
+            SchemaHandler schemaHandler = Activator.getDefault().getSchemaHandler();
+            if ( schemaHandler != null )
+            {
+                List<SearchInEnum> searchScope = new ArrayList<SearchInEnum>( Arrays.asList( searchIn ) );
+
+                if ( ( scope == PluginConstants.PREFS_SEARCH_PAGE_SCOPE_AT_AND_OC )
+                    || ( scope == PluginConstants.PREFS_SEARCH_PAGE_SCOPE_AT_ONLY ) )
+                {
+                    // Looping on attribute types
+                    List<AttributeTypeImpl> attributeTypes = schemaHandler.getAttributeTypes();
+                    for ( AttributeTypeImpl at : attributeTypes )
+                    {
+                        // Aliases
+                        if ( searchScope.contains( SearchInEnum.ALIASES ) )
+                        {
+                            if ( checkArray( pattern, at.getNames() ) )
+                            {
+                                searchResults.add( at );
+                                continue;
+                            }
+                        }
+
+                        // OID
+                        if ( searchScope.contains( SearchInEnum.OID ) )
+                        {
+                            if ( checkString( pattern, at.getOid() ) )
+                            {
+                                searchResults.add( at );
+                                continue;
+                            }
+                        }
+
+                        // Description
+                        if ( searchScope.contains( SearchInEnum.DESCRIPTION ) )
+                        {
+                            if ( checkString( pattern, at.getDescription() ) )
+                            {
+                                searchResults.add( at );
+                                continue;
+                            }
+                        }
+
+                        // Superior
+                        if ( searchScope.contains( SearchInEnum.SUPERIOR ) )
+                        {
+                            if ( checkString( pattern, at.getSuperiorName() ) )
+                            {
+                                searchResults.add( at );
+                                continue;
+                            }
+                        }
+
+                        // Syntax
+                        if ( searchScope.contains( SearchInEnum.SYNTAX ) )
+                        {
+                            if ( checkString( pattern, at.getSyntaxOid() ) )
+                            {
+                                searchResults.add( at );
+                                continue;
+                            }
+                        }
+
+                        // Matching Rules
+                        if ( searchScope.contains( SearchInEnum.MATCHING_RULES ) )
+                        {
+                            // Equality
+                            if ( checkString( pattern, at.getEqualityName() ) )
+                            {
+                                searchResults.add( at );
+                                continue;
+                            }
+
+                            // Ordering
+                            if ( checkString( pattern, at.getOrderingName() ) )
+                            {
+                                searchResults.add( at );
+                                continue;
+                            }
+
+                            // Substring
+                            if ( checkString( pattern, at.getSubstrName() ) )
+                            {
+                                searchResults.add( at );
+                                continue;
+                            }
+                        }
+                    }
+                }
+
+                if ( ( scope == PluginConstants.PREFS_SEARCH_PAGE_SCOPE_AT_AND_OC )
+                    || ( scope == PluginConstants.PREFS_SEARCH_PAGE_SCOPE_OC_ONLY ) )
+                {
+                    // Looping on object classes
+                    List<ObjectClassImpl> objectClasses = schemaHandler.getObjectClasses();
+                    for ( ObjectClassImpl oc : objectClasses )
+                    {
+                        // Aliases
+                        if ( searchScope.contains( SearchInEnum.ALIASES ) )
+                        {
+                            if ( checkArray( pattern, oc.getNames() ) )
+                            {
+                                searchResults.add( oc );
+                                continue;
+                            }
+                        }
+
+                        // OID
+                        if ( searchScope.contains( SearchInEnum.OID ) )
+                        {
+                            if ( checkString( pattern, oc.getOid() ) )
+                            {
+                                searchResults.add( oc );
+                                continue;
+                            }
+                        }
+
+                        // Description
+                        if ( searchScope.contains( SearchInEnum.DESCRIPTION ) )
+                        {
+                            if ( checkString( pattern, oc.getDescription() ) )
+                            {
+                                searchResults.add( oc );
+                                continue;
+                            }
+                        }
+
+                        // Superiors
+                        if ( searchScope.contains( SearchInEnum.SUPERIORS ) )
+                        {
+                            if ( checkArray( pattern, oc.getSuperClassesNames() ) )
+                            {
+                                searchResults.add( oc );
+                                continue;
+                            }
+                        }
+
+                        // Mandatory Attributes
+                        if ( searchScope.contains( SearchInEnum.MANDATORY_ATTRIBUTES ) )
+                        {
+                            if ( checkArray( pattern, oc.getMustNamesList() ) )
+                            {
+                                searchResults.add( oc );
+                                continue;
+                            }
+                        }
+
+                        // Optional Attributes
+                        if ( searchScope.contains( SearchInEnum.OPTIONAL_ATTRIBUTES ) )
+                        {
+                            if ( checkArray( pattern, oc.getMayNamesList() ) )
+                            {
+                                searchResults.add( oc );
+                                continue;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+        return searchResults;
+    }
+
+
+    /**
+     * Check an array with the given pattern.
+     *
+     * @param pattern
+     *      the Regex pattern
+     * @param array
+     *      the array
+     * @return
+     *      true if the pattern matches one of the aliases, false, if not.
+     */
+    private boolean checkArray( Pattern pattern, String[] array )
+    {
+        if ( array != null )
+        {
+            for ( String string : array )
+            {
+                return pattern.matcher( string ).matches();
+
+            }
+        }
+
+        return false;
+    }
+
+
+    private boolean checkString( Pattern pattern, String string )
+    {
+        if ( string != null )
+        {
+            return pattern.matcher( string ).matches();
+        }
+
+        return false;
+    }
+
+
+    /**
+     * Launches the search from the search fields views.
+     */
+    private void search()
+    {
+        String searchString = searchField.getText();
+        List<SearchInEnum> searchScope = SearchPage.loadSearchIn();
+
+        setSearchInput( searchString, searchScope.toArray( new SearchInEnum[0] ), SearchPage.loadScope() );
+    }
+
+
+    /**
+     * Refresh the overview label with the number of results.
+     *
+     * @param searchString
+     *      the search String
+     * @param resultsCount
+     *      the number of results
+     */
+    public void setSearchResultsLabel( String searchString, int resultsCount )
+    {
+        StringBuffer sb = new StringBuffer();
+
+        if ( searchString == null )
+        {
+            sb.append( "No search" );
+        }
+        else
+        {
+            // Search String
+            sb.append( "'" + searchString + "'" );
+            sb.append( " - " );
+
+            // Search results count
+            sb.append( resultsCount );
+            sb.append( " " );
+            if ( resultsCount > 1 )
+            {
+                sb.append( "matches" );
+            }
+            else
+            {
+                sb.append( "match" );
+            }
+
+            sb.append( " in workspace" );
+        }
+
+        searchResultsLabel.setText( sb.toString() );
+    }
+
+
+    /**
+     * Runs the current search again.
+     */
+    public void runCurrentSearchAgain()
+    {
+        if ( searchString != null )
+        {
+            setSearchInput( searchString, SearchPage.loadSearchIn().toArray( new SearchInEnum[0] ), SearchPage
+                .loadScope() );
+        }
+    }
+
+
+    /**
+     * Gets the Search String.
+     *
+     * @return
+     *      the Search String or null if no Search String is set.
+     */
+    public String getSearchString()
+    {
+        return searchString;
+    }
+
+
+    /**
+     * Refreshes the view.
+     */
+    public void refresh()
+    {
+        resultsTableViewer.refresh();
+    }
+}

Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchView.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchViewContentProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchViewContentProvider.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchViewContentProvider.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchViewContentProvider.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,344 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.schemaeditor.view.views;
+
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.apache.directory.shared.ldap.schema.SchemaObject;
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.apache.directory.studio.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.schemaeditor.model.ObjectClassImpl;
+import org.apache.directory.studio.schemaeditor.view.wrappers.ObjectClassWrapper;
+import org.apache.directory.studio.schemaeditor.view.wrappers.TreeNode;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+
+/**
+ * This class implements the ContentProvider for the SchemaView.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SearchViewContentProvider implements IStructuredContentProvider, ITreeContentProvider
+{
+    /** The preferences store */
+    private IPreferenceStore store;
+
+    /** The FirstName Sorter */
+    private Comparator<SchemaObject> firstNameSorter;
+
+    /** The OID Sorter */
+    private Comparator<SchemaObject> oidSorter;
+
+
+    /**
+     * Creates a new instance of DifferencesWidgetSchemaContentProvider.
+     */
+    public SearchViewContentProvider()
+    {
+        store = Activator.getDefault().getPreferenceStore();
+
+        firstNameSorter = new Comparator<SchemaObject>()
+        {
+            public int compare( SchemaObject o1, SchemaObject o2 )
+            {
+                String[] o1Names = null;
+                String[] o2Names = null;
+
+                if ( ( o1 instanceof AttributeTypeImpl ) && ( o2 instanceof AttributeTypeImpl ) )
+                {
+                    AttributeTypeImpl at1 = ( AttributeTypeImpl ) o1;
+                    AttributeTypeImpl at2 = ( AttributeTypeImpl ) o2;
+
+                    o1Names = at1.getNames();
+                    o2Names = at2.getNames();
+                }
+                else if ( ( o1 instanceof ObjectClassImpl ) && ( o2 instanceof ObjectClassImpl ) )
+                {
+                    ObjectClassImpl oc1 = ( ObjectClassImpl ) o1;
+                    ObjectClassImpl oc2 = ( ObjectClassImpl ) o2;
+
+                    o1Names = oc1.getNames();
+                    o2Names = oc2.getNames();
+                }
+                else if ( ( o1 instanceof AttributeTypeImpl ) && ( o2 instanceof ObjectClassImpl ) )
+                {
+                    AttributeTypeImpl at = ( AttributeTypeImpl ) o1;
+                    ObjectClassImpl oc = ( ObjectClassImpl ) o2;
+
+                    o1Names = at.getNames();
+                    o2Names = oc.getNames();
+                }
+                else if ( ( o1 instanceof ObjectClassImpl ) && ( o2 instanceof AttributeTypeImpl ) )
+                {
+                    ObjectClassImpl oc = ( ObjectClassImpl ) o1;
+                    AttributeTypeImpl at = ( AttributeTypeImpl ) o2;
+
+                    o1Names = oc.getNames();
+                    o2Names = at.getNames();
+                }
+
+                // Comparing the First Name
+                if ( ( o1Names != null ) && ( o2Names != null ) )
+                {
+                    if ( ( o1Names.length > 0 ) && ( o2Names.length > 0 ) )
+                    {
+                        return o1Names[0].compareToIgnoreCase( o2Names[0] );
+                    }
+                    else if ( ( o1Names.length == 0 ) && ( o2Names.length > 0 ) )
+                    {
+                        return "".compareToIgnoreCase( o2Names[0] );
+                    }
+                    else if ( ( o1Names.length > 0 ) && ( o2Names.length == 0 ) )
+                    {
+                        return o1Names[0].compareToIgnoreCase( "" );
+                    }
+                }
+
+                // Default
+                return o1.toString().compareToIgnoreCase( o2.toString() );
+            }
+        };
+
+        oidSorter = new Comparator<SchemaObject>()
+        {
+            public int compare( SchemaObject o1, SchemaObject o2 )
+            {
+                if ( ( o1 instanceof AttributeTypeImpl ) && ( o2 instanceof AttributeTypeImpl ) )
+                {
+                    AttributeTypeImpl at1 = ( AttributeTypeImpl ) o1;
+                    AttributeTypeImpl at2 = ( AttributeTypeImpl ) o2;
+
+                    return at1.getOid().compareToIgnoreCase( at2.getOid() );
+                }
+                else if ( ( o1 instanceof ObjectClassImpl ) && ( o2 instanceof ObjectClassImpl ) )
+                {
+                    ObjectClassImpl oc1 = ( ObjectClassImpl ) o1;
+                    ObjectClassImpl oc2 = ( ObjectClassImpl ) o2;
+
+                    return oc1.getOid().compareToIgnoreCase( oc2.getOid() );
+                }
+                else if ( ( o1 instanceof AttributeTypeImpl ) && ( o2 instanceof ObjectClassImpl ) )
+                {
+                    AttributeTypeImpl at = ( AttributeTypeImpl ) o1;
+                    ObjectClassImpl oc = ( ObjectClassImpl ) o2;
+
+                    return at.getOid().compareToIgnoreCase( oc.getOid() );
+                }
+                else if ( ( o1 instanceof ObjectClassWrapper ) && ( o2 instanceof AttributeTypeImpl ) )
+                {
+                    ObjectClassImpl oc = ( ObjectClassImpl ) o1;
+                    AttributeTypeImpl at = ( AttributeTypeImpl ) o2;
+
+                    return oc.getOid().compareToIgnoreCase( at.getOid() );
+                }
+
+                // Default
+                return o1.toString().compareToIgnoreCase( o2.toString() );
+            }
+        };
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+     */
+    public Object[] getElements( Object inputElement )
+    {
+        return getChildren( inputElement );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+     */
+    public void dispose()
+    {
+        // Nothing to do
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+     */
+    public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
+    {
+        // Nothing to do
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
+     */
+    @SuppressWarnings("unchecked")
+    public Object[] getChildren( Object parentElement )
+    {
+        List<SchemaObject> children = new ArrayList<SchemaObject>();
+
+        int group = store.getInt( PluginConstants.PREFS_SEARCH_VIEW_GROUPING );
+        int sortBy = store.getInt( PluginConstants.PREFS_SEARCH_VIEW_SORTING_BY );
+        int sortOrder = store.getInt( PluginConstants.PREFS_SEARCH_VIEW_SORTING_ORDER );
+
+        if ( parentElement instanceof List )
+        {
+            List<SchemaObject> searchResults = ( List<SchemaObject> ) parentElement;
+
+            if ( group == PluginConstants.PREFS_SEARCH_VIEW_GROUPING_ATTRIBUTE_TYPES_FIRST )
+            {
+                List<AttributeTypeImpl> attributeTypes = new ArrayList<AttributeTypeImpl>();
+                List<ObjectClassImpl> objectClasses = new ArrayList<ObjectClassImpl>();
+
+                for ( SchemaObject searchResult : searchResults )
+                {
+                    if ( searchResult instanceof AttributeTypeImpl )
+                    {
+                        attributeTypes.add( ( AttributeTypeImpl ) searchResult );
+                    }
+                    else if ( searchResult instanceof ObjectClassImpl )
+                    {
+                        objectClasses.add( ( ObjectClassImpl ) searchResult );
+                    }
+                }
+
+                // Sort by
+                if ( sortBy == PluginConstants.PREFS_SEARCH_VIEW_SORTING_BY_FIRSTNAME )
+                {
+                    Collections.sort( attributeTypes, firstNameSorter );
+                    Collections.sort( objectClasses, firstNameSorter );
+                }
+                else if ( sortBy == PluginConstants.PREFS_SEARCH_VIEW_SORTING_BY_OID )
+                {
+                    Collections.sort( attributeTypes, oidSorter );
+                    Collections.sort( objectClasses, oidSorter );
+                }
+
+                // Sort Order
+                if ( sortOrder == PluginConstants.PREFS_SEARCH_VIEW_SORTING_ORDER_DESCENDING )
+                {
+                    Collections.reverse( attributeTypes );
+                    Collections.reverse( objectClasses );
+                }
+
+                children.addAll( attributeTypes );
+                children.addAll( objectClasses );
+            }
+            else if ( group == PluginConstants.PREFS_SEARCH_VIEW_GROUPING_OBJECT_CLASSES_FIRST )
+            {
+                List<AttributeTypeImpl> attributeTypes = new ArrayList<AttributeTypeImpl>();
+                List<ObjectClassImpl> objectClasses = new ArrayList<ObjectClassImpl>();
+
+                for ( SchemaObject searchResult : searchResults )
+                {
+                    if ( searchResult instanceof AttributeTypeImpl )
+                    {
+                        attributeTypes.add( ( AttributeTypeImpl ) searchResult );
+                    }
+                    else if ( searchResult instanceof ObjectClassImpl )
+                    {
+                        objectClasses.add( ( ObjectClassImpl ) searchResult );
+                    }
+                }
+
+                // Sort by
+                if ( sortBy == PluginConstants.PREFS_SEARCH_VIEW_SORTING_BY_FIRSTNAME )
+                {
+                    Collections.sort( attributeTypes, firstNameSorter );
+                    Collections.sort( objectClasses, firstNameSorter );
+                }
+                else if ( sortBy == PluginConstants.PREFS_SEARCH_VIEW_SORTING_BY_OID )
+                {
+                    Collections.sort( attributeTypes, oidSorter );
+                    Collections.sort( objectClasses, oidSorter );
+                }
+
+                // Sort Order
+                if ( sortOrder == PluginConstants.PREFS_SEARCH_VIEW_SORTING_ORDER_DESCENDING )
+                {
+                    Collections.reverse( attributeTypes );
+                    Collections.reverse( objectClasses );
+                }
+
+                children.addAll( objectClasses );
+                children.addAll( attributeTypes );
+            }
+            else if ( group == PluginConstants.PREFS_SEARCH_VIEW_GROUPING_MIXED )
+            {
+                children.addAll( searchResults );
+
+                // Sort by
+                if ( sortBy == PluginConstants.PREFS_SEARCH_VIEW_SORTING_BY_FIRSTNAME )
+                {
+                    Collections.sort( children, firstNameSorter );
+                }
+                else if ( sortBy == PluginConstants.PREFS_SEARCH_VIEW_SORTING_BY_OID )
+                {
+                    Collections.sort( children, oidSorter );
+                }
+
+                // Sort Order
+                if ( sortOrder == PluginConstants.PREFS_SEARCH_VIEW_SORTING_ORDER_DESCENDING )
+                {
+                    Collections.reverse( children );
+                }
+            }
+        }
+
+        return children.toArray();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
+     */
+    public Object getParent( Object element )
+    {
+
+        if ( element instanceof TreeNode )
+        {
+            return ( ( TreeNode ) element ).getParent();
+        }
+
+        // Default
+        return null;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
+     */
+    public boolean hasChildren( Object element )
+    {
+        if ( element instanceof TreeNode )
+        {
+            return ( ( TreeNode ) element ).hasChildren();
+        }
+
+        // Default
+        return false;
+    }
+}

Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchViewContentProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchViewLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchViewLabelProvider.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchViewLabelProvider.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchViewLabelProvider.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,296 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.schemaeditor.view.views;
+
+
+import org.apache.directory.shared.ldap.schema.SchemaObject;
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.apache.directory.studio.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.schemaeditor.model.ObjectClassImpl;
+import org.apache.directory.studio.schemaeditor.view.ViewUtils;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class implements the LabelProvider for the SearchView.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SearchViewLabelProvider extends LabelProvider
+{
+    private static final String NONE = "(None)";
+
+    /** The preferences store */
+    private IPreferenceStore store;
+
+
+    /**
+     * Creates a new instance of DifferencesWidgetSchemaLabelProvider.
+     */
+    public SearchViewLabelProvider()
+    {
+        store = Activator.getDefault().getPreferenceStore();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+     */
+    public String getText( Object element )
+    {
+        String label = ""; //$NON-NLS-1$
+
+        int labelValue = store.getInt( PluginConstants.PREFS_SEARCH_VIEW_LABEL );
+        boolean abbreviate = store.getBoolean( PluginConstants.PREFS_SEARCH_VIEW_ABBREVIATE );
+        int abbreviateMaxLength = store.getInt( PluginConstants.PREFS_SEARCH_VIEW_ABBREVIATE_MAX_LENGTH );
+        boolean secondaryLabelDisplay = store.getBoolean( PluginConstants.PREFS_SEARCH_VIEW_SECONDARY_LABEL_DISPLAY );
+        int secondaryLabelValue = store.getInt( PluginConstants.PREFS_SEARCH_VIEW_SECONDARY_LABEL );
+        boolean secondaryLabelAbbreviate = store
+            .getBoolean( PluginConstants.PREFS_SEARCH_VIEW_SECONDARY_LABEL_ABBREVIATE );
+        int secondaryLabelAbbreviateMaxLength = store
+            .getInt( PluginConstants.PREFS_SEARCH_VIEW_SECONDARY_LABEL_ABBREVIATE_MAX_LENGTH );
+        boolean schemaLabelDisplay = store.getBoolean( PluginConstants.PREFS_SEARCH_VIEW_SCHEMA_LABEL_DISPLAY );
+
+        if ( element instanceof AttributeTypeImpl )
+        {
+            AttributeTypeImpl at = ( AttributeTypeImpl ) element;
+
+            // Label
+            if ( labelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_FIRST_NAME )
+            {
+                String[] names = at.getNames();
+                if ( ( names != null ) && ( names.length > 0 ) )
+                {
+                    label = names[0];
+                }
+                else
+                {
+                    label = NONE;
+                }
+            }
+            else if ( labelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_ALL_ALIASES )
+            {
+                String[] names = at.getNames();
+                if ( ( names != null ) && ( names.length > 0 ) )
+                {
+                    label = ViewUtils.concateAliases( names );
+                }
+                else
+                {
+                    label = NONE;
+                }
+            }
+            else if ( labelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_OID )
+            {
+                label = at.getOid();
+            }
+            else
+            // Default
+            {
+                String[] names = at.getNames();
+                if ( ( names != null ) && ( names.length > 0 ) )
+                {
+                    label = names[0];
+                }
+                else
+                {
+                    label = NONE;
+                }
+            }
+
+            // Abbreviate
+            if ( abbreviate && ( abbreviateMaxLength < label.length() ) )
+            {
+                label = label.substring( 0, abbreviateMaxLength ) + "..."; //$NON-NLS-1$
+            }
+        }
+        else if ( element instanceof ObjectClassImpl )
+        {
+            ObjectClassImpl oc = ( ObjectClassImpl ) element;
+
+            // Label
+            if ( labelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_FIRST_NAME )
+            {
+                String[] names = oc.getNames();
+                if ( ( names != null ) && ( names.length > 0 ) )
+                {
+                    label = names[0];
+                }
+                else
+                {
+                    label = NONE;
+                }
+            }
+            else if ( labelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_ALL_ALIASES )
+            {
+                String[] names = oc.getNames();
+                if ( ( names != null ) && ( names.length > 0 ) )
+                {
+                    label = ViewUtils.concateAliases( names );
+                }
+                else
+                {
+                    label = NONE;
+                }
+            }
+            else if ( labelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_OID )
+            {
+                label = oc.getOid();
+            }
+            else
+            // Default
+            {
+                String[] names = oc.getNames();
+                if ( ( names != null ) && ( names.length > 0 ) )
+                {
+                    label = names[0];
+                }
+                else
+                {
+                    label = NONE;
+                }
+            }
+
+            // Abbreviate
+            if ( abbreviate && ( abbreviateMaxLength < label.length() ) )
+            {
+                label = label.substring( 0, abbreviateMaxLength ) + "..."; //$NON-NLS-1$
+            }
+        }
+
+        // Secondary Label
+        if ( secondaryLabelDisplay )
+        {
+            String secondaryLabel = ""; //$NON-NLS-1$
+            if ( element instanceof AttributeTypeImpl )
+            {
+                AttributeTypeImpl at = ( AttributeTypeImpl ) element;
+
+                if ( secondaryLabelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_FIRST_NAME )
+                {
+                    String[] names = at.getNames();
+                    if ( ( names != null ) && ( names.length > 0 ) )
+                    {
+                        secondaryLabel = names[0];
+                    }
+                    else
+                    {
+                        secondaryLabel = NONE;
+                    }
+                }
+                else if ( secondaryLabelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_ALL_ALIASES )
+                {
+                    String[] names = at.getNames();
+                    if ( ( names != null ) && ( names.length > 0 ) )
+                    {
+                        secondaryLabel = ViewUtils.concateAliases( names );
+                    }
+                    else
+                    {
+                        secondaryLabel = NONE;
+                    }
+                }
+                else if ( secondaryLabelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_OID )
+                {
+                    secondaryLabel = at.getOid();
+                }
+            }
+            else if ( element instanceof ObjectClassImpl )
+            {
+                ObjectClassImpl oc = ( ObjectClassImpl ) element;
+
+                if ( secondaryLabelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_FIRST_NAME )
+                {
+                    String[] names = oc.getNames();
+                    if ( ( names != null ) && ( names.length > 0 ) )
+                    {
+                        secondaryLabel = names[0];
+                    }
+                    else
+                    {
+                        secondaryLabel = NONE;
+                    }
+                }
+                else if ( secondaryLabelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_ALL_ALIASES )
+                {
+                    String[] names = oc.getNames();
+                    if ( ( names != null ) && ( names.length > 0 ) )
+                    {
+                        secondaryLabel = ViewUtils.concateAliases( names );
+                    }
+                    else
+                    {
+                        secondaryLabel = NONE;
+                    }
+                }
+                else if ( secondaryLabelValue == PluginConstants.PREFS_SEARCH_VIEW_LABEL_OID )
+                {
+                    secondaryLabel = oc.getOid();
+                }
+            }
+
+            if ( secondaryLabelAbbreviate && ( secondaryLabelAbbreviateMaxLength < secondaryLabel.length() ) )
+            {
+                secondaryLabel = secondaryLabel.substring( 0, secondaryLabelAbbreviateMaxLength ) + "..."; //$NON-NLS-1$
+            }
+
+            label += "  [" + secondaryLabel + "]"; //$NON-NLS-1$ //$NON-NLS-2$
+        }
+
+        // Schema Label
+        if ( schemaLabelDisplay )
+        {
+            if ( element instanceof SchemaObject )
+            {
+                SchemaObject object = ( SchemaObject ) element;
+
+                label += " from schema \"" + object.getSchema() + "\""; //$NON-NLS-1$ //$NON-NLS-2$
+            }
+        }
+
+        return label;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
+     */
+    public Image getImage( Object element )
+    {
+        if ( element instanceof AttributeTypeImpl )
+        {
+            return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, PluginConstants.IMG_ATTRIBUTE_TYPE )
+                .createImage();
+        }
+        else if ( element instanceof ObjectClassImpl )
+        {
+            return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, PluginConstants.IMG_OBJECT_CLASS )
+                .createImage();
+        }
+
+        // Default
+        return null;
+    }
+}

Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchViewLabelProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchViewSortingDialog.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchViewSortingDialog.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchViewSortingDialog.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchViewSortingDialog.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,254 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.schemaeditor.view.views;
+
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+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.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * This class implements the SearchView Sorting Dialog.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SearchViewSortingDialog extends Dialog
+{
+    /** The title of the dialog */
+    private static final String DIALOG_TITLE = "Search View Sorting";
+
+    /** The Sorting First Name category */
+    private static final String SORTING_FISTNAME = "First Name";
+
+    /** The Sorting OID category */
+    private static final String SORTING_OID = "OID";
+
+    // UI Fields
+    private Button attributeTypesFirst;
+    private Button objectClassesFirst;
+    private Button mixedButton;
+    private Combo sortingCombo;
+    private Button ascendingButton;
+    private Button descendingButton;
+
+
+    /**
+     * Creates a new instance of SearchViewSortingDialog.
+     *
+     * @param parentShell
+     *      the parent shell
+     */
+    public SearchViewSortingDialog( Shell parentShell )
+    {
+        super( parentShell );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+     */
+    protected void configureShell( Shell newShell )
+    {
+        super.configureShell( newShell );
+        newShell.setText( DIALOG_TITLE );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+     */
+    protected Control createDialogArea( Composite parent )
+    {
+        Composite composite = ( Composite ) super.createDialogArea( parent );
+        GridData gd = new GridData( SWT.FILL, SWT.FILL, true, true );
+        composite.setLayoutData( gd );
+
+        // Grouping Group
+        Group groupingGroup = new Group( composite, SWT.NONE );
+        groupingGroup.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
+        groupingGroup.setText( "Grouping" );
+        groupingGroup.setLayout( new GridLayout() );
+
+        // Attribute Types first Button
+        attributeTypesFirst = new Button( groupingGroup, SWT.RADIO );
+        attributeTypesFirst.setText( "Display attribute types first" );
+        attributeTypesFirst.setEnabled( true );
+
+        // Object Classes first Button
+        objectClassesFirst = new Button( groupingGroup, SWT.RADIO );
+        objectClassesFirst.setText( "Display object classes first" );
+        objectClassesFirst.setEnabled( true );
+
+        // Mixed Button
+        mixedButton = new Button( groupingGroup, SWT.RADIO );
+        mixedButton.setText( "Mixed" );
+        mixedButton.setEnabled( true );
+
+        // Sorting Group
+        Group sortingGroup = new Group( composite, SWT.NONE );
+        sortingGroup.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
+        sortingGroup.setText( "Sorting" );
+        sortingGroup.setLayout( new GridLayout() );
+        Composite sortingGroupComposite = new Composite( sortingGroup, SWT.NONE );
+        GridLayout gl = new GridLayout( 4, false );
+        gl.marginHeight = gl.marginWidth = 0;
+        sortingGroupComposite.setLayout( gl );
+        sortingGroupComposite.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+        // Sort by Label
+        Label sortByLabel = new Label( sortingGroupComposite, SWT.NONE );
+        sortByLabel.setText( "Sort by" );
+
+        // Sorting Combo
+        sortingCombo = new Combo( sortingGroupComposite, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER );
+        sortingCombo.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        sortingCombo.setItems( new String[]
+            { SORTING_FISTNAME, SORTING_OID } );
+        sortingCombo.setEnabled( true );
+
+        // Ascending Button
+        ascendingButton = new Button( sortingGroupComposite, SWT.RADIO );
+        ascendingButton.setText( "Ascending" );
+        ascendingButton.setEnabled( true );
+
+        // Descending Button
+        descendingButton = new Button( sortingGroupComposite, SWT.RADIO );
+        descendingButton.setText( "Descending" );
+        descendingButton.setEnabled( true );
+
+        initFieldsFromPreferences();
+
+        applyDialogFont( composite );
+        return composite;
+    }
+
+
+    /**
+     * Initializes the fields for the stored preferences.
+     */
+    private void initFieldsFromPreferences()
+    {
+        IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+
+        int grouping = store.getInt( PluginConstants.PREFS_SEARCH_VIEW_GROUPING );
+        if ( grouping == PluginConstants.PREFS_SEARCH_VIEW_GROUPING_ATTRIBUTE_TYPES_FIRST )
+        {
+            attributeTypesFirst.setSelection( true );
+        }
+        else if ( grouping == PluginConstants.PREFS_SEARCH_VIEW_GROUPING_OBJECT_CLASSES_FIRST )
+        {
+            objectClassesFirst.setSelection( true );
+        }
+        else if ( grouping == PluginConstants.PREFS_SEARCH_VIEW_GROUPING_MIXED )
+        {
+            mixedButton.setSelection( true );
+        }
+
+        int sortingBy = store.getInt( PluginConstants.PREFS_SEARCH_VIEW_SORTING_BY );
+        if ( sortingBy == PluginConstants.PREFS_SEARCH_VIEW_SORTING_BY_FIRSTNAME )
+        {
+            sortingCombo.select( 0 );
+        }
+        else if ( sortingBy == PluginConstants.PREFS_SEARCH_VIEW_SORTING_BY_OID )
+        {
+            sortingCombo.select( 1 );
+        }
+
+        int sortingOrder = store.getInt( PluginConstants.PREFS_SEARCH_VIEW_SORTING_ORDER );
+        if ( sortingOrder == PluginConstants.PREFS_SEARCH_VIEW_SORTING_ORDER_ASCENDING )
+        {
+            ascendingButton.setSelection( true );
+        }
+        else if ( sortingOrder == PluginConstants.PREFS_SEARCH_VIEW_SORTING_ORDER_DESCENDING )
+        {
+            descendingButton.setSelection( true );
+        }
+
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
+     */
+    protected void buttonPressed( int buttonId )
+    {
+        if ( buttonId == IDialogConstants.OK_ID )
+        {
+            IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+            if ( ( attributeTypesFirst.getSelection() ) && ( !objectClassesFirst.getSelection() )
+                && ( !mixedButton.getSelection() ) )
+            {
+                store.setValue( PluginConstants.PREFS_SEARCH_VIEW_GROUPING,
+                    PluginConstants.PREFS_SEARCH_VIEW_GROUPING_ATTRIBUTE_TYPES_FIRST );
+            }
+            else if ( ( !attributeTypesFirst.getSelection() ) && ( objectClassesFirst.getSelection() )
+                && ( !mixedButton.getSelection() ) )
+            {
+                store.setValue( PluginConstants.PREFS_SEARCH_VIEW_GROUPING,
+                    PluginConstants.PREFS_SEARCH_VIEW_GROUPING_OBJECT_CLASSES_FIRST );
+            }
+            else if ( ( !attributeTypesFirst.getSelection() ) && ( !objectClassesFirst.getSelection() )
+                && ( mixedButton.getSelection() ) )
+            {
+                store.setValue( PluginConstants.PREFS_SEARCH_VIEW_GROUPING,
+                    PluginConstants.PREFS_SEARCH_VIEW_GROUPING_MIXED );
+            }
+
+            if ( sortingCombo.getItem( sortingCombo.getSelectionIndex() ).equals( SORTING_FISTNAME ) )
+            {
+                store.setValue( PluginConstants.PREFS_SEARCH_VIEW_SORTING_BY,
+                    PluginConstants.PREFS_SEARCH_VIEW_SORTING_BY_FIRSTNAME );
+            }
+            else if ( sortingCombo.getItem( sortingCombo.getSelectionIndex() ).equals( SORTING_OID ) )
+            {
+                store.setValue( PluginConstants.PREFS_SEARCH_VIEW_SORTING_BY,
+                    PluginConstants.PREFS_SEARCH_VIEW_SORTING_BY_OID );
+            }
+
+            if ( ascendingButton.getSelection() && !descendingButton.getSelection() )
+            {
+                store.setValue( PluginConstants.PREFS_SEARCH_VIEW_SORTING_ORDER,
+                    PluginConstants.PREFS_SEARCH_VIEW_SORTING_ORDER_ASCENDING );
+            }
+            else if ( !ascendingButton.getSelection() && descendingButton.getSelection() )
+            {
+                store.setValue( PluginConstants.PREFS_SEARCH_VIEW_SORTING_ORDER,
+                    PluginConstants.PREFS_SEARCH_VIEW_SORTING_ORDER_DESCENDING );
+            }
+        }
+
+        super.buttonPressed( buttonId );
+    }
+}

Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchViewSortingDialog.java
------------------------------------------------------------------------------
    svn:eol-style = native