directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r927766 - in /directory/studio/trunk: ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/ ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/
Date Fri, 26 Mar 2010 10:47:58 GMT
Author: pamarcelot
Date: Fri Mar 26 10:47:58 2010
New Revision: 927766

URL: http://svn.apache.org/viewvc?rev=927766&view=rev
Log:
Fix for DIRSTUDIO-633 (Delete all searches context menu).

Added:
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/DeleteAllAction.java
Modified:
    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
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewActionGroup.java

Added: 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=927766&view=auto
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/DeleteAllAction.java
(added)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/DeleteAllAction.java
Fri Mar 26 10:47:58 2010
@@ -0,0 +1,138 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.ldapbrowser.common.actions;
+
+
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
+import org.apache.directory.studio.ldapbrowser.core.model.IBookmark;
+import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
+import org.eclipse.jface.resource.ImageDescriptor;
+
+
+/**
+ * This Action deletes all the Searches or Bookmarks.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DeleteAllAction extends DeleteAction
+{
+    private static final IBookmark[] EMPTY_BOOKMARKS = new IBookmark[0];
+    private static final ISearch[] EMPTY_SEARCHES = new ISearch[0];
+
+
+    /**
+     * Creates a new instance of DeleteAllAction.
+     */
+    public DeleteAllAction()
+    {
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void run()
+    {
+        super.run();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getText()
+    {
+        if ( getSelectedSearches().length >= 1 )
+        {
+            return Messages.getString( "DeleteAllAction.DeleteAllSearches" ); //$NON-NLS-1$
+        }
+        else if ( getSelectedBookmarks().length >= 1 )
+        {
+            return Messages.getString( "DeleteAllAction.DeleteAllBookmarks" ); //$NON-NLS-1$
+        }
+        else
+        {
+            return Messages.getString( "DeleteAllAction.DeleteAll" ); //$NON-NLS-1$
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public ImageDescriptor getImageDescriptor()
+    {
+        return BrowserCommonActivator.getDefault().getImageDescriptor( BrowserCommonConstants.IMG_DELETE_ALL
);
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getCommandId()
+    {
+        return null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isEnabled()
+    {
+        return ( ( getSelectedSearches().length >= 1 ) || getSelectedBookmarks().length
>= 1 );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected ISearch[] getSearches()
+    {
+        if ( getSelectedSearches().length >= 1 )
+        {
+            return getSelectedSearches()[0].getBrowserConnection().getSearchManager().getSearches().toArray(
+                new ISearch[0] );
+        }
+        else
+        {
+            return EMPTY_SEARCHES;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected IBookmark[] getBookmarks()
+    {
+        if ( getSelectedBookmarks().length >= 1 )
+        {
+            return getSelectedBookmarks()[0].getBrowserConnection().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=927766&r1=927765&r2=927766&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 10:47:58 2010
@@ -53,6 +53,9 @@ DeleteAction.DeleteValue=Delete Value
 DeleteAction.DeleteValueQuestion=Are your sure to delete the following value?
 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
 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=927766&r1=927765&r2=927766&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 10:47:58 2010
@@ -53,6 +53,9 @@ DeleteAction.DeleteValue=Wert l\u00F6sch
 DeleteAction.DeleteValueQuestion=Sind Sie sicher den folgenden Wert zu l\u00F6schen?
 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
 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=927766&r1=927765&r2=927766&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 10:47:58 2010
@@ -53,6 +53,9 @@ 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.DeleteAllBookmarks=Supprimer tous les signets
 DeleteAllValuesAction.DeleteAttribute=Supprimer l'attribut
 DeleteAllValuesAction.DeleteAttributeX=Supprimer l''attribut {0}
 FilterChildrenAction.FilterChildren=Filtrer les fils

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewActionGroup.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewActionGroup.java?rev=927766&r1=927765&r2=927766&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewActionGroup.java
(original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewActionGroup.java
Fri Mar 26 10:47:58 2010
@@ -23,6 +23,7 @@ package org.apache.directory.studio.ldap
 
 import org.apache.directory.studio.ldapbrowser.common.actions.CopyAction;
 import org.apache.directory.studio.ldapbrowser.common.actions.DeleteAction;
+import org.apache.directory.studio.ldapbrowser.common.actions.DeleteAllAction;
 import org.apache.directory.studio.ldapbrowser.common.actions.FetchAliasesAction;
 import org.apache.directory.studio.ldapbrowser.common.actions.FetchOperationalAttributesAction;
 import org.apache.directory.studio.ldapbrowser.common.actions.FetchReferralsAction;
@@ -151,6 +152,9 @@ public class BrowserViewActionGroup exte
     /** The Constant copyEntryAsCsvOperationalAction. */
     private static final String copyEntryAsCsvOperationalAction = "copyEntryAsCsvOperationalAction";
//$NON-NLS-1$
 
+    /** The Constant deleteAllAction. */
+    private static final String deleteAllAction = "deleteAllAction"; //$NON-NLS-1$
+
     /** The Constant importDsmlAction. */
     private static final String importDsmlAction = "importDsmlAction"; //$NON-NLS-1$
 
@@ -245,6 +249,7 @@ public class BrowserViewActionGroup exte
             new CopyEntryAsCsvAction( CopyEntryAsLdifAction.MODE_RETURNING_ATTRIBUTES_ONLY
) ) );
         browserActionMap.put( copyEntryAsCsvOperationalAction, new BrowserViewActionProxy(
viewer,
             new CopyEntryAsCsvAction( CopyEntryAsLdifAction.MODE_INCLUDE_OPERATIONAL_ATTRIBUTES
) ) );
+        browserActionMap.put( deleteAllAction, new BrowserViewActionProxy( viewer, new DeleteAllAction()
) );
 
         browserActionMap.put( importDsmlAction, new BrowserViewActionProxy( viewer, new ImportExportAction(
             ImportExportAction.TYPE_IMPORT_DSML ) ) );
@@ -374,6 +379,8 @@ public class BrowserViewActionGroup exte
         advancedMenuManager.add( browserActionMap.get( copyEntryAsCsvAction ) );
         advancedMenuManager.add( browserActionMap.get( copyEntryAsCsvOperationalAction )
);
         advancedMenuManager.add( new Separator() );
+        advancedMenuManager.add( browserActionMap.get( deleteAllAction ) );
+        advancedMenuManager.add( new Separator() );
         menuManager.add( advancedMenuManager );
         menuManager.add( new Separator() );
 



Mime
View raw message