directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r752017 - in /directory/studio/trunk/ldapbrowser-common: resources/icons/ src/main/java/org/apache/directory/studio/ldapbrowser/common/ src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/ src/main/java/org/apache/directory...
Date Tue, 10 Mar 2009 08:14:33 GMT
Author: seelmann
Date: Tue Mar 10 08:14:30 2009
New Revision: 752017

URL: http://svn.apache.org/viewvc?rev=752017&view=rev
Log:
DIRSTUDIO-335: added scope button, added event handling in dialog, string externalization

Added:
    directory/studio/trunk/ldapbrowser-common/resources/icons/subtree.gif   (with props)
Modified:
    directory/studio/trunk/ldapbrowser-common/resources/icons/quicksearch.gif
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/SelectEntryDialog.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserQuickSearchWidget.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserUniversalListener.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/messages.properties
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/messages_de.properties

Modified: directory/studio/trunk/ldapbrowser-common/resources/icons/quicksearch.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/resources/icons/quicksearch.gif?rev=752017&r1=752016&r2=752017&view=diff
==============================================================================
Binary files - no diff available.

Added: directory/studio/trunk/ldapbrowser-common/resources/icons/subtree.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/resources/icons/subtree.gif?rev=752017&view=auto
==============================================================================
Binary file - no diff available.

Propchange: directory/studio/trunk/ldapbrowser-common/resources/icons/subtree.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java?rev=752017&r1=752016&r2=752017&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java
Tue Mar 10 08:14:30 2009
@@ -138,6 +138,7 @@
     public static final String IMG_SEARCHES = "resources/icons/searches.gif"; //$NON-NLS-1$
     public static final String IMG_SEARCH = "resources/icons/search.gif"; //$NON-NLS-1$
     public static final String IMG_QUICKSEARCH = "resources/icons/quicksearch.gif"; //$NON-NLS-1$
+    public static final String IMG_SUBTREE = "resources/icons/subtree.gif"; //$NON-NLS-1$
     public static final String IMG_SEARCH_UNPERFORMED = "resources/icons/search_unperformed.gif";
//$NON-NLS-1$
     public static final String IMG_BOOKMARKS = "resources/icons/bookmarks.gif"; //$NON-NLS-1$
     public static final String IMG_BOOKMARK = "resources/icons/bookmark.gif"; //$NON-NLS-1$

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/SelectEntryDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/SelectEntryDialog.java?rev=752017&r1=752016&r2=752017&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/SelectEntryDialog.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/SelectEntryDialog.java
Tue Mar 10 08:14:30 2009
@@ -26,6 +26,7 @@
 import org.apache.directory.studio.ldapbrowser.common.widgets.browser.BrowserUniversalListener;
 import org.apache.directory.studio.ldapbrowser.common.widgets.browser.BrowserWidget;
 import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+import org.apache.directory.studio.ldapbrowser.core.model.ISearchResult;
 import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -194,6 +195,10 @@
                     {
                         initialEntry = ( IEntry ) o;
                     }
+                    else if ( o instanceof ISearchResult )
+                    {
+                        initialEntry = ( ( ISearchResult ) o ).getEntry();
+                    }
                 }
             }
         } );

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserQuickSearchWidget.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserQuickSearchWidget.java?rev=752017&r1=752016&r2=752017&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserQuickSearchWidget.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserQuickSearchWidget.java
Tue Mar 10 08:14:30 2009
@@ -37,9 +37,13 @@
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
 import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
 import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
+import org.apache.directory.studio.ldapbrowser.core.model.ISearch.SearchScope;
 import org.apache.directory.studio.ldapbrowser.core.model.impl.QuickSearch;
 import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaUtils;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.jface.fieldassist.ComboContentAdapter;
+import org.eclipse.jface.resource.JFaceResources;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
 import org.eclipse.jface.viewers.SelectionChangedEvent;
@@ -48,6 +52,8 @@
 import org.eclipse.swt.events.ModifyListener;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.FontMetrics;
+import org.eclipse.swt.graphics.GC;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
@@ -99,6 +105,9 @@
     /** The quick search value proposal provider. */
     private ListContentProposalProvider quickSearchValuePP;
 
+    /** The quick search scope button. */
+    private Button quickSearchScopeButton;
+
     /** The quick search run button. */
     private Button quickSearchRunButton;
 
@@ -159,7 +168,7 @@
     {
         this.browserWidget.getViewer().addPostSelectionChangedListener( selectionListener
);
 
-        innerComposite = BaseWidgetUtils.createColumnContainer( composite, 4, 1 );
+        innerComposite = BaseWidgetUtils.createColumnContainer( composite, 5, 1 );
 
         quickSearchAttributeCombo = BaseWidgetUtils.createCombo( innerComposite, EMPTY, -1,
1 );
         quickSearchAttributePP = new ListContentProposalProvider( EMPTY );
@@ -179,24 +188,16 @@
                 performSearch();
             }
         } );
-        //        quickSearchAttributeCombo.addKeyListener( new KeyListener()
-        //        {
-        //            public void keyPressed( KeyEvent e )
-        //            {
-        //                if ( e.character == SWT.CR || e.character == SWT.LF )
-        //                {
-        //                    e.doit = false;
-        //                }
-        //            }
-        //            public void keyReleased( KeyEvent e )
-        //            {
-        //            }
-        //        });
 
         String[] operators = new String[]
             { "=", "!=", "<=", ">=", "~=" };
         quickSearchOperatorCombo = BaseWidgetUtils.createReadonlyCombo( innerComposite, operators,
0, 1 );
-        GridData data = new GridData( 50, SWT.DEFAULT );
+        GC gc = new GC( parent );
+        gc.setFont( JFaceResources.getDialogFont() );
+        FontMetrics fontMetrics = gc.getFontMetrics();
+        gc.dispose();
+        int width = Dialog.convertHorizontalDLUsToPixels( fontMetrics, IDialogConstants.BUTTON_WIDTH
/ 2 );
+        GridData data = new GridData( width, SWT.DEFAULT );
         quickSearchOperatorCombo.setLayoutData( data );
 
         String[] values = HistoryUtils.load( VALUE_HISTORY_DIALOGSETTING_KEY );
@@ -212,6 +213,21 @@
             }
         } );
 
+        quickSearchScopeButton = new Button( innerComposite, SWT.TOGGLE );
+        quickSearchScopeButton.setToolTipText( Messages.getString( "BrowserQuickSearchWidget.ScopeOneLevelToolTip"
) ); //$NON-NLS-1$
+        quickSearchScopeButton.setImage( BrowserCommonActivator.getDefault().getImage(
+            BrowserCommonConstants.IMG_SUBTREE ) );
+        quickSearchScopeButton.setEnabled( true );
+        quickSearchScopeButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                String one = Messages.getString( "BrowserQuickSearchWidget.ScopeOneLevelToolTip"
); //$NON-NLS-1$
+                String sub = Messages.getString( "BrowserQuickSearchWidget.ScopeSubtreeToolTip"
); //$NON-NLS-1$
+                quickSearchScopeButton.setToolTipText( quickSearchScopeButton.getSelection()
? sub : one );
+            }
+        } );
+
         quickSearchRunButton = new Button( innerComposite, SWT.PUSH );
         quickSearchRunButton.setToolTipText( Messages.getString( "BrowserQuickSearchWidget.RunQuickSearch"
) ); //$NON-NLS-1$
         quickSearchRunButton.setImage( BrowserCommonActivator.getDefault().getImage(
@@ -254,6 +270,7 @@
         IBrowserConnection conn = entry.getBrowserConnection();
 
         QuickSearch quickSearch = new QuickSearch();
+        quickSearch.setName( "Quick Search" );
         quickSearch.setBrowserConnection( conn );
         quickSearch.setSearchBase( entry.getDn() );
         quickSearch.setReturningAttributes( ISearch.NO_ATTRIBUTES );
@@ -261,11 +278,7 @@
         quickSearch.setReferralsHandlingMethod( conn.getReferralsHandlingMethod() );
         quickSearch.setCountLimit( conn.getCountLimit() );
         quickSearch.setTimeLimit( conn.getTimeLimit() );
-
-        // TODO: externalize string
-        quickSearch.setName( "Quick Search" );
-        // TODO: select search scope
-        quickSearch.setScope( ISearch.SearchScope.SUBTREE );
+        quickSearch.setScope( quickSearchScopeButton.getSelection() ? SearchScope.SUBTREE
: SearchScope.ONELEVEL );
 
         StringBuffer filter = new StringBuffer();
         filter.append( "(" );
@@ -380,6 +393,10 @@
             {
                 setInput( ( IBrowserConnection ) input );
             }
+            else if ( input != null && input instanceof IEntry[] )
+            {
+                setInput( ( ( IEntry[] ) input )[0].getBrowserConnection() );
+            }
             quickSearchAttributeCombo.setFocus();
         }
         else if ( !visible && innerComposite != null && composite != null
)

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserUniversalListener.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserUniversalListener.java?rev=752017&r1=752016&r2=752017&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserUniversalListener.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserUniversalListener.java
Tue Mar 10 08:14:30 2009
@@ -31,13 +31,17 @@
 import org.apache.directory.studio.ldapbrowser.core.events.EntryModificationEvent;
 import org.apache.directory.studio.ldapbrowser.core.events.EntryUpdateListener;
 import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
+import org.apache.directory.studio.ldapbrowser.core.events.SearchUpdateEvent;
+import org.apache.directory.studio.ldapbrowser.core.events.SearchUpdateListener;
 import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
 import org.apache.directory.studio.ldapbrowser.core.model.IRootDSE;
+import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
 import org.eclipse.jface.viewers.DoubleClickEvent;
 import org.eclipse.jface.viewers.IDoubleClickListener;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.viewers.ITreeContentProvider;
 import org.eclipse.jface.viewers.ITreeViewerListener;
+import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.viewers.TreeExpansionEvent;
 import org.eclipse.jface.viewers.TreeViewer;
 
@@ -48,7 +52,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class BrowserUniversalListener implements ConnectionUpdateListener, EntryUpdateListener
+public class BrowserUniversalListener implements ConnectionUpdateListener, EntryUpdateListener,
SearchUpdateListener
 {
 
     /** The tree viewer */
@@ -126,6 +130,7 @@
 
         ConnectionEventRegistry.addConnectionUpdateListener( this, ConnectionUIPlugin.getDefault().getEventRunner()
);
         EventRegistry.addEntryUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner()
);
+        EventRegistry.addSearchUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner()
);
     }
 
 
@@ -141,6 +146,7 @@
 
             ConnectionEventRegistry.removeConnectionUpdateListener( this );
             EventRegistry.removeEntryUpdateListener( this );
+            EventRegistry.removeSearchUpdateListener( this );
 
             viewer = null;
         }
@@ -223,7 +229,24 @@
         }
 
         viewer.refresh( event.getModifiedEntry(), true );
+    }
+
 
+    /**
+     * {@inheritDoc}
+     *
+     * This implementation refreshes the tree and selects the search.
+     */
+    public void searchUpdated( SearchUpdateEvent searchUpdateEvent )
+    {
+        ISearch search = searchUpdateEvent.getSearch();
+        viewer.refresh();
+
+        if ( search.getBrowserConnection().getSearchManager().getQuickSearch() == search
)
+        {
+            viewer.setSelection( new StructuredSelection( search ), true );
+            viewer.expandToLevel( search, 1 );
+        }
     }
 
 }

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/messages.properties?rev=752017&r1=752016&r2=752017&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/messages.properties
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/messages.properties
Tue Mar 10 08:14:30 2009
@@ -44,3 +44,7 @@
 BrowserSorterDialog.SortLimit=Sort limit:
 BrowserSorterDialog.SortLimitToolTip=If there are more than the specified number of children
they won't be sorted. Hint: For performance reason the maximum value should be 10.000\!
 OpenSortDialogAction.Sorting=Sorting...
+ShowQuickSearchAction.ShowQuickSearch=Show Quick Search
+BrowserQuickSearchWidget.RunQuickSearch=Run Quick Search
+BrowserQuickSearchWidget.ScopeOneLevelToolTip=Search one level only
+BrowserQuickSearchWidget.ScopeSubtreeToolTip=Search whole subtree

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/messages_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/messages_de.properties?rev=752017&r1=752016&r2=752017&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/messages_de.properties
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/messages_de.properties
Tue Mar 10 08:14:30 2009
@@ -44,3 +44,7 @@
 BrowserSorterDialog.SortLimit=Sortier-Limit:
 BrowserSorterDialog.SortLimitToolTip=Bei mehr Einträgen wird keine Sortierung durchgeführt.
Hinweis: Der Wert sollte 10000 nicht übersteigen\!
 OpenSortDialogAction.Sorting=Sortierung...
+ShowQuickSearchAction.ShowQuickSearch=Schnellsuche anzeigen
+BrowserQuickSearchWidget.RunQuickSearch=Schnellsuche ausführen
+BrowserQuickSearchWidget.ScopeOneLevelToolTip=Nur eine Ebene durchsuchen (One Level)
+BrowserQuickSearchWidget.ScopeSubtreeToolTip=Gesamten Teilbaum durchsuchen (Subtree)
\ No newline at end of file



Mime
View raw message