directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r927921 - in /directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions: DeleteAllAction.java messages.properties messages_de.properties messages_fr.properties
Date Fri, 26 Mar 2010 15:39:13 GMT
Author: pamarcelot
Date: Fri Mar 26 15:39:13 2010
New Revision: 927921

URL: http://svn.apache.org/viewvc?rev=927921&view=rev
Log:
Fix for DIRSTUDIO-633 (Delete all searches context menu).
Improvement of the initial fix:
  - The action can now delete all child entries of the selected entry.
  - The action is now activated if the 'Bookmarks' or 'Searches' categories are selected.

Modified:
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/DeleteAllAction.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages.properties
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages_de.properties
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages_fr.properties

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/DeleteAllAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/DeleteAllAction.java?rev=927921&r1=927920&r2=927921&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/DeleteAllAction.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/DeleteAllAction.java
Fri Mar 26 15:39:13 2010
@@ -21,9 +21,15 @@
 package org.apache.directory.studio.ldapbrowser.common.actions;
 
 
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
+import org.apache.directory.studio.ldapbrowser.common.widgets.browser.BrowserCategory;
 import org.apache.directory.studio.ldapbrowser.core.model.IBookmark;
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
 import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
 import org.eclipse.jface.resource.ImageDescriptor;
 
@@ -36,8 +42,9 @@ import org.eclipse.jface.resource.ImageD
  */
 public class DeleteAllAction extends DeleteAction
 {
-    private static final IBookmark[] EMPTY_BOOKMARKS = new IBookmark[0];
+    private static final Collection<IEntry> EMPTY_ENTRIES = new HashSet<IEntry>();
     private static final ISearch[] EMPTY_SEARCHES = new ISearch[0];
+    private static final IBookmark[] EMPTY_BOOKMARKS = new IBookmark[0];
 
 
     /**
@@ -62,11 +69,19 @@ public class DeleteAllAction extends Del
      */
     public String getText()
     {
-        if ( getSelectedSearches().length >= 1 )
+        if ( getSelectedEntries().length >= 1 )
+        {
+            return Messages.getString( "DeleteAllAction.DeleteAllChildEntries" ); //$NON-NLS-1$
+        }
+        else if ( ( getSelectedSearches().length >= 1 )
+            || ( ( getSelectedBrowserViewCategories().length == 1 ) && ( getSelectedBrowserViewCategories()[0]
+                .getType() == BrowserCategory.TYPE_SEARCHES ) ) )
         {
             return Messages.getString( "DeleteAllAction.DeleteAllSearches" ); //$NON-NLS-1$
         }
-        else if ( getSelectedBookmarks().length >= 1 )
+        else if ( ( getSelectedBookmarks().length >= 1 )
+            || ( ( getSelectedBrowserViewCategories().length == 1 ) && ( getSelectedBrowserViewCategories()[0]
+                .getType() == BrowserCategory.TYPE_BOOKMARKS ) ) )
         {
             return Messages.getString( "DeleteAllAction.DeleteAllBookmarks" ); //$NON-NLS-1$
         }
@@ -98,9 +113,18 @@ public class DeleteAllAction extends Del
     /**
      * {@inheritDoc}
      */
-    public boolean isEnabled()
+    protected Collection<IEntry> getEntries()
     {
-        return ( ( getSelectedSearches().length >= 1 ) || getSelectedBookmarks().length
>= 1 );
+        if ( getSelectedEntries().length >= 1 )
+        {
+            Collection<IEntry> values = new HashSet<IEntry>();
+            values.addAll( Arrays.asList( getSelectedEntries()[0].getChildren() ) );
+            return values;
+        }
+        else
+        {
+            return EMPTY_ENTRIES;
+        }
     }
 
 
@@ -114,6 +138,12 @@ public class DeleteAllAction extends Del
             return getSelectedSearches()[0].getBrowserConnection().getSearchManager().getSearches().toArray(
                 new ISearch[0] );
         }
+        else if ( ( getSelectedBrowserViewCategories().length == 1 )
+            && ( getSelectedBrowserViewCategories()[0].getType() == BrowserCategory.TYPE_SEARCHES
) )
+        {
+            return getSelectedBrowserViewCategories()[0].getParent().getSearchManager().getSearches().toArray(
+                new ISearch[0] );
+        }
         else
         {
             return EMPTY_SEARCHES;
@@ -130,6 +160,11 @@ public class DeleteAllAction extends Del
         {
             return getSelectedBookmarks()[0].getBrowserConnection().getBookmarkManager().getBookmarks();
         }
+        else if ( ( getSelectedBrowserViewCategories().length == 1 )
+            && ( getSelectedBrowserViewCategories()[0].getType() == BrowserCategory.TYPE_BOOKMARKS
) )
+        {
+            return getSelectedBrowserViewCategories()[0].getParent().getBookmarkManager().getBookmarks();
+        }
         else
         {
             return EMPTY_BOOKMARKS;

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages.properties?rev=927921&r1=927920&r2=927921&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages.properties
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages.properties
Fri Mar 26 15:39:13 2010
@@ -54,8 +54,9 @@ DeleteAction.DeleteValueQuestion=Are you
 DeleteAction.DeleteValues=Delete Values
 DeleteAction.DeleteValuesQuestion=Are your sure to delete the following values?
 DeleteAllAction.DeleteAll=Delete All
-DeleteAllAction.DeleteAllSearches=Delete All Searches
 DeleteAllAction.DeleteAllBookmarks=Delete All Bookmarks
+DeleteAllAction.DeleteAllChildEntries=Delete All Child Entries
+DeleteAllAction.DeleteAllSearches=Delete All Searches
 DeleteAllValuesAction.DeleteAttribute=Delete Attribute
 DeleteAllValuesAction.DeleteAttributeX=Delete Attribute {0}
 FilterChildrenAction.FilterChildren=Filter Children

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages_de.properties?rev=927921&r1=927920&r2=927921&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages_de.properties
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages_de.properties
Fri Mar 26 15:39:13 2010
@@ -54,8 +54,9 @@ DeleteAction.DeleteValueQuestion=Sind Si
 DeleteAction.DeleteValues=Werte l\u00F6schen
 DeleteAction.DeleteValuesQuestion=Sind Sie sicher die folgenden Werte zu l\u00F6schen?
 DeleteAllAction.DeleteAll=TODO:Delete All
-DeleteAllAction.DeleteAllSearches=TODO:Delete All Searches
 DeleteAllAction.DeleteAllBookmarks=TODO:Delete All Bookmarks
+DeleteAllAction.DeleteAllChildEntries=Delete All Child Entries
+DeleteAllAction.DeleteAllSearches=TODO:Delete All Searches
 DeleteAllValuesAction.DeleteAttribute=Attribut l\u00F6schen
 DeleteAllValuesAction.DeleteAttributeX=Attribut {0} l\u00F6schen
 FilterChildrenAction.FilterChildren=Kind-Eintr\u00E4ge filtern

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages_fr.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages_fr.properties?rev=927921&r1=927920&r2=927921&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages_fr.properties
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/messages_fr.properties
Fri Mar 26 15:39:13 2010
@@ -53,9 +53,10 @@ DeleteAction.DeleteValue=Supprimer la va
 DeleteAction.DeleteValueQuestion=Etes-vous s\u00FBr de vouloir supprimer la valeur suivante
?
 DeleteAction.DeleteValues=Supprimer les valeurs
 DeleteAction.DeleteValuesQuestion=Etes-vous s\u00FBr de vouloir supprimer les valeurs suivantes
?
-DeleteAllAction.DeleteAll=Supprimer Tout
-DeleteAllAction.DeleteAllSearches=Supprimer toutes les recherches
+DeleteAllAction.DeleteAll=Supprimer tout
 DeleteAllAction.DeleteAllBookmarks=Supprimer tous les signets
+DeleteAllAction.DeleteAllChildEntries=Supprimer toutes les entrées fils
+DeleteAllAction.DeleteAllSearches=Supprimer toutes les recherches
 DeleteAllValuesAction.DeleteAttribute=Supprimer l'attribut
 DeleteAllValuesAction.DeleteAttributeX=Supprimer l''attribut {0}
 FilterChildrenAction.FilterChildren=Filtrer les fils



Mime
View raw message