directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r567548 - in /directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor: controller/actions/ view/dialogs/ view/search/ view/views/
Date Mon, 20 Aug 2007 05:34:39 GMT
Author: pamarcelot
Date: Sun Aug 19 22:34:39 2007
New Revision: 567548

URL: http://svn.apache.org/viewvc?rev=567548&view=rev
Log:
Added implementation for the RunCurrentSearchAgain Action.
Improved ShowSearchHistory Action and PreviousSearches Dialog.

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

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/RunCurrentSearchAgainAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/RunCurrentSearchAgainAction.java?rev=567548&r1=567547&r2=567548&view=diff
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/RunCurrentSearchAgainAction.java
(original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/RunCurrentSearchAgainAction.java
Sun Aug 19 22:34:39 2007
@@ -32,7 +32,7 @@
 
 
 /**
- * This action is used to link the with the view with the frontmost editor.
+ * This action is used to run the current search again.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
@@ -65,7 +65,7 @@
      */
     public void run()
     {
-
+        view.runCurrentSearchAgain();
     }
 
 

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ShowSearchFieldAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ShowSearchFieldAction.java?rev=567548&r1=567547&r2=567548&view=diff
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ShowSearchFieldAction.java
(original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ShowSearchFieldAction.java
Sun Aug 19 22:34:39 2007
@@ -32,7 +32,7 @@
 
 
 /**
- * This action is used to link the with the view with the frontmost editor.
+ * This action is used to show/hide the search field in the SearchView.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ShowSearchHistoryAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ShowSearchHistoryAction.java?rev=567548&r1=567547&r2=567548&view=diff
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ShowSearchHistoryAction.java
(original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ShowSearchHistoryAction.java
Sun Aug 19 22:34:39 2007
@@ -24,6 +24,7 @@
 import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
 import org.apache.directory.studio.apacheds.schemaeditor.view.dialogs.PreviousSearchesDialog;
 import org.apache.directory.studio.apacheds.schemaeditor.view.search.SearchPage;
+import org.apache.directory.studio.apacheds.schemaeditor.view.search.SearchPage.SearchScopeEnum;
 import org.apache.directory.studio.apacheds.schemaeditor.view.views.SearchView;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.IAction;
@@ -32,7 +33,6 @@
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Menu;
 import org.eclipse.swt.widgets.MenuItem;
@@ -42,7 +42,7 @@
 
 
 /**
- * This action is used to link the with the view with the frontmost editor.
+ * This action is show the search History.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
@@ -59,13 +59,13 @@
     public ShowSearchHistoryAction( SearchView view )
     {
         super( "Search History", AS_DROP_DOWN_MENU );
+        this.view = view;
         setToolTipText( getText() );
         setId( PluginConstants.CMD_SHOW_SEARCH_HISTORY );
         setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
             PluginConstants.IMG_SHOW_SEARCH_HISTORY ) );
         setEnabled( true );
-        this.view = view;
-        setMenuCreator( new MenuCreator() );
+        setMenuCreator( new MenuCreator( view ) );
     }
 
 
@@ -76,7 +76,7 @@
      */
     public void run()
     {
-        PreviousSearchesDialog dialog = new PreviousSearchesDialog();
+        PreviousSearchesDialog dialog = new PreviousSearchesDialog( view );
         dialog.open();
     }
 
@@ -122,6 +122,21 @@
     /** The menu */
     private Menu menu;
 
+    /** The associated view */
+    private SearchView view;
+
+
+    /**
+     * Creates a new instance of MenuCreator.
+     *
+     * @param view
+     *      the associated view
+     */
+    public MenuCreator( SearchView view )
+    {
+        this.view = view;
+    }
+
 
     /* (non-Javadoc)
      * @see org.eclipse.jface.action.IMenuCreator#dispose()
@@ -145,12 +160,19 @@
 
         // Previous searches 
         String[] previousSearches = SearchPage.loadSearchStringHistory();
-        for ( String search : previousSearches )
+        for ( final String search : previousSearches )
         {
             MenuItem item = new MenuItem( menu, SWT.RADIO );
             item.setText( search );
             item.setImage( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
                 PluginConstants.IMG_SEARCH_HISTORY_ITEM ).createImage() );
+            item.addSelectionListener( new SelectionAdapter()
+            {
+                public void widgetSelected( SelectionEvent e )
+                {
+                    view.setSearchInput( search, SearchPage.loadSearchScope().toArray( new
SearchScopeEnum[0] ) );
+                }
+            } );
         }
 
         // No search history
@@ -170,12 +192,19 @@
         {
             public void widgetSelected( SelectionEvent e )
             {
-                PreviousSearchesDialog dialog = new PreviousSearchesDialog();
+                PreviousSearchesDialog dialog = new PreviousSearchesDialog( view );
                 dialog.open();
             }
         } );
         item = new MenuItem( menu, SWT.PUSH );
         item.setText( "Clear History" );
+        item.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                SearchPage.clearSearchHistory();
+            }
+        } );
 
         return menu;
     }

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/PreviousSearchesDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/PreviousSearchesDialog.java?rev=567548&r1=567547&r2=567548&view=diff
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/PreviousSearchesDialog.java
(original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/PreviousSearchesDialog.java
Sun Aug 19 22:34:39 2007
@@ -23,12 +23,21 @@
 import org.apache.directory.studio.apacheds.schemaeditor.Activator;
 import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
 import org.apache.directory.studio.apacheds.schemaeditor.view.search.SearchPage;
+import org.apache.directory.studio.apacheds.schemaeditor.view.search.SearchPage.SearchScopeEnum;
+import org.apache.directory.studio.apacheds.schemaeditor.view.views.SearchView;
 import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
 import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.viewers.TableViewer;
 import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
@@ -49,16 +58,22 @@
  */
 public class PreviousSearchesDialog extends Dialog
 {
+    /** The associated view */
+    private SearchView view;
+
     // UI Fields
     private TableViewer tableViewer;
+    private Button openButton;
+    private Button removeButton;
 
 
     /**
      * Creates a new instance of PreviousSearchesDialog.
      */
-    public PreviousSearchesDialog()
+    public PreviousSearchesDialog( SearchView view )
     {
         super( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell() );
+        this.view = view;
     }
 
 
@@ -85,7 +100,7 @@
         label.setText( "Select the search to show in the search results view:" );
         label.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 2, 1 ) );
 
-        tableViewer = new TableViewer( composite );
+        tableViewer = new TableViewer( composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL
| SWT.SINGLE );
         GridData gd = new GridData( SWT.FILL, SWT.NONE, true, false );
         gd.widthHint = 300;
         gd.heightHint = 200;
@@ -93,17 +108,42 @@
         tableViewer.setContentProvider( new ArrayContentProvider() );
         tableViewer.setLabelProvider( new LabelProvider()
         {
-            @Override
             public Image getImage( Object element )
             {
                 return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
                     PluginConstants.IMG_SEARCH_HISTORY_ITEM ).createImage();
             }
         } );
+        tableViewer.addSelectionChangedListener( new ISelectionChangedListener()
+        {
+            public void selectionChanged( SelectionChangedEvent event )
+            {
+                openButton.setEnabled( !event.getSelection().isEmpty() );
+                removeButton.setEnabled( !event.getSelection().isEmpty() );
+            }
+        } );
+        tableViewer.addDoubleClickListener( new IDoubleClickListener()
+        {
+            public void doubleClick( DoubleClickEvent event )
+            {
+                buttonPressed( IDialogConstants.OK_ID );
+            }
+        } );
 
-        Button removeButton = new Button( composite, SWT.NONE );
+        removeButton = new Button( composite, SWT.NONE );
         removeButton.setText( "Remove" );
         removeButton.setLayoutData( new GridData( SWT.NONE, SWT.BEGINNING, false, false )
);
+        removeButton.setEnabled( false );
+        removeButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                StructuredSelection selection = ( StructuredSelection ) tableViewer.getSelection();
+                String selectedSearch = ( String ) selection.getFirstElement();
+                SearchPage.removeSearchStringHistory( selectedSearch );
+                initTableViewer();
+            }
+        } );
 
         initTableViewer();
 
@@ -126,6 +166,27 @@
     protected void createButtonsForButtonBar( Composite parent )
     {
         createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL,
false );
-        createButton( parent, IDialogConstants.OK_ID, "Open", true );
+        openButton = createButton( parent, IDialogConstants.OK_ID, "Open", true );
+        openButton.setEnabled( false );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
+     */
+    protected void buttonPressed( int buttonId )
+    {
+        if ( buttonId == IDialogConstants.OK_ID )
+        {
+            if ( !tableViewer.getSelection().isEmpty() )
+            {
+                StructuredSelection selection = ( StructuredSelection ) tableViewer.getSelection();
+                String selectedSearch = ( String ) selection.getFirstElement();
+
+                view.setSearchInput( selectedSearch, SearchPage.loadSearchScope().toArray(
new SearchScopeEnum[0] ) );
+            }
+        }
+
+        super.buttonPressed( buttonId );
     }
 }

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/search/SearchPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/search/SearchPage.java?rev=567548&r1=567547&r2=567548&view=diff
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/search/SearchPage.java
(original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/search/SearchPage.java
Sun Aug 19 22:34:39 2007
@@ -27,7 +27,6 @@
 
 import org.apache.directory.studio.apacheds.schemaeditor.Activator;
 import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
-import org.apache.directory.studio.apacheds.schemaeditor.view.views.SchemaView;
 import org.apache.directory.studio.apacheds.schemaeditor.view.views.SearchView;
 import org.eclipse.jface.dialogs.DialogPage;
 import org.eclipse.jface.dialogs.IDialogSettings;
@@ -231,7 +230,6 @@
             .getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_MANDATORY_ATTRIBUTES ) );
         optionalAttributes.setSelection( settings
             .getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_OPTIONAL_ATTRIBUTES ) );
-
     }
 
 
@@ -278,10 +276,6 @@
             searchScope.add( SearchScopeEnum.OPTIONAL_ATTRIBUTES );
         }
 
-        // Saving search String and Search Scope to dialings settings
-        addSearchStringHistory( searchCombo.getText() );
-        saveSearchScope( searchScope );
-
         // Opening the SearchView and displaying the results
         try
         {
@@ -340,7 +334,7 @@
 
 
     /**
-     * Saves to the History.
+     * Adds a new Search String to the History.
      *
      * @param value
      *      the value to save
@@ -371,6 +365,30 @@
 
 
     /**
+     * Removes the given value from the History.
+     *
+     * @param value
+     *      the value to remove
+     */
+    public static void removeSearchStringHistory( String value )
+    {
+        // get current history
+        String[] history = loadSearchStringHistory();
+        List<String> list = new ArrayList<String>( Arrays.asList( history ) );
+
+        // add new value or move to first position
+        if ( list.contains( value ) )
+        {
+            list.remove( value );
+        }
+
+        // save
+        history = ( String[] ) list.toArray( new String[list.size()] );
+        Activator.getDefault().getDialogSettings().put( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_HISTORY,
history );
+    }
+
+
+    /**
      * Loads the Search History
      *
      * @return
@@ -388,6 +406,87 @@
     }
 
 
+    /**
+     * Loads the Search scope.
+     *
+     * @return
+     *      the search scope
+     */
+    public static List<SearchScopeEnum> loadSearchScope()
+    {
+        List<SearchScopeEnum> searchScope = new ArrayList<SearchScopeEnum>();
+        IDialogSettings settings = Activator.getDefault().getDialogSettings();
+
+        if ( settings.get( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_ALIASES ) == null )
+        {
+            searchScope.add( SearchScopeEnum.ALIASES );
+        }
+        else
+        {
+            if ( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_ALIASES ) )
+            {
+                searchScope.add( SearchScopeEnum.ALIASES );
+            }
+        }
+
+        if ( settings.get( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_OID ) == null )
+        {
+            searchScope.add( SearchScopeEnum.OID );
+        }
+        else
+        {
+            if ( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_OID ) )
+            {
+                searchScope.add( SearchScopeEnum.OID );
+            }
+        }
+
+        if ( settings.get( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_DESCRIPTION ) == null
)
+        {
+            searchScope.add( SearchScopeEnum.DESCRIPTION );
+        }
+        else
+        {
+            if ( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_DESCRIPTION
) )
+            {
+                searchScope.add( SearchScopeEnum.DESCRIPTION );
+            }
+        }
+        if ( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_SUPERIOR ) )
+        {
+            searchScope.add( SearchScopeEnum.SUPERIOR );
+        }
+        if ( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_SYNTAX ) )
+        {
+            searchScope.add( SearchScopeEnum.SYNTAX );
+        }
+        if ( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_MATCHING_RULES
) )
+        {
+            searchScope.add( SearchScopeEnum.MATCHING_RULES );
+        }
+        if ( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_SUPERIORS ) )
+        {
+            searchScope.add( SearchScopeEnum.SUPERIORS );
+        }
+        if ( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_MANDATORY_ATTRIBUTES
) )
+        {
+            searchScope.add( SearchScopeEnum.MANDATORY_ATTRIBUTES );
+        }
+        if ( settings.getBoolean( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_OPTIONAL_ATTRIBUTES
) )
+        {
+            searchScope.add( SearchScopeEnum.OPTIONAL_ATTRIBUTES );
+        }
+
+        return searchScope;
+    }
+
+
+    /**
+     * Saves the Search scope.
+     *
+     * @param scope
+     *      the Search scope
+     */
     public static void saveSearchScope( List<SearchScopeEnum> scope )
     {
         if ( ( scope != null ) && ( scope.size() > 0 ) )
@@ -409,5 +508,15 @@
             settings.put( PluginConstants.PREFS_SEARCH_PAGE_SCOPE_OPTIONAL_ATTRIBUTES, scope
                 .contains( SearchScopeEnum.OPTIONAL_ATTRIBUTES ) );
         }
+    }
+
+
+    /**
+     * Clears the Search History.
+     */
+    public static void clearSearchHistory()
+    {
+        Activator.getDefault().getDialogSettings()
+            .put( PluginConstants.PREFS_SEARCH_PAGE_SEARCH_HISTORY, new String[0] );
     }
 }

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SearchView.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SearchView.java?rev=567548&r1=567547&r2=567548&view=diff
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SearchView.java
(original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SearchView.java
Sun Aug 19 22:34:39 2007
@@ -22,18 +22,22 @@
 
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 import org.apache.directory.shared.ldap.schema.SchemaObject;
 import org.apache.directory.studio.apacheds.schemaeditor.Activator;
 import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
 import org.apache.directory.studio.apacheds.schemaeditor.controller.SearchViewController;
+import org.apache.directory.studio.apacheds.schemaeditor.view.search.SearchPage;
 import org.apache.directory.studio.apacheds.schemaeditor.view.search.SearchPage.SearchScopeEnum;
 import org.eclipse.jface.dialogs.IDialogSettings;
 import org.eclipse.jface.viewers.ArrayContentProvider;
 import org.eclipse.jface.viewers.LabelProvider;
 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;
@@ -180,6 +184,16 @@
                 validateSearchField();
             }
         } );
+        searchField.addKeyListener( new KeyAdapter()
+        {
+            public void keyReleased( KeyEvent e )
+            {
+                if ( e.keyCode == 13 ) // TODO replace with the correct key
+                {
+                    search();
+                }
+            }
+        } );
 
         // Search Scope Toolbar
         final ToolBar scopeToolBar = new ToolBar( searchFieldInnerComposite, SWT.HORIZONTAL
| SWT.FLAT );
@@ -602,11 +616,17 @@
     public void setSearchInput( String searchString, SearchScopeEnum[] scope )
     {
         this.searchString = searchString;
+
+        // Saving search String and Search Scope to dialog settings
+        SearchPage.addSearchStringHistory( searchString );
+        SearchPage.saveSearchScope( Arrays.asList( scope ) );
+
         if ( ( searchField != null ) && ( !searchField.isDisposed() ) )
         {
             searchField.setText( searchString );
             validateSearchField();
         }
+
         List<SchemaObject> results = search( searchString, scope );
         setSearchResultsLabel( searchString, results.size() );
     }
@@ -631,7 +651,10 @@
      */
     private void search()
     {
-        // TODO
+        String searchString = searchField.getText();
+        List<SearchScopeEnum> searchScope = SearchPage.loadSearchScope();
+
+        setSearchInput( searchString, searchScope.toArray( new SearchScopeEnum[0] ) );
     }
 
 
@@ -673,5 +696,17 @@
         }
 
         searchResultsLabel.setText( sb.toString() );
+    }
+
+
+    /**
+     * Runs the current search again.
+     */
+    public void runCurrentSearchAgain()
+    {
+        if ( searchString != null )
+        {
+            setSearchInput( searchString, SearchPage.loadSearchScope().toArray( new SearchScopeEnum[0]
) );
+        }
     }
 }



Mime
View raw message