directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r576784 - in /directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor: ./ controller/actions/ view/dialogs/ view/search/ view/views/
Date Tue, 18 Sep 2007 09:04:19 GMT
Author: pamarcelot
Date: Tue Sep 18 02:04:18 2007
New Revision: 576784

URL: http://svn.apache.org/viewvc?rev=576784&view=rev
Log:
Fix for DIRSTUDIO-199 (Add scopes for OC and AT in search).

Modified:
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PluginConstants.java
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ShowSearchHistoryAction.java
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/PreviousSearchesDialog.java
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/search/SearchPage.java
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchView.java

Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PluginConstants.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PluginConstants.java?rev=576784&r1=576783&r2=576784&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PluginConstants.java (original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PluginConstants.java Tue Sep 18 02:04:18 2007
@@ -242,32 +242,41 @@
     /** The preference ID for Search History of the SearchPage */
     public static final String PREFS_SEARCH_PAGE_SEARCH_HISTORY = Activator.PLUGIN_ID
         + ".preferences.SearchPage.searchHistory"; //$NON-NLS-1$
-    /** The preference ID for Search Scope 'Aliases' of the SearchPage */
-    public static final String PREFS_SEARCH_PAGE_SCOPE_ALIASES = Activator.PLUGIN_ID
+    /** The preference ID for Search In 'Aliases' of the SearchPage */
+    public static final String PREFS_SEARCH_PAGE_SEARCH_IN_ALIASES = Activator.PLUGIN_ID
         + ".preferences.SearchPage.scopeAliases"; //$NON-NLS-1$
-    /** The preference ID for Search Scope 'OID' of the SearchPage */
-    public static final String PREFS_SEARCH_PAGE_SCOPE_OID = Activator.PLUGIN_ID + ".preferences.SearchPage.scopeOid"; //$NON-NLS-1$
-    /** The preference ID for Search Scope 'Description' of the SearchPage */
-    public static final String PREFS_SEARCH_PAGE_SCOPE_DESCRIPTION = Activator.PLUGIN_ID
+    /** The preference ID for Search In 'OID' of the SearchPage */
+    public static final String PREFS_SEARCH_PAGE_SEARCH_IN_OID = Activator.PLUGIN_ID + ".preferences.SearchPage.scopeOid"; //$NON-NLS-1$
+    /** The preference ID for Search In 'Description' of the SearchPage */
+    public static final String PREFS_SEARCH_PAGE_SEARCH_IN_DESCRIPTION = Activator.PLUGIN_ID
         + ".preferences.SearchPage.scopeDescription"; //$NON-NLS-1$
-    /** The preference ID for Search Scope 'Superior' of the SearchPage */
-    public static final String PREFS_SEARCH_PAGE_SCOPE_SUPERIOR = Activator.PLUGIN_ID
+    /** The preference ID for Search In 'Superior' of the SearchPage */
+    public static final String PREFS_SEARCH_PAGE_SEARCH_IN_SUPERIOR = Activator.PLUGIN_ID
         + ".preferences.SearchPage.scopeSuperior"; //$NON-NLS-1$
-    /** The preference ID for Search Scope 'Syntax' of the SearchPage */
-    public static final String PREFS_SEARCH_PAGE_SCOPE_SYNTAX = Activator.PLUGIN_ID
+    /** The preference ID for Search In 'Syntax' of the SearchPage */
+    public static final String PREFS_SEARCH_PAGE_SEARCH_IN_SYNTAX = Activator.PLUGIN_ID
         + ".preferences.SearchPage.scopeSyntax"; //$NON-NLS-1$
-    /** The preference ID for Search Scope 'Matching Rules' of the SearchPage */
-    public static final String PREFS_SEARCH_PAGE_SCOPE_MATCHING_RULES = Activator.PLUGIN_ID
+    /** The preference ID for Search In 'Matching Rules' of the SearchPage */
+    public static final String PREFS_SEARCH_PAGE_SEARCH_IN_MATCHING_RULES = Activator.PLUGIN_ID
         + ".preferences.SearchPage.scopeMatchingRules"; //$NON-NLS-1$
-    /** The preference ID for Search Scope 'Superiors' of the SearchPage */
-    public static final String PREFS_SEARCH_PAGE_SCOPE_SUPERIORS = Activator.PLUGIN_ID
+    /** The preference ID for Search In 'Superiors' of the SearchPage */
+    public static final String PREFS_SEARCH_PAGE_SEARCH_IN_SUPERIORS = Activator.PLUGIN_ID
         + ".preferences.SearchPage.scopeSuperiors"; //$NON-NLS-1$
-    /** The preference ID for Search Scope 'Mandatory Attributes' of the SearchPage */
-    public static final String PREFS_SEARCH_PAGE_SCOPE_MANDATORY_ATTRIBUTES = Activator.PLUGIN_ID
+    /** The preference ID for Search In 'Mandatory Attributes' of the SearchPage */
+    public static final String PREFS_SEARCH_PAGE_SEARCH_IN_MANDATORY_ATTRIBUTES = Activator.PLUGIN_ID
         + ".preferences.SearchPage.scopeMandatoryAttributes"; //$NON-NLS-1$
-    /** The preference ID for Search Scope 'Optional Attributes' of the SearchPage */
-    public static final String PREFS_SEARCH_PAGE_SCOPE_OPTIONAL_ATTRIBUTES = Activator.PLUGIN_ID
+    /** The preference ID for Search In 'Optional Attributes' of the SearchPage */
+    public static final String PREFS_SEARCH_PAGE_SEARCH_IN_OPTIONAL_ATTRIBUTES = Activator.PLUGIN_ID
         + ".preferences.SearchPage.scopeOptionalAttributes"; //$NON-NLS-1$
+    /** The preference ID for Scope of the SearchPage */
+    public static final String PREFS_SEARCH_PAGE_SCOPE = Activator.PLUGIN_ID
+    + ".preferences.SearchPage.scope"; //$NON-NLS-1$
+    /** The preference value for Scope Attribute Types And Object Classes of the SearchPage */
+    public static final int PREFS_SEARCH_PAGE_SCOPE_AT_AND_OC = 0;
+    /** The preference value for Scope Attribute Types only of the SearchPage */
+    public static final int PREFS_SEARCH_PAGE_SCOPE_AT_ONLY = 1;
+    /** The preference value for Scope Object Classes only of the SearchPage */
+    public static final int PREFS_SEARCH_PAGE_SCOPE_OC_ONLY = 2;
 
     // Preferences - SearchView
     /** The preference ID for Search View Label */

Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ShowSearchHistoryAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ShowSearchHistoryAction.java?rev=576784&r1=576783&r2=576784&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ShowSearchHistoryAction.java (original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/ShowSearchHistoryAction.java Tue Sep 18 02:04:18 2007
@@ -24,7 +24,7 @@
 import org.apache.directory.studio.schemaeditor.PluginConstants;
 import org.apache.directory.studio.schemaeditor.view.dialogs.PreviousSearchesDialog;
 import org.apache.directory.studio.schemaeditor.view.search.SearchPage;
-import org.apache.directory.studio.schemaeditor.view.search.SearchPage.SearchScopeEnum;
+import org.apache.directory.studio.schemaeditor.view.search.SearchPage.SearchInEnum;
 import org.apache.directory.studio.schemaeditor.view.views.SearchView;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.IAction;
@@ -170,7 +170,8 @@
             {
                 public void widgetSelected( SelectionEvent e )
                 {
-                    view.setSearchInput( search, SearchPage.loadSearchScope().toArray( new SearchScopeEnum[0] ) );
+                    view.setSearchInput( search, SearchPage.loadSearchIn().toArray( new SearchInEnum[0] ), SearchPage
+                        .loadScope() );
                 }
             } );
             if ( search.equals( view.getSearchString() ) )

Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/PreviousSearchesDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/PreviousSearchesDialog.java?rev=576784&r1=576783&r2=576784&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/PreviousSearchesDialog.java (original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/PreviousSearchesDialog.java Tue Sep 18 02:04:18 2007
@@ -23,7 +23,7 @@
 import org.apache.directory.studio.schemaeditor.Activator;
 import org.apache.directory.studio.schemaeditor.PluginConstants;
 import org.apache.directory.studio.schemaeditor.view.search.SearchPage;
-import org.apache.directory.studio.schemaeditor.view.search.SearchPage.SearchScopeEnum;
+import org.apache.directory.studio.schemaeditor.view.search.SearchPage.SearchInEnum;
 import org.apache.directory.studio.schemaeditor.view.views.SearchView;
 import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.dialogs.IDialogConstants;
@@ -183,7 +183,8 @@
                 StructuredSelection selection = ( StructuredSelection ) tableViewer.getSelection();
                 String selectedSearch = ( String ) selection.getFirstElement();
 
-                view.setSearchInput( selectedSearch, SearchPage.loadSearchScope().toArray( new SearchScopeEnum[0] ) );
+                view.setSearchInput( selectedSearch, SearchPage.loadSearchIn().toArray( new SearchInEnum[0] ),
+                    SearchPage.loadScope() );
             }
         }
 

Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/search/SearchPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/search/SearchPage.java?rev=576784&r1=576783&r2=576784&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/search/SearchPage.java (original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/search/SearchPage.java Tue Sep 18 02:04:18 2007
@@ -67,16 +67,19 @@
     private Button syntaxButton;
     private Button matchingRulesButton;
     private Button superiorsButton;
-    private Button mandatoryAttributes;
-    private Button optionalAttributes;
+    private Button mandatoryAttributesButton;
+    private Button optionalAttributesButton;
+    private Button attributeTypesAndObjectClassesButton;
+    private Button attributeTypesOnlyButton;
+    private Button objectClassesOnly;
 
     /**
-     * This enums represents the different possible scopes for a Schema Search.
+     * This enums represents the different possible search in for a Schema Search.
      *
      * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
      * @version $Rev$, $Date$
      */
-    public enum SearchScopeEnum
+    public enum SearchInEnum
     {
         ALIASES, OID, DESCRIPTION, SUPERIOR, SYNTAX, MATCHING_RULES, SUPERIORS, MANDATORY_ATTRIBUTES, OPTIONAL_ATTRIBUTES
     }
@@ -105,74 +108,94 @@
             }
         } );
 
-        // Seach In Group
-        Group searchIn = new Group( parent, SWT.NONE );
-        searchIn.setLayout( new GridLayout() );
-        searchIn.setText( "Search in" );
-        searchIn.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        // Specific Scope Composite
+        Composite searchInComposite = new Composite( parent, SWT.NONE );
+        GridLayout SearchInLayout = new GridLayout( 3, true );
+        SearchInLayout.marginBottom = 0;
+        SearchInLayout.marginHeight = 0;
+        SearchInLayout.marginLeft = 0;
+        SearchInLayout.marginRight = 0;
+        SearchInLayout.marginTop = 0;
+        SearchInLayout.marginWidth = 0;
+        searchInComposite.setLayout( SearchInLayout );
+        searchInComposite.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 3, 1 ) );
+
+        // Search In Group
+        Group searchInGroup = new Group( searchInComposite, SWT.NONE );
+        searchInGroup.setLayout( new GridLayout() );
+        searchInGroup.setText( "Search in" );
+        searchInGroup.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
 
         // Aliases Button
-        aliasesButton = new Button( searchIn, SWT.CHECK );
+        aliasesButton = new Button( searchInGroup, SWT.CHECK );
         aliasesButton.setText( "Aliases" );
 
         // OID Button
-        oidButton = new Button( searchIn, SWT.CHECK );
+        oidButton = new Button( searchInGroup, SWT.CHECK );
         oidButton.setText( "OID" );
 
         // Description Button
-        descriptionButon = new Button( searchIn, SWT.CHECK );
+        descriptionButon = new Button( searchInGroup, SWT.CHECK );
         descriptionButon.setText( "Description" );
 
-        // Specific Scope Composite
-        Composite specificScopeComposite = new Composite( parent, SWT.NONE );
-        GridLayout specificScopeLayout = new GridLayout( 2, true );
-        specificScopeLayout.marginBottom = 0;
-        specificScopeLayout.marginHeight = 0;
-        specificScopeLayout.marginLeft = 0;
-        specificScopeLayout.marginRight = 0;
-        specificScopeLayout.marginTop = 0;
-        specificScopeLayout.marginWidth = 0;
-        specificScopeComposite.setLayout( specificScopeLayout );
-        specificScopeComposite.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 3, 1 ) );
-
         // Attribute Types Group
-        Group attributeTypesGroup = new Group( specificScopeComposite, SWT.NONE );
-        attributeTypesGroup.setText( "Seach in (for attribute types)" );
-        attributeTypesGroup.setLayout( new GridLayout() );
-        attributeTypesGroup.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
+        Group attributeTypesSearchInGroup = new Group( searchInComposite, SWT.NONE );
+        attributeTypesSearchInGroup.setText( "Seach in (for attribute types)" );
+        attributeTypesSearchInGroup.setLayout( new GridLayout() );
+        attributeTypesSearchInGroup.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
 
         // Superior Button
-        superiorButton = new Button( attributeTypesGroup, SWT.CHECK );
+        superiorButton = new Button( attributeTypesSearchInGroup, SWT.CHECK );
         superiorButton.setText( "Superior" );
 
         // Syntax Button
-        syntaxButton = new Button( attributeTypesGroup, SWT.CHECK );
+        syntaxButton = new Button( attributeTypesSearchInGroup, SWT.CHECK );
         syntaxButton.setText( "Syntax" );
 
         // Matching Rules Button
-        matchingRulesButton = new Button( attributeTypesGroup, SWT.CHECK );
+        matchingRulesButton = new Button( attributeTypesSearchInGroup, SWT.CHECK );
         matchingRulesButton.setText( "Matching Rules" );
 
         // Object Classes Group
-        Group objectClassesGroup = new Group( specificScopeComposite, SWT.NONE );
-        objectClassesGroup.setText( "Search in (for object classes)" );
-        objectClassesGroup.setLayout( new GridLayout() );
-        objectClassesGroup.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        Group objectClassesSearchInGroup = new Group( searchInComposite, SWT.NONE );
+        objectClassesSearchInGroup.setText( "Search in (for object classes)" );
+        objectClassesSearchInGroup.setLayout( new GridLayout() );
+        objectClassesSearchInGroup.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
 
         // Superiors Button
-        superiorsButton = new Button( objectClassesGroup, SWT.CHECK );
+        superiorsButton = new Button( objectClassesSearchInGroup, SWT.CHECK );
         superiorsButton.setText( "Superiors" );
 
         // Mandatory Attributes Button
-        mandatoryAttributes = new Button( objectClassesGroup, SWT.CHECK );
-        mandatoryAttributes.setText( "Mandatory Attributes" );
+        mandatoryAttributesButton = new Button( objectClassesSearchInGroup, SWT.CHECK );
+        mandatoryAttributesButton.setText( "Mandatory Attributes" );
 
         // Optional Attributes Button
-        optionalAttributes = new Button( objectClassesGroup, SWT.CHECK );
-        optionalAttributes.setText( "Optional Attributes" );
+        optionalAttributesButton = new Button( objectClassesSearchInGroup, SWT.CHECK );
+        optionalAttributesButton.setText( "Optional Attributes" );
+
+        // Scope Group
+        Group scopeGroup = new Group( parent, SWT.NONE );
+        scopeGroup.setText( "Scope" );
+        scopeGroup.setLayout( new GridLayout() );
+        scopeGroup.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+        // Attribute Types and Object Classes
+        attributeTypesAndObjectClassesButton = new Button( scopeGroup, SWT.RADIO );
+        attributeTypesAndObjectClassesButton.setText( "Attribute Types And Object Classes" );
+
+        // Attribute Types Only
+        attributeTypesOnlyButton = new Button( scopeGroup, SWT.RADIO );
+        attributeTypesOnlyButton.setText( "Attribute Types Only" );
+
+        // Object Classes Only
+        objectClassesOnly = new Button( scopeGroup, SWT.RADIO );
+        objectClassesOnly.setText( "Object Classes Only" );
 
         initSearchStringHistory();
 
+        initSearchIn();
+
         initSearchScope();
 
         searchCombo.setFocus();
@@ -191,47 +214,76 @@
 
 
     /**
-     * Initializes the Search Scope
+     * Initializes the Search In.
      */
-    private void initSearchScope()
+    private void initSearchIn()
     {
         IDialogSettings settings = Activator.getDefault().getDialogSettings();
 
-        if ( settings.get( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_ALIASES ) == null )
+        if ( settings.get( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_ALIASES ) == null )
         {
             aliasesButton.setSelection( true );
         }
         else
         {
-            aliasesButton.setSelection( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_ALIASES ) );
+            aliasesButton.setSelection( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_ALIASES ) );
         }
 
-        if ( settings.get( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_OID ) == null )
+        if ( settings.get( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_OID ) == null )
         {
             oidButton.setSelection( true );
         }
         else
         {
-            oidButton.setSelection( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_OID ) );
+            oidButton.setSelection( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_OID ) );
         }
 
-        if ( settings.get( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_DESCRIPTION ) == null )
+        if ( settings.get( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_DESCRIPTION ) == null )
         {
             descriptionButon.setSelection( true );
         }
         else
         {
-            descriptionButon.setSelection( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_DESCRIPTION ) );
+            descriptionButon.setSelection( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_DESCRIPTION ) );
         }
-        superiorButton.setSelection( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_SUPERIOR ) );
-        syntaxButton.setSelection( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_SYNTAX ) );
+        superiorButton.setSelection( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_SUPERIOR ) );
+        syntaxButton.setSelection( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_SYNTAX ) );
         matchingRulesButton
-            .setSelection( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_MATCHING_RULES ) );
-        superiorsButton.setSelection( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_SUPERIORS ) );
-        mandatoryAttributes.setSelection( settings
-            .getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_MANDATORY_ATTRIBUTES ) );
-        optionalAttributes.setSelection( settings
-            .getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_OPTIONAL_ATTRIBUTES ) );
+            .setSelection( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_MATCHING_RULES ) );
+        superiorsButton.setSelection( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_SUPERIORS ) );
+        mandatoryAttributesButton.setSelection( settings
+            .getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_MANDATORY_ATTRIBUTES ) );
+        optionalAttributesButton.setSelection( settings
+            .getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_OPTIONAL_ATTRIBUTES ) );
+    }
+
+
+    /**
+     * Initializes the Search Scope.
+     */
+    private void initSearchScope()
+    {
+        IDialogSettings settings = Activator.getDefault().getDialogSettings();
+
+        if ( settings.get( PluginConstants.PREFS_SEARCH_PAGE_SCOPE ) == null )
+        {
+            attributeTypesAndObjectClassesButton.setSelection( true );
+        }
+        else
+        {
+            switch ( settings.getInt( PluginConstants.PREFS_SEARCH_PAGE_SCOPE ) )
+            {
+                case PluginConstants.PREFS_SEARCH_PAGE_SCOPE_AT_AND_OC:
+                    attributeTypesAndObjectClassesButton.setSelection( true );
+                    break;
+                case PluginConstants.PREFS_SEARCH_PAGE_SCOPE_AT_ONLY:
+                    attributeTypesOnlyButton.setSelection( true );
+                    break;
+                case PluginConstants.PREFS_SEARCH_PAGE_SCOPE_OC_ONLY:
+                    objectClassesOnly.setSelection( true );
+                    break;
+            }
+        }
     }
 
 
@@ -240,42 +292,58 @@
      */
     public boolean performAction()
     {
-        List<SearchScopeEnum> searchScope = new ArrayList<SearchScopeEnum>();
+        // Search In
+        List<SearchInEnum> searchIn = new ArrayList<SearchInEnum>();
         if ( aliasesButton.getSelection() )
         {
-            searchScope.add( SearchScopeEnum.ALIASES );
+            searchIn.add( SearchInEnum.ALIASES );
         }
         if ( oidButton.getSelection() )
         {
-            searchScope.add( SearchScopeEnum.OID );
+            searchIn.add( SearchInEnum.OID );
         }
         if ( descriptionButon.getSelection() )
         {
-            searchScope.add( SearchScopeEnum.DESCRIPTION );
+            searchIn.add( SearchInEnum.DESCRIPTION );
         }
         if ( superiorButton.getSelection() )
         {
-            searchScope.add( SearchScopeEnum.SUPERIOR );
+            searchIn.add( SearchInEnum.SUPERIOR );
         }
         if ( syntaxButton.getSelection() )
         {
-            searchScope.add( SearchScopeEnum.SYNTAX );
+            searchIn.add( SearchInEnum.SYNTAX );
         }
         if ( matchingRulesButton.getSelection() )
         {
-            searchScope.add( SearchScopeEnum.MATCHING_RULES );
+            searchIn.add( SearchInEnum.MATCHING_RULES );
         }
         if ( superiorsButton.getSelection() )
         {
-            searchScope.add( SearchScopeEnum.SUPERIORS );
+            searchIn.add( SearchInEnum.SUPERIORS );
         }
-        if ( mandatoryAttributes.getSelection() )
+        if ( mandatoryAttributesButton.getSelection() )
         {
-            searchScope.add( SearchScopeEnum.MANDATORY_ATTRIBUTES );
+            searchIn.add( SearchInEnum.MANDATORY_ATTRIBUTES );
         }
-        if ( optionalAttributes.getSelection() )
+        if ( optionalAttributesButton.getSelection() )
         {
-            searchScope.add( SearchScopeEnum.OPTIONAL_ATTRIBUTES );
+            searchIn.add( SearchInEnum.OPTIONAL_ATTRIBUTES );
+        }
+
+        // Scope
+        int scope = 0;
+        if ( attributeTypesAndObjectClassesButton.getSelection() )
+        {
+            scope = PluginConstants.PREFS_SEARCH_PAGE_SCOPE_AT_AND_OC;
+        }
+        else if ( attributeTypesOnlyButton.getSelection() )
+        {
+            scope = PluginConstants.PREFS_SEARCH_PAGE_SCOPE_AT_ONLY;
+        }
+        else if ( objectClassesOnly.getSelection() )
+        {
+            scope = PluginConstants.PREFS_SEARCH_PAGE_SCOPE_OC_ONLY;
         }
 
         // Opening the SearchView and displaying the results
@@ -283,7 +351,7 @@
         {
             SearchView searchView = ( SearchView ) Activator.getDefault().getWorkbench().getActiveWorkbenchWindow()
                 .getActivePage().showView( SearchView.ID );
-            searchView.setSearchInput( searchCombo.getText(), searchScope.toArray( new SearchScopeEnum[0] ) );
+            searchView.setSearchInput( searchCombo.getText(), searchIn.toArray( new SearchInEnum[0] ), scope );
         }
         catch ( PartInitException e )
         {
@@ -409,79 +477,90 @@
 
 
     /**
-     * Loads the Search scope.
+     * Loads the Search In.
      *
      * @return
-     *      the search scope
+     *      the search In
      */
-    public static List<SearchScopeEnum> loadSearchScope()
+    public static List<SearchInEnum> loadSearchIn()
     {
-        List<SearchScopeEnum> searchScope = new ArrayList<SearchScopeEnum>();
+        List<SearchInEnum> searchScope = new ArrayList<SearchInEnum>();
         IDialogSettings settings = Activator.getDefault().getDialogSettings();
 
-        if ( settings.get( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_ALIASES ) == null )
+        if ( settings.get( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_ALIASES ) == null )
         {
-            searchScope.add( SearchScopeEnum.ALIASES );
+            searchScope.add( SearchInEnum.ALIASES );
         }
         else
         {
-            if ( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_ALIASES ) )
+            if ( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_ALIASES ) )
             {
-                searchScope.add( SearchScopeEnum.ALIASES );
+                searchScope.add( SearchInEnum.ALIASES );
             }
         }
 
-        if ( settings.get( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_OID ) == null )
+        if ( settings.get( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_OID ) == null )
         {
-            searchScope.add( SearchScopeEnum.OID );
+            searchScope.add( SearchInEnum.OID );
         }
         else
         {
-            if ( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_OID ) )
+            if ( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_OID ) )
             {
-                searchScope.add( SearchScopeEnum.OID );
+                searchScope.add( SearchInEnum.OID );
             }
         }
 
-        if ( settings.get( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_DESCRIPTION ) == null )
+        if ( settings.get( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_DESCRIPTION ) == null )
         {
-            searchScope.add( SearchScopeEnum.DESCRIPTION );
+            searchScope.add( SearchInEnum.DESCRIPTION );
         }
         else
         {
-            if ( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_DESCRIPTION ) )
+            if ( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_DESCRIPTION ) )
             {
-                searchScope.add( SearchScopeEnum.DESCRIPTION );
+                searchScope.add( SearchInEnum.DESCRIPTION );
             }
         }
-        if ( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_SUPERIOR ) )
+        if ( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_SUPERIOR ) )
         {
-            searchScope.add( SearchScopeEnum.SUPERIOR );
+            searchScope.add( SearchInEnum.SUPERIOR );
         }
-        if ( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_SYNTAX ) )
+        if ( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_SYNTAX ) )
         {
-            searchScope.add( SearchScopeEnum.SYNTAX );
+            searchScope.add( SearchInEnum.SYNTAX );
         }
-        if ( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_MATCHING_RULES ) )
+        if ( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_MATCHING_RULES ) )
         {
-            searchScope.add( SearchScopeEnum.MATCHING_RULES );
+            searchScope.add( SearchInEnum.MATCHING_RULES );
         }
-        if ( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_SUPERIORS ) )
+        if ( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_SUPERIORS ) )
         {
-            searchScope.add( SearchScopeEnum.SUPERIORS );
+            searchScope.add( SearchInEnum.SUPERIORS );
         }
-        if ( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_MANDATORY_ATTRIBUTES ) )
+        if ( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_MANDATORY_ATTRIBUTES ) )
         {
-            searchScope.add( SearchScopeEnum.MANDATORY_ATTRIBUTES );
+            searchScope.add( SearchInEnum.MANDATORY_ATTRIBUTES );
         }
-        if ( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_OPTIONAL_ATTRIBUTES ) )
+        if ( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_OPTIONAL_ATTRIBUTES ) )
         {
-            searchScope.add( SearchScopeEnum.OPTIONAL_ATTRIBUTES );
+            searchScope.add( SearchInEnum.OPTIONAL_ATTRIBUTES );
         }
 
         return searchScope;
     }
 
+    
+    /**
+     * Loads the scope.
+     *
+     * @return
+     *      the scope
+     */
+    public static int loadScope()
+    {
+        return Activator.getDefault().getDialogSettings().getInt( PluginConstants.PREFS_SEARCH_PAGE_SCOPE );
+    }
 
     /**
      * Saves the Search scope.
@@ -489,26 +568,25 @@
      * @param scope
      *      the Search scope
      */
-    public static void saveSearchScope( List<SearchScopeEnum> scope )
+    public static void saveSearchScope( List<SearchInEnum> scope )
     {
         if ( ( scope != null ) && ( scope.size() > 0 ) )
         {
             IDialogSettings settings = Activator.getDefault().getDialogSettings();
 
-            settings.put( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_ALIASES, scope.contains( SearchScopeEnum.ALIASES ) );
-            settings.put( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_OID, scope.contains( SearchScopeEnum.OID ) );
-            settings.put( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_DESCRIPTION, scope
-                .contains( SearchScopeEnum.DESCRIPTION ) );
-            settings.put( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_SUPERIOR, scope.contains( SearchScopeEnum.SUPERIOR ) );
-            settings.put( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_SYNTAX, scope.contains( SearchScopeEnum.SYNTAX ) );
-            settings.put( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_MATCHING_RULES, scope
-                .contains( SearchScopeEnum.MATCHING_RULES ) );
-            settings
-                .put( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_SUPERIORS, scope.contains( SearchScopeEnum.SUPERIORS ) );
-            settings.put( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_MANDATORY_ATTRIBUTES, scope
-                .contains( SearchScopeEnum.MANDATORY_ATTRIBUTES ) );
-            settings.put( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_OPTIONAL_ATTRIBUTES, scope
-                .contains( SearchScopeEnum.OPTIONAL_ATTRIBUTES ) );
+            settings.put( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_ALIASES, scope.contains( SearchInEnum.ALIASES ) );
+            settings.put( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_OID, scope.contains( SearchInEnum.OID ) );
+            settings.put( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_DESCRIPTION, scope
+                .contains( SearchInEnum.DESCRIPTION ) );
+            settings.put( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_SUPERIOR, scope.contains( SearchInEnum.SUPERIOR ) );
+            settings.put( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_SYNTAX, scope.contains( SearchInEnum.SYNTAX ) );
+            settings.put( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_MATCHING_RULES, scope
+                .contains( SearchInEnum.MATCHING_RULES ) );
+            settings.put( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_SUPERIORS, scope.contains( SearchInEnum.SUPERIORS ) );
+            settings.put( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_MANDATORY_ATTRIBUTES, scope
+                .contains( SearchInEnum.MANDATORY_ATTRIBUTES ) );
+            settings.put( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_OPTIONAL_ATTRIBUTES, scope
+                .contains( SearchInEnum.OPTIONAL_ATTRIBUTES ) );
         }
     }
 

Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchView.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchView.java?rev=576784&r1=576783&r2=576784&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchView.java (original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchView.java Tue Sep 18 02:04:18 2007
@@ -40,7 +40,7 @@
 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.SearchScopeEnum;
+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;
@@ -208,10 +208,29 @@
             }
         } );
 
-        // Search Scope Toolbar
-        final ToolBar scopeToolBar = new ToolBar( searchFieldInnerComposite, SWT.HORIZONTAL | SWT.FLAT );
-        // Creating the Search Scope ToolItem
-        final ToolItem scopeToolItem = new ToolItem( scopeToolBar, SWT.DROP_DOWN );
+        // 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()
@@ -220,14 +239,14 @@
             {
                 Rectangle rect = scopeToolItem.getBounds();
                 Point pt = new Point( rect.x, rect.y + rect.height );
-                pt = scopeToolBar.toDisplay( pt );
+                pt = searchToolBar.toDisplay( pt );
 
-                Menu menu = createMenu();
+                Menu menu = createScopeMenu();
                 menu.setLocation( pt.x, pt.y );
                 menu.setVisible( true );
             }
         } );
-        scopeToolBar.setLayoutData( new GridData( SWT.NONE, SWT.CENTER, false, false ) );
+        searchToolBar.setLayoutData( new GridData( SWT.NONE, SWT.CENTER, false, false ) );
 
         // Search Button
         searchButton = new Button( searchFieldInnerComposite, SWT.PUSH | SWT.DOWN );
@@ -251,155 +270,225 @@
 
 
     /**
-     * Creates the menu
+     * Creates the Search In Menu
      *
      * @return
-     *      the menu
+     *      the Search In menu
      */
-    public Menu createMenu()
+    public Menu createSearchInMenu()
     {
         final IDialogSettings settings = Activator.getDefault().getDialogSettings();
 
         // Creating the associated Menu
-        Menu scopeMenu = new Menu( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.POP_UP );
+        Menu searchInMenu = new Menu( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.POP_UP );
 
         // Filling the menu
         // Aliases
-        final MenuItem aliasesMenuItem = new MenuItem( scopeMenu, SWT.CHECK );
+        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_SCOPE_ALIASES, aliasesMenuItem.getSelection() );
+                settings.put( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_ALIASES, aliasesMenuItem.getSelection() );
             }
         } );
         // OID
-        final MenuItem oidMenuItem = new MenuItem( scopeMenu, SWT.CHECK );
+        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_SCOPE_OID, oidMenuItem.getSelection() );
+                settings.put( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_OID, oidMenuItem.getSelection() );
             }
         } );
         // Description
-        final MenuItem descriptionMenuItem = new MenuItem( scopeMenu, SWT.CHECK );
+        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_SCOPE_DESCRIPTION, descriptionMenuItem.getSelection() );
+                settings.put( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_DESCRIPTION, descriptionMenuItem.getSelection() );
             }
         } );
         // Separator
-        new MenuItem( scopeMenu, SWT.SEPARATOR );
+        new MenuItem( searchInMenu, SWT.SEPARATOR );
         // Superior
-        final MenuItem superiorMenuItem = new MenuItem( scopeMenu, SWT.CHECK );
+        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_SCOPE_SUPERIOR, superiorMenuItem.getSelection() );
+                settings.put( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_SUPERIOR, superiorMenuItem.getSelection() );
             }
         } );
         // Syntax
-        final MenuItem syntaxMenuItem = new MenuItem( scopeMenu, SWT.CHECK );
+        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_SCOPE_SYNTAX, syntaxMenuItem.getSelection() );
+                settings.put( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_SYNTAX, syntaxMenuItem.getSelection() );
             }
         } );
         // Matching Rules
-        final MenuItem matchingRulesMenuItem = new MenuItem( scopeMenu, SWT.CHECK );
+        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_SCOPE_MATCHING_RULES, matchingRulesMenuItem
+                settings.put( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_MATCHING_RULES, matchingRulesMenuItem
                     .getSelection() );
             }
         } );
         // Separator
-        new MenuItem( scopeMenu, SWT.SEPARATOR );
+        new MenuItem( searchInMenu, SWT.SEPARATOR );
         // Superiors
-        final MenuItem superiorsMenuItem = new MenuItem( scopeMenu, SWT.CHECK );
+        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_SCOPE_SUPERIORS, superiorsMenuItem.getSelection() );
+                settings.put( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_SUPERIORS, superiorsMenuItem.getSelection() );
             }
         } );
         // Mandatory Attributes
-        final MenuItem mandatoryAttributesMenuItem = new MenuItem( scopeMenu, SWT.CHECK );
+        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_SCOPE_MANDATORY_ATTRIBUTES, mandatoryAttributesMenuItem
+                settings.put( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_MANDATORY_ATTRIBUTES, mandatoryAttributesMenuItem
                     .getSelection() );
             }
         } );
         // Optional Attributes
-        final MenuItem optionalAttributesMenuItem = new MenuItem( scopeMenu, SWT.CHECK );
+        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_SCOPE_OPTIONAL_ATTRIBUTES, optionalAttributesMenuItem
+                settings.put( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_OPTIONAL_ATTRIBUTES, optionalAttributesMenuItem
                     .getSelection() );
             }
         } );
 
-        if ( settings.get( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_ALIASES ) == null )
+        if ( settings.get( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_ALIASES ) == null )
         {
             aliasesMenuItem.setSelection( true );
         }
         else
         {
-            aliasesMenuItem.setSelection( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_ALIASES ) );
+            aliasesMenuItem.setSelection( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_ALIASES ) );
         }
 
-        if ( settings.get( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_OID ) == null )
+        if ( settings.get( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_OID ) == null )
         {
             oidMenuItem.setSelection( true );
         }
         else
         {
 
-            oidMenuItem.setSelection( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_OID ) );
+            oidMenuItem.setSelection( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_OID ) );
         }
 
-        if ( settings.get( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_DESCRIPTION ) == null )
+        if ( settings.get( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_DESCRIPTION ) == null )
         {
             descriptionMenuItem.setSelection( true );
         }
         else
         {
             descriptionMenuItem
-                .setSelection( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_DESCRIPTION ) );
+                .setSelection( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_DESCRIPTION ) );
         }
 
-        superiorMenuItem.setSelection( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_SUPERIOR ) );
-        syntaxMenuItem.setSelection( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_SYNTAX ) );
+        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_SCOPE_MATCHING_RULES ) );
-        superiorsMenuItem.setSelection( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_SUPERIORS ) );
+            .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_SCOPE_MANDATORY_ATTRIBUTES ) );
+            .getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_IN_MANDATORY_ATTRIBUTES ) );
         optionalAttributesMenuItem.setSelection( settings
-            .getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_OPTIONAL_ATTRIBUTES ) );
+            .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;
     }
@@ -552,16 +641,18 @@
      *
      * @param searchString
      *      the search String
+     * @param searchIn
+     *      the search In
      * @param scope
-     *      the search Scope
+     *      the scope
      */
-    public void setSearchInput( String searchString, SearchScopeEnum[] 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( scope ) );
+        SearchPage.saveSearchScope( Arrays.asList( searchIn ) );
 
         if ( ( searchField != null ) && ( !searchField.isDisposed() ) )
         {
@@ -569,7 +660,7 @@
             validateSearchField();
         }
 
-        List<SchemaObject> results = search( searchString, scope );
+        List<SchemaObject> results = search( searchString, searchIn, scope );
         setSearchResultsLabel( searchString, results.size() );
         resultsTableViewer.setInput( results );
     }
@@ -580,10 +671,12 @@
      *
      * @param searchString
      *      the search String
+     * @param searchIn
+     *      the search In
      * @param scope
-     *      the search Scope
+     *      the scope
      */
-    private List<SchemaObject> search( String searchString, SearchScopeEnum[] scope )
+    private List<SchemaObject> search( String searchString, SearchInEnum[] searchIn, int scope )
     {
         List<SchemaObject> searchResults = new ArrayList<SchemaObject>();
 
@@ -597,149 +690,157 @@
             SchemaHandler schemaHandler = Activator.getDefault().getSchemaHandler();
             if ( schemaHandler != null )
             {
-                List<SearchScopeEnum> searchScope = new ArrayList<SearchScopeEnum>( Arrays.asList( scope ) );
+                List<SearchInEnum> searchScope = new ArrayList<SearchInEnum>( Arrays.asList( searchIn ) );
 
-                // Looping on attribute types
-                List<AttributeTypeImpl> attributeTypes = schemaHandler.getAttributeTypes();
-                for ( AttributeTypeImpl at : attributeTypes )
+                if ( ( scope == PluginConstants.PREFS_SEARCH_PAGE_SCOPE_AT_AND_OC )
+                    || ( scope == PluginConstants.PREFS_SEARCH_PAGE_SCOPE_AT_ONLY ) )
                 {
-                    // Aliases
-                    if ( searchScope.contains( SearchScopeEnum.ALIASES ) )
-                    {
-                        if ( checkArray( pattern, at.getNames() ) )
-                        {
-                            searchResults.add( at );
-                            continue;
-                        }
-                    }
-
-                    // OID
-                    if ( searchScope.contains( SearchScopeEnum.OID ) )
-                    {
-                        if ( checkString( pattern, at.getOid() ) )
-                        {
-                            searchResults.add( at );
-                            continue;
-                        }
-                    }
-
-                    // Description
-                    if ( searchScope.contains( SearchScopeEnum.DESCRIPTION ) )
-                    {
-                        if ( checkString( pattern, at.getDescription() ) )
-                        {
-                            searchResults.add( at );
-                            continue;
-                        }
-                    }
-
-                    // Superior
-                    if ( searchScope.contains( SearchScopeEnum.SUPERIOR ) )
-                    {
-                        if ( checkString( pattern, at.getSuperiorName() ) )
-                        {
-                            searchResults.add( at );
-                            continue;
-                        }
-                    }
-
-                    // Syntax
-                    if ( searchScope.contains( SearchScopeEnum.SYNTAX ) )
-                    {
-                        if ( checkString( pattern, at.getSyntaxOid() ) )
-                        {
-                            searchResults.add( at );
-                            continue;
-                        }
-                    }
-
-                    // Matching Rules
-                    if ( searchScope.contains( SearchScopeEnum.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;
+                    // 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;
+                            }
                         }
                     }
                 }
 
-                // Looping on object classes
-                List<ObjectClassImpl> objectClasses = schemaHandler.getObjectClasses();
-                for ( ObjectClassImpl oc : objectClasses )
+                if ( ( scope == PluginConstants.PREFS_SEARCH_PAGE_SCOPE_AT_AND_OC )
+                    || ( scope == PluginConstants.PREFS_SEARCH_PAGE_SCOPE_OC_ONLY ) )
                 {
-                    // Aliases
-                    if ( searchScope.contains( SearchScopeEnum.ALIASES ) )
+                    // Looping on object classes
+                    List<ObjectClassImpl> objectClasses = schemaHandler.getObjectClasses();
+                    for ( ObjectClassImpl oc : objectClasses )
                     {
-                        if ( checkArray( pattern, oc.getNames() ) )
+                        // Aliases
+                        if ( searchScope.contains( SearchInEnum.ALIASES ) )
                         {
-                            searchResults.add( oc );
-                            continue;
+                            if ( checkArray( pattern, oc.getNames() ) )
+                            {
+                                searchResults.add( oc );
+                                continue;
+                            }
                         }
-                    }
 
-                    // OID
-                    if ( searchScope.contains( SearchScopeEnum.OID ) )
-                    {
-                        if ( checkString( pattern, oc.getOid() ) )
+                        // OID
+                        if ( searchScope.contains( SearchInEnum.OID ) )
                         {
-                            searchResults.add( oc );
-                            continue;
+                            if ( checkString( pattern, oc.getOid() ) )
+                            {
+                                searchResults.add( oc );
+                                continue;
+                            }
                         }
-                    }
 
-                    // Description
-                    if ( searchScope.contains( SearchScopeEnum.DESCRIPTION ) )
-                    {
-                        if ( checkString( pattern, oc.getDescription() ) )
+                        // Description
+                        if ( searchScope.contains( SearchInEnum.DESCRIPTION ) )
                         {
-                            searchResults.add( oc );
-                            continue;
+                            if ( checkString( pattern, oc.getDescription() ) )
+                            {
+                                searchResults.add( oc );
+                                continue;
+                            }
                         }
-                    }
 
-                    // Superiors
-                    if ( searchScope.contains( SearchScopeEnum.SUPERIORS ) )
-                    {
-                        if ( checkArray( pattern, oc.getSuperClassesNames() ) )
+                        // Superiors
+                        if ( searchScope.contains( SearchInEnum.SUPERIORS ) )
                         {
-                            searchResults.add( oc );
-                            continue;
+                            if ( checkArray( pattern, oc.getSuperClassesNames() ) )
+                            {
+                                searchResults.add( oc );
+                                continue;
+                            }
                         }
-                    }
 
-                    // Mandatory Attributes
-                    if ( searchScope.contains( SearchScopeEnum.MANDATORY_ATTRIBUTES ) )
-                    {
-                        if ( checkArray( pattern, oc.getMustNamesList() ) )
+                        // Mandatory Attributes
+                        if ( searchScope.contains( SearchInEnum.MANDATORY_ATTRIBUTES ) )
                         {
-                            searchResults.add( oc );
-                            continue;
+                            if ( checkArray( pattern, oc.getMustNamesList() ) )
+                            {
+                                searchResults.add( oc );
+                                continue;
+                            }
                         }
-                    }
 
-                    // Optional Attributes
-                    if ( searchScope.contains( SearchScopeEnum.OPTIONAL_ATTRIBUTES ) )
-                    {
-                        if ( checkArray( pattern, oc.getMayNamesList() ) )
+                        // Optional Attributes
+                        if ( searchScope.contains( SearchInEnum.OPTIONAL_ATTRIBUTES ) )
                         {
-                            searchResults.add( oc );
-                            continue;
+                            if ( checkArray( pattern, oc.getMayNamesList() ) )
+                            {
+                                searchResults.add( oc );
+                                continue;
+                            }
                         }
                     }
                 }
@@ -792,9 +893,9 @@
     private void search()
     {
         String searchString = searchField.getText();
-        List<SearchScopeEnum> searchScope = SearchPage.loadSearchScope();
+        List<SearchInEnum> searchScope = SearchPage.loadSearchIn();
 
-        setSearchInput( searchString, searchScope.toArray( new SearchScopeEnum[0] ) );
+        setSearchInput( searchString, searchScope.toArray( new SearchInEnum[0] ), SearchPage.loadScope() );
     }
 
 
@@ -846,7 +947,8 @@
     {
         if ( searchString != null )
         {
-            setSearchInput( searchString, SearchPage.loadSearchScope().toArray( new SearchScopeEnum[0] ) );
+            setSearchInput( searchString, SearchPage.loadSearchIn().toArray( new SearchInEnum[0] ), SearchPage
+                .loadScope() );
         }
     }
 



Mime
View raw message